Openfire/resources/spank

Hi:

I am looking at demoing openfire as a way of allowing customers to access their web banking profile from atms. The atms have a “web exit,” (they aren’t on the internet) so I would use BOSH to communicate with the atms. The web banking would be accessed with an openfire plugin.

My web app is basically BOSH, so I was thinking that I would add to the openfire/resources/spank webappdir. That approach doen’t work anymore see:

“Created: 2007-05-23 17:01:15 -0500
(8 months ago)
| Author: alex
| Changeset: 8389
Decoupled http-binding service from file system. No longer dependent on the web.xml in the spank directory. JM-1074”

I am unconvinced by the Jira:

“Currently, HTTP Binding depends upon the /spank/resources/ directory in
order to function appropriately because its servlets are defined in the
resident web.xml. If HTTP binding were loaded programatically on the
other hand that directory could not exist and the the http-binding
server would still function normally. The mission is then to decouple
the functionality of HTTP binding from the layout of the file system.”

that this was a good thing. I am thinking that I will import the code and change it back in my repository, unless someone can convince me otherwise?

thanks

Rich

Hi Again:

I am a bit dubious that httpbind works at all in this version. When I post to what I think is the url I get back a 400 status. When I investigate further in the error logs, it looks to me as though the servlets, don’t get initialized at all:

javax.servlet.UnavailableException: org.jivesoftware.wildfire.http.ResourceServlet
at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:233)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollec tion.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.jivesoftware.openfire.http.HttpBindManager.start(HttpBindManager.java:92)
at org.jivesoftware.openfire.spi.ConnectionManagerImpl.startHTTPBindListeners(Conn ectionManagerImpl.java:505)
at org.jivesoftware.openfire.spi.ConnectionManagerImpl.startListeners(ConnectionMa nagerImpl.java:134)
at org.jivesoftware.openfire.spi.ConnectionManagerImpl.access$000(ConnectionManage rImpl.java:52)
at org.jivesoftware.openfire.spi.ConnectionManagerImpl$1.pluginsMonitored(Connecti onManagerImpl.java:106)
at org.jivesoftware.openfire.container.PluginManager.firePluginsMonitored(PluginMa nager.java:532)
at org.jivesoftware.openfire.container.PluginManager.access$800(PluginManager.java :46)
at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:1023)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Is anyone using http-bind succesfully with rev [openfire:openfire3_4_5 ?|http://www.igniterealtime.org/fisheye/browse/svn-org/openfire/trunk/src/java/org /jivesoftware/openfire/http/HttpBindManager.java#bopenfire:openfire_3_4_5]_

thanks

Rich

Hi:

I still haven’t given up on using openfire to implement my coureurs.ca website. I found that I could get http-bind to work with the help of a fix to a policy-violation problem that I was having.

For testing and to get past the browser security problem, I used rhino. I attached the following javascript to the policy-violationposting. John Resig’s slightly fixed env.js, well as crypt.js from

jsjac and my own javascript code for my HttpClientConnection.js and a

test script BOSH.js that does the Romeo and Juliet scene from the

specifications. I hope that this helps others like the policy-violation fix helped me.

thanks

Rich

Hi:

I made Alex’s changeset 8389 check for the existence of the web.xml file. This keeps the stated spirit of the change to remove the dependency on the directory being there, while allowing the resource to be used if it exists.

@@ -265,13 +265,27 @@

if (httpsConnector != null) {

httpBindServer.addConnector(httpsConnector);

}

  •    if(!createWebAppContext())
    
  •    {
    
  •           createBoshHandler(contexts, "/http-bind");
    
  •           createCrossDomainHandler(contexts, "/");
    
  •           loadStaticDirectory(contexts);
    
  •    }
    
  •    createBoshHandler(contexts, "/http-bind");
    
  •    createCrossDomainHandler(contexts, "/");
    
  •    loadStaticDirectory(contexts);
    

httpBindServer.setHandlers(new Handler[]{contexts, new DefaultHandler()

});

}

  • private boolean createWebAppContext() {

  •   String sFname = JiveGlobals.getHomeDirectory() +
    
  •                   File.separator + "resources" + File.separator + "spank";
    
  •   if (!new File(sFname + File.separator + "WEB-INF" + File.separator + "we
    

b.xml").exists())

  •   {
    
  •           return false;
    
  •   }
    
  •   WebAppContext context = new WebAppContext(contexts, sFname, "/");
    
  •   context.setWelcomeFiles(new String[]{"index.html"});
    
  •   return true;
    
  • }

private void createBoshHandler(ContextHandlerCollection contexts, String bo

shPath) {

ServletHandler handler = new ServletHandler();

I also needed to change the web.xml from that changeset

@@ -4,4 +4,36 @@

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.co

m/xml/ns/j2ee/web-app_2_4.xsd">

  • <servlet>

  •    &lt;servlet-name&gt;HttpBindServlet&lt;/servlet-name&gt;
    
  •    &lt;servlet-class&gt;org.jivesoftware.openfire.http.HttpBindServlet&lt;/servlet -
    

class>

  •    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    
  • </servlet>

  • <servlet-mapping>

  •    &lt;servlet-name&gt;HttpBindServlet&lt;/servlet-name&gt;
    
  •    &lt;url-pattern&gt;/http-bind/&lt;/url-pattern&gt;
    
  • </servlet-mapping>

  • <servlet>

  •    &lt;servlet-name&gt;JavaScriptServlet&lt;/servlet-name&gt;
    
  •    &lt;servlet-class&gt;org.jivesoftware.openfire.http.ResourceServlet&lt;/servlet -
    

class>

  •    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    
  • </servlet>

  • <servlet-mapping>

  •    &lt;servlet-name&gt;JavaScriptServlet&lt;/servlet-name&gt;
    
  •    &lt;url-pattern&gt;/scripts/&lt;/url-pattern&gt;
    
  • </servlet-mapping>

  • <servlet>

  •    &lt;servlet-name&gt;FlashCrossDomain&lt;/servlet-name&gt;
    
  •    &lt;servlet-class&gt;org.jivesoftware.openfire.http.FlashCrossDomainServlet&lt; /
    

servlet-class>

  • </servlet>

  • <servlet-mapping>

  •    &lt;servlet-name&gt;FlashCrossDomain&lt;/servlet-name&gt;
    
  •    &lt;url-pattern&gt;/crossdomain.xml&lt;/url-pattern&gt;
    
  • </servlet-mapping>

</web-app>

I am pleased that I was able to get this going so that I can use jetty and openfire to run my web-site, which is mostly openfire anyways. The only other thing that I need to do is to enable the openfire embedded jetty to do setuid.

thanks

Rich

Hi,

I don’t understand your post.

Are these changes I have to apply to the source to use the spank directory or will the next release of openfire fix this?

Thanks

Hi Dror:

To successfully use the resources/spank directory you will need to make the

changes that I made to a source distribution and re-run the ant task. I

don’t think that it will be part of a new release, as no-one but me replied

to my post. The spark web client is flash based, so I guess that the need is

different than if you are trying to do javascript. There is also another

post about policy-violation with a fix that you will need to apply. I

attached my javascript code to that post, if you are interested. I would

also be very interested in seeing any javascript work that you do in this

domain.

thanks

Rich

Hi rhildred,

Thank you for your response.

Did the openfire had to break the normal file server in order to make the flash client work,

or did they break it so it will be harder to build a custom javascript client?

I hope they’ll support javascript and html files handeling thorugh the spank directory again.

It’s an open source project after all… and ejabberd has a great file server…

My javascript client is a very complicated and feature rich.

Can you tell me about your project and we’ll see if we can join forces?

Dror

Hi Again Dror:

I don’t know if the openfire project has veered away from javascript and

html. I think that there is a lot that can be accomplished in that medium.

My project is on sourceforge at http://syndicateme.sourceforge.net. I have

been taking a newer direction, which I tried to describe functionally at

http://coureurs.ca. The project started out basically as a way to re-invent

myself as part of a continuing job search.

I am trying to do test driven development in javascript, dhtml and java. I

am also trying to be as student friendly as possible. I started out doing

this with my Dad and my son, but my Dad got sick, and my son is much busier

than he thought. I would love to have someone else to work with.

thanks

Rich

Too bad. Openfire Developers never said a single word about it. I have problems using http binding with Openfire 3.4.2 and up.

You can see some post related in

http://www.igniterealtime.org/community/message/165375#165375

I downgrade my version to Openfire 3.4.1 and now I configure a

/jwchat and a /jeti directories, just copying the files under the

\resources\spank subdirectories in Openfire Home, then i get some http

services from there (Openfire in this case works like a Web Server i

didn´t need Apache or Tomcat):slight_smile:

Using 3.4.2 i could not do this…

Hi Clarf:

I seem to have the latest (3.4.5), plus a couple of small patches version

working on http://syndicateme.net and http://coureurs.ca. Hopefully over the

next week or 2 things will start to get much more interesting there at these

2 sites.

thanks

Rich