You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2011/06/20 10:18:08 UTC

Internal error parsing wicket:interface

Hi!

This: http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF

It appears to be a YUI bug. YUILoader probably mistakes bookmarkable
url slashes /login/wicket:interface/... as real paths. For some reason
it tries to fetch resources from same url appending
/login/wicket:interface/resources..... which causes the error
especially after some ajax requests on such a bookmarkable page.


1. Workaround, for example by overriding RequestCycle.onbeginrequest:

      protected void onBeginRequest() {
        {
          final String interfaceParameter =
getRequest().getRequestParameters().getPath();
          if ((!Utils.isEmpty(interfaceParameter)) &&
interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
+ "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
            /*
             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
             */
            getRequest().getRequestParameters().setPath(interfaceParameter.substring(interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)));
          }
        }
...

2. I think this could/should also be fixed/workaroudn in
AbstractRequestTargetUrlCodingStrategy.decodeParameters
out-of-the-box. (1.4.x)

**
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Internal error parsing wicket:interface

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

1. Again: without this row or you get double effect:
((org.mortbay.jetty.Request) ((WebRequest)
getRequest()).getHttpServletRequest()).setServletPath(contextPath);

2011/6/20 Martin Grigorov <mg...@apache.org>:
2.

> I'm not YUI user but I think YUILoader has something like baseUrl, so
> configuring it will prevent errors like this, i.e. it will not confuse
> with indexed params as part of the path.

I tried something like that but it seems to have its own magic to
deduce the url... basePath is set automatically by DatePicker. I tried
setting absolute url there but did not help.

3.

> The code below should probably be in HttpServletRequestWrapper. This
> way it will work in Tomcat too.

Hmm.. you mean javax.servlet.HttpServletRequestWrapper ?

**
Martin

>
> On Mon, Jun 20, 2011 at 12:13 PM, Martin Makundi
> <ma...@koodaripalvelut.com> wrote:
>> Hi!
>>
>> Actually to make it work (indestad of just suppressing the error on
>> serverside) do this:
>>
>>      protected void onBeginRequest() {
>>        {
>>          final String interfaceParameter = getRequest().getPath();
>>          if ((!Utils.isEmpty(interfaceParameter)) &&
>> interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
>> + "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
>>            final int resourcePathIndex =
>> interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX);
>>            /*
>>             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>>             */
>>            final String contextPath = interfaceParameter.substring(0,
>> resourcePathIndex);
>>            ((org.mortbay.jetty.Request) ((WebRequest)
>> getRequest()).getHttpServletRequest()).setContextPath(contextPath);
>>            ((org.mortbay.jetty.Request) ((WebRequest)
>> getRequest()).getHttpServletRequest()).setServletPath(contextPath);
>>          }
>>        }
>> ...
>>
>>
>> I saw similar things done in ServletHandler.. I wonder if I should
>> have that configured on? My web.xml just configures the WicketServlet
>> and nothing more. Is that ok?
>>
>> **
>> Martin
>>
>>
>> 2011/6/20 Martin Makundi <ma...@koodaripalvelut.com>:
>>> Hi!
>>>
>>> This: http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>>>
>>> It appears to be a YUI bug. YUILoader probably mistakes bookmarkable
>>> url slashes /login/wicket:interface/... as real paths. For some reason
>>> it tries to fetch resources from same url appending
>>> /login/wicket:interface/resources..... which causes the error
>>> especially after some ajax requests on such a bookmarkable page.
>>>
>>>
>>> 1. Workaround, for example by overriding RequestCycle.onbeginrequest:
>>>
>>>      protected void onBeginRequest() {
>>>        {
>>>          final String interfaceParameter =
>>> getRequest().getRequestParameters().getPath();
>>>          if ((!Utils.isEmpty(interfaceParameter)) &&
>>> interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
>>> + "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
>>>            /*
>>>             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>>>             */
>>>            getRequest().getRequestParameters().setPath(interfaceParameter.substring(interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)));
>>>          }
>>>        }
>>> ...
>>>
>>> 2. I think this could/should also be fixed/workaroudn in
>>> AbstractRequestTargetUrlCodingStrategy.decodeParameters
>>> out-of-the-box. (1.4.x)
>>>
>>> **
>>> Martin
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Internal error parsing wicket:interface

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I'm not YUI user but I think YUILoader has something like baseUrl, so
configuring it will prevent errors like this, i.e. it will not confuse
with indexed params as part of the path.

The code below should probably be in HttpServletRequestWrapper. This
way it will work in Tomcat too.

On Mon, Jun 20, 2011 at 12:13 PM, Martin Makundi
<ma...@koodaripalvelut.com> wrote:
> Hi!
>
> Actually to make it work (indestad of just suppressing the error on
> serverside) do this:
>
>      protected void onBeginRequest() {
>        {
>          final String interfaceParameter = getRequest().getPath();
>          if ((!Utils.isEmpty(interfaceParameter)) &&
> interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
> + "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
>            final int resourcePathIndex =
> interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX);
>            /*
>             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>             */
>            final String contextPath = interfaceParameter.substring(0,
> resourcePathIndex);
>            ((org.mortbay.jetty.Request) ((WebRequest)
> getRequest()).getHttpServletRequest()).setContextPath(contextPath);
>            ((org.mortbay.jetty.Request) ((WebRequest)
> getRequest()).getHttpServletRequest()).setServletPath(contextPath);
>          }
>        }
> ...
>
>
> I saw similar things done in ServletHandler.. I wonder if I should
> have that configured on? My web.xml just configures the WicketServlet
> and nothing more. Is that ok?
>
> **
> Martin
>
>
> 2011/6/20 Martin Makundi <ma...@koodaripalvelut.com>:
>> Hi!
>>
>> This: http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>>
>> It appears to be a YUI bug. YUILoader probably mistakes bookmarkable
>> url slashes /login/wicket:interface/... as real paths. For some reason
>> it tries to fetch resources from same url appending
>> /login/wicket:interface/resources..... which causes the error
>> especially after some ajax requests on such a bookmarkable page.
>>
>>
>> 1. Workaround, for example by overriding RequestCycle.onbeginrequest:
>>
>>      protected void onBeginRequest() {
>>        {
>>          final String interfaceParameter =
>> getRequest().getRequestParameters().getPath();
>>          if ((!Utils.isEmpty(interfaceParameter)) &&
>> interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
>> + "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
>>            /*
>>             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>>             */
>>            getRequest().getRequestParameters().setPath(interfaceParameter.substring(interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)));
>>          }
>>        }
>> ...
>>
>> 2. I think this could/should also be fixed/workaroudn in
>> AbstractRequestTargetUrlCodingStrategy.decodeParameters
>> out-of-the-box. (1.4.x)
>>
>> **
>> Martin
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Internal error parsing wicket:interface

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

Actually to make it work (indestad of just suppressing the error on
serverside) do this:

      protected void onBeginRequest() {
        {
          final String interfaceParameter = getRequest().getPath();
          if ((!Utils.isEmpty(interfaceParameter)) &&
interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
+ "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
            final int resourcePathIndex =
interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX);
            /*
             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
             */
            final String contextPath = interfaceParameter.substring(0,
resourcePathIndex);
            ((org.mortbay.jetty.Request) ((WebRequest)
getRequest()).getHttpServletRequest()).setContextPath(contextPath);
            ((org.mortbay.jetty.Request) ((WebRequest)
getRequest()).getHttpServletRequest()).setServletPath(contextPath);
          }
        }
...


I saw similar things done in ServletHandler.. I wonder if I should
have that configured on? My web.xml just configures the WicketServlet
and nothing more. Is that ok?

**
Martin


2011/6/20 Martin Makundi <ma...@koodaripalvelut.com>:
> Hi!
>
> This: http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>
> It appears to be a YUI bug. YUILoader probably mistakes bookmarkable
> url slashes /login/wicket:interface/... as real paths. For some reason
> it tries to fetch resources from same url appending
> /login/wicket:interface/resources..... which causes the error
> especially after some ajax requests on such a bookmarkable page.
>
>
> 1. Workaround, for example by overriding RequestCycle.onbeginrequest:
>
>      protected void onBeginRequest() {
>        {
>          final String interfaceParameter =
> getRequest().getRequestParameters().getPath();
>          if ((!Utils.isEmpty(interfaceParameter)) &&
> interfaceParameter.contains(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME
> + "/" + WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)) {
>            /*
>             * http://web.archiveorange.com/archive/v/yH01cximWIUPZlAGlPPF
>             */
>            getRequest().getRequestParameters().setPath(interfaceParameter.substring(interfaceParameter.indexOf(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX)));
>          }
>        }
> ...
>
> 2. I think this could/should also be fixed/workaroudn in
> AbstractRequestTargetUrlCodingStrategy.decodeParameters
> out-of-the-box. (1.4.x)
>
> **
> Martin
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org