1
votes

I'm using the channel API in Java runtime. The servlet I have mapped to /_ah/channel/connected does not appear to be running. I am creating a channel, passing the token, and opening it on the server. This works fine. I do see the call to /_ah/channel/connected in my log, however no log messages appear and the code does not appear to be running. Below is my code and web.xml

ChannelConnectedServlet.java:

public class ChannelConnectedServlet extends HttpServlet{
    private static final Logger logger = Logger.getLogger(ChannelConnectedServlet.class
          .getName());  

    private void process(HttpServletRequest req, HttpServletResponse resp) throws IOException { 
        logger.log(Level.WARNING,"test");
        //do stuff here
    }

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
                   throws IOException, ServletException {        
       logger.log(Level.WARNING,"Channel connected!");
       process(req, resp);
     }
}

web.xml:

 <servlet-mapping>
     <servlet-name>ChannelConnected</servlet-name>
     <url-pattern>/_ah/channel/connected</url-pattern>
 </servlet-mapping> 

 <servlet>
     <servlet-name>ChannelConnected</servlet-name>
     <servlet-class>com.myapp.server.channel.ChannelConnectedServlet</servlet-class>
 </servlet>

The same behavior happens with the disconnect request. HELP!!!

1

1 Answers

1
votes

This entry in web.xml should have included "/" at the end of the url, such as:

<servlet-mapping>
 <servlet-name>ChannelConnected</servlet-name>
 <url-pattern>/_ah/channel/connected/</url-pattern>

Works now.