[jboss-dev-forums] [JBoss AS 7 Development] - JBoss AS 7 Bayeux Support
ronorato
do-not-reply at jboss.com
Tue Dec 13 22:29:21 EST 2011
ronorato [http://community.jboss.org/people/ronorato] created the discussion
"JBoss AS 7 Bayeux Support"
To view the discussion, visit: http://community.jboss.org/message/641424#641424
--------------------------------------------------------------
I am attempting to implement a bidirectional connection between my web client and my web server. For this connection I am looking to use the Bayeux protocol. From my previous post I have been informed that JBoss does have some level of support for the Bayeux protocol. I have created a servlet that looks like ( some code has been removed ):
@WebServlet(name="CometServlet", urlPatterns={"/cometd/*"},
initParams={@WebInitParam(name="timeout", value="60000")} )
public class CometServlet extends HttpServlet implements HttpEventServlet
{
protected ArrayList<HttpServletResponse> connections = new ArrayList<HttpServletResponse>();
public CometServlet()
{
log.info( "CometServlet constructed" );
}
public void init()
throws ServletException
{
log.info("init() entered");
}
public void destroy()
{
connections.clear();
}
public void event(HttpEvent event)
throws IOException, ServletException
{
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
switch (event.getType()) {
case BEGIN:
synchronized(connections) {
connections.add(response);
}
break;
case ERROR:
synchronized(connections) {
connections.remove(response);
}
event.close();
break;
case END:
synchronized(connections) {
connections.remove(response);
}
event.close();
break;
case READ:
break;
default:
log.warn("Unsupported Event Type: " + event.getType());
}
}
}
My client is sending the following Post:
POST http://localhost:8080/kinetichealth/accountServices http://localhost:8080/myapp/cometd
with the following parameter:
message = [{"version":"1.0","minimumVersion":"0.9","channel":"/meta/handshake","id":"1","supportedConnectionTypes":["long-polling","long-polling-json-encoded","callback-polling"]}]
what I am getting back is 405 - Method not allowed. I am not seeing it hit the event method at all.
Any help would be greatly appreciated.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/641424#641424]
Start a new discussion in JBoss AS 7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111213/cadb90a2/attachment.html
More information about the jboss-dev-forums
mailing list