You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Parson (JIRA)" <ji...@apache.org> on 2012/10/25 18:11:13 UTC

[jira] [Created] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

Peter Parson created WICKET-4840:
------------------------------------

             Summary: ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
                 Key: WICKET-4840
                 URL: https://issues.apache.org/jira/browse/WICKET-4840
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.2.0
            Reporter: Peter Parson
            Priority: Minor


My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.

@Override
    protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
        return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {

            @Override
            public String encodeURL(CharSequence url) {
                final String agent = webRequest.getHeader("User-Agent");
                return isAgent(agent) ? url.toString() : super.encodeURL(url);
            }

            @Override
            public String encodeRedirectURL(CharSequence url) {
                return encodeURL(url);
            }
        };
    }

It is exactly the same issue as discussed here (about version 6.1.1):
http://comments.gmane.org/gmane.comp.java.wicket.user/106013

ServletWebResponse:181 - RequestCycle.get() returns null.

Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

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

Martin Grigorov resolved WICKET-4840.
-------------------------------------

    Resolution: Won't Fix

I see what is the issue and soon there will be an improvement in ServletWebResponse#encodeRedirectUrl() but your code is wrong according Servlet specification. There is a reason why there are two different methods in the Servlet API and you should respect it.
Fix your code and don't call encodeURL() from encodeRedirectURL(). 
                
> ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
> ------------------------------------------------------------------------
>
>                 Key: WICKET-4840
>                 URL: https://issues.apache.org/jira/browse/WICKET-4840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Peter Parson
>            Priority: Minor
>              Labels: nullpointerexception, requestcylce
>
> My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.
> @Override
>     protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
>         return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {
>             @Override
>             public String encodeURL(CharSequence url) {
>                 final String agent = webRequest.getHeader("User-Agent");
>                 return isAgent(agent) ? url.toString() : super.encodeURL(url);
>             }
>             @Override
>             public String encodeRedirectURL(CharSequence url) {
>                 return encodeURL(url);
>             }
>         };
>     }
> It is exactly the same issue as discussed here (about version 6.1.1):
> http://comments.gmane.org/gmane.comp.java.wicket.user/106013
> ServletWebResponse:181 - RequestCycle.get() returns null.
> Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

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

Peter Parson commented on WICKET-4840:
--------------------------------------

Thanks for your reply - actually, I copied this implementation from the Wicket Wiki:
https://cwiki.apache.org/WICKET/seo-search-engine-optimization.html#SEO-SearchEngineOptimization-Wicket1.5

Can you tell me what the overriding implementation of encodeRedirectURL should look like instead?

                
> ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
> ------------------------------------------------------------------------
>
>                 Key: WICKET-4840
>                 URL: https://issues.apache.org/jira/browse/WICKET-4840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Peter Parson
>            Priority: Minor
>              Labels: nullpointerexception, requestcylce
>
> My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.
> @Override
>     protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
>         return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {
>             @Override
>             public String encodeURL(CharSequence url) {
>                 final String agent = webRequest.getHeader("User-Agent");
>                 return isAgent(agent) ? url.toString() : super.encodeURL(url);
>             }
>             @Override
>             public String encodeRedirectURL(CharSequence url) {
>                 return encodeURL(url);
>             }
>         };
>     }
> It is exactly the same issue as discussed here (about version 6.1.1):
> http://comments.gmane.org/gmane.comp.java.wicket.user/106013
> ServletWebResponse:181 - RequestCycle.get() returns null.
> Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

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

Peter Parson commented on WICKET-4840:
--------------------------------------

Thanks for the quick reaction :)

Works like charm!
                
> ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
> ------------------------------------------------------------------------
>
>                 Key: WICKET-4840
>                 URL: https://issues.apache.org/jira/browse/WICKET-4840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Peter Parson
>            Priority: Minor
>              Labels: nullpointerexception, requestcylce
>
> My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.
> @Override
>     protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
>         return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {
>             @Override
>             public String encodeURL(CharSequence url) {
>                 final String agent = webRequest.getHeader("User-Agent");
>                 return isAgent(agent) ? url.toString() : super.encodeURL(url);
>             }
>             @Override
>             public String encodeRedirectURL(CharSequence url) {
>                 return encodeURL(url);
>             }
>         };
>     }
> It is exactly the same issue as discussed here (about version 6.1.1):
> http://comments.gmane.org/gmane.comp.java.wicket.user/106013
> ServletWebResponse:181 - RequestCycle.get() returns null.
> Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

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

Peter Parson closed WICKET-4840.
--------------------------------

    
> ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
> ------------------------------------------------------------------------
>
>                 Key: WICKET-4840
>                 URL: https://issues.apache.org/jira/browse/WICKET-4840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Peter Parson
>            Priority: Minor
>              Labels: nullpointerexception, requestcylce
>
> My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.
> @Override
>     protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
>         return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {
>             @Override
>             public String encodeURL(CharSequence url) {
>                 final String agent = webRequest.getHeader("User-Agent");
>                 return isAgent(agent) ? url.toString() : super.encodeURL(url);
>             }
>             @Override
>             public String encodeRedirectURL(CharSequence url) {
>                 return encodeURL(url);
>             }
>         };
>     }
> It is exactly the same issue as discussed here (about version 6.1.1):
> http://comments.gmane.org/gmane.comp.java.wicket.user/106013
> ServletWebResponse:181 - RequestCycle.get() returns null.
> Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-4840) ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0

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

Martin Grigorov commented on WICKET-4840:
-----------------------------------------

I've updated the Wiki. Check it again.
                
> ServletWebResponse/RequestCycle: NPE after upgrading from 6.0.0 to 6.2.0
> ------------------------------------------------------------------------
>
>                 Key: WICKET-4840
>                 URL: https://issues.apache.org/jira/browse/WICKET-4840
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Peter Parson
>            Priority: Minor
>              Labels: nullpointerexception, requestcylce
>
> My WebAplication uses the following code to get rid of the jsessionid parameter for certain user agents, which worked fine with Wicket 6.0.0 but results in a NullPointerException now.
> @Override
>     protected WebResponse newWebResponse(final WebRequest webRequest, final HttpServletResponse httpServletResponse){
>         return new ServletWebResponse((ServletWebRequest)webRequest, httpServletResponse) {
>             @Override
>             public String encodeURL(CharSequence url) {
>                 final String agent = webRequest.getHeader("User-Agent");
>                 return isAgent(agent) ? url.toString() : super.encodeURL(url);
>             }
>             @Override
>             public String encodeRedirectURL(CharSequence url) {
>                 return encodeURL(url);
>             }
>         };
>     }
> It is exactly the same issue as discussed here (about version 6.1.1):
> http://comments.gmane.org/gmane.comp.java.wicket.user/106013
> ServletWebResponse:181 - RequestCycle.get() returns null.
> Workaround is to check for null before calling super.encodeURL(url), but I assume this is a bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira