thanks for your reply.
I dont really understand how the fastpath webclient or the http-bind web service is actually helping me. I try to accomplish that i can for instance see the users in a multi user chat room by a http call, something like http://localhost:9090/plugins/restservice/restservice/muc/{roomid} that lists all the usernames… this seems not to be the intention of the fastpath webclient or am I missing something?
However, I found some other posts (http://community.igniterealtime.org/message/203902) regarding a RESTful webservice with jersey and I finally got it run so the method in my hello class is called (as I can see in the console). my setup is as follows:
- web-custom.xml
<?xml version='1.0' encoding='ISO-8859-1'?>
RESTServiceServlet
com.***.RESTServiceServlet
RESTServiceServlet
/restservice/*
- RESTServiceServlet class
public class RESTServiceServlet extends ServletContainer {
public RESTServiceServlet() {
super(new RESTServiceConfig());
}
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
AuthCheckFilter.addExclude(“restservice/*”);
}
@Override
public void destroy() {
super.destroy();
AuthCheckFilter.removeExclude(“restservice/*”);
}
static public class RESTServiceConfig extends ResourceConfig {
public RESTServiceConfig() {
super(Hello.class);
}
}
}
- Hello class
@Path("/restservice/restservice/hello")
public class Hello {
// This method is called if TEXT_PLAIN is request
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
System.out.println(“sayPlainTextHello”);
return “Hello Jersey”;
}
// This method is called if XML is request
@GET
@Produces(MediaType.TEXT_XML)
public String sayXMLHello() {
System.out.println(“sayXMLHello”);
return “<?xml version=\"1.0\"?>” + " Hello Jersey" + “”;
}
// This method is called if HTML is request
@GET
@Produces(MediaType.TEXT_HTML)
public String sayHtmlHello() {
System.out.println(“sayHtmlHello”);
return “Hello”;
}
}
Maybe this is helpful for somebody else. The only problem I’m facing now is the following exception is shown when I open http://localhost:9090/plugins/restservice/restservice/hello The “???” belong to the page shown!
???
java.lang.NullPointerException
at org.jivesoftware.openfire.admin.decorators.main_jsp._jspService(main_jsp.java:1 95)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:480)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:22 7)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:94 1)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186 )
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.Dispatcher.include(Dispatcher.java:195)
at com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.ja va:156)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:59)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:22 7)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:94 1)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186 )
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandler Collection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.jav a:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConne ction.java:919)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51 )
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.jav a:586)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java :44)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598 )
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
at java.lang.Thread.run(Thread.java:662)