You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2010/11/26 15:59:13 UTC

[jira] Issue Comment Edited: (WICKET-3190) NPE in WicketFilter when a Page is requested via websocket

    [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936019#action_12936019 ] 

Martin Grigorov edited comment on WICKET-3190 at 11/26/10 9:57 AM:
-------------------------------------------------------------------

I can reproduce the NPE either with 'mvn jetty:run' or by using Start.java:


java.lang.NullPointerException
	at org.apache.wicket.protocol.http.WicketFilter.getRelativePath(WicketFilter.java:601)
	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
	at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:139)
	at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:116)
	at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:271)
	at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:135)
	at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:193)
	at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:145)
	at org.atmosphere.container.Jetty8WebSocketSupport.service(Jetty8WebSocketSupport.java:71)
	at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1121)
	at org.atmosphere.cpr.WebSocketProcessor.connect(WebSocketProcessor.java:75)
	at org.atmosphere.cpr.AtmosphereServlet$2.onConnect(AtmosphereServlet.java:1356)
	at org.eclipse.jetty.websocket.WebSocketConnectionD00.handle(WebSocketConnectionD00.java:149)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)


The problem seems to be in Jetty. At line 601 of WicketFilter in 1.4-SNAPSHOT we have:
600: String contextPath = request.getContextPath();
601: path = path.substring(contextPath.length());

By javax.servlet.http.HttpServletRequest.getContextPath() javadoc:
 /**
     *
     * Returns the portion of the request URI that indicates the context
     * of the request.  The context path always comes first in a request
     * URI.  The path starts with a "/" character but does not end with a "/"
     * character.  For servlets in the default (root) context, this method
     * returns "".
     *
     *
     * @return		a <code>String</code> specifying the
     *			portion of the request URI that indicates the context
     *			of the request
     *
     *
     */
I.e. no way 'null' as result.

      was (Author: mgrigorov):
    I can reproduce the NPE either with 'mvn jetty:run' or by using Start.java:


java.lang.NullPointerException
	at org.apache.wicket.protocol.http.WicketFilter.getRelativePath(WicketFilter.java:601)
	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
	at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:139)
	at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:116)
	at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:271)
	at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:135)
	at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:193)
	at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:145)
	at org.atmosphere.container.Jetty8WebSocketSupport.service(Jetty8WebSocketSupport.java:71)
	at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1121)
	at org.atmosphere.cpr.WebSocketProcessor.connect(WebSocketProcessor.java:75)
	at org.atmosphere.cpr.AtmosphereServlet$2.onConnect(AtmosphereServlet.java:1356)
	at org.eclipse.jetty.websocket.WebSocketConnectionD00.handle(WebSocketConnectionD00.java:149)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)


The problem seems to be in Jetty. At like 601 in 1.4-SNAPSHOT we have:
600: String contextPath = request.getContextPath();
601: path = path.substring(contextPath.length());

By javax.servlet.http.HttpServletRequest.getContextPath() javadoc:
 /**
     *
     * Returns the portion of the request URI that indicates the context
     * of the request.  The context path always comes first in a request
     * URI.  The path starts with a "/" character but does not end with a "/"
     * character.  For servlets in the default (root) context, this method
     * returns "".
     *
     *
     * @return		a <code>String</code> specifying the
     *			portion of the request URI that indicates the context
     *			of the request
     *
     *
     */
I.e. no way 'null' as result.
  
> NPE in WicketFilter when a Page is requested via websocket
> ----------------------------------------------------------
>
>                 Key: WICKET-3190
>                 URL: https://issues.apache.org/jira/browse/WICKET-3190
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.13
>         Environment: Win XP 32 bit
>            Reporter: Andrey Belyaev
>            Assignee: Igor Vaynberg
>         Attachments: WebSockets_NPE.zip
>
>
> Trying to add push capability to Wicket using atmosphere framework. Created a Page that generates async responce on request. When the Page is requested using long-polling or streaming technique via HTTP it works OK, but trying to get responce via WebSocket causes NPE in org.apache.protocol.WicketFilter. 
> Project ZIP is attached. 
> Run it with mvn jetty:run and try to connect to "http://localhost:8080/atmosphere-wicket/" using web socket-enabled browser (e.g. the Chrome) and Firefox 3.6 that does not support web sockets. You should see NPE in console in first case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.