You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrey Belyaev (JIRA)" <ji...@apache.org> on 2010/11/24 09:11:14 UTC

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

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
         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.


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

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936020#action_12936020 ] 

Martin Grigorov commented on WICKET-3190:
-----------------------------------------

HttpServletRequest.toString() returns: 
[GET /atmosphere-wicket/?wicket:bookmarkablePage=:edu.wicket.PushPage]@21046486 org.eclipse.jetty.server.Request@14124d6
I.e. it is pure Jetty request, not wrapper from Atmosphere.

> 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.


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

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936019#action_12936019 ] 

Martin Grigorov commented on WICKET-3190:
-----------------------------------------

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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3190.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

the app works fine when started with the Start class in the supplied quickstart. its probably crashing because of some maven run plugin weirdness. please package as a war and deploy to confirm.

> 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.


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

Posted by "Andrey Belyaev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Belyaev updated WICKET-3190:
-----------------------------------

    Attachment: WebSockets_NPE.zip

Sample Push project

> 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
>         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.


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

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Jean-Francois Arcand (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936050#action_12936050 ] 

Jean-Francois Arcand commented on WICKET-3190:
----------------------------------------------

FYI, I've added a fix in Atmosphere to prevent that Jetty bug. Will be in Atmosphere 0.7 GA which is targetted to be released next week.

> 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.


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

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12936024#action_12936024 ] 

Martin Grigorov commented on WICKET-3190:
-----------------------------------------

Asked in Atmosphere users mailing list for similar experience with other integrations:
http://atmosphere-users-mailling-list.2493822.n2.nabble.com/Jetty-WebSocket-request-has-no-contextPath-td5777583.html

> 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.