You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Frans Stofberg (JIRA)" <ji...@apache.org> on 2011/03/09 13:29:59 UTC

[jira] Created: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

Multiple filter mappings in web.xml cause request.getUrl() to break
-------------------------------------------------------------------

                 Key: WICKET-3518
                 URL: https://issues.apache.org/jira/browse/WICKET-3518
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 1.5-RC2
         Environment: WebSphere 6.1
            Reporter: Frans Stofberg


This issue is derived from WICKET-3497

Here is the problem

If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.

here is an example

2 mappings

/app/*
/longapp/*

when accessing with /app/ request.getUrl() works fine.
when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)

-------ServletWebRequest.getUrl()--------------
...
final int start = request.getContextPath().length() + filterPrefix.length() + 1;
url.append(uri.substring(start));
...
-------------------------------------------------------------
filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)

you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Assigned: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

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

Peter Ertl reassigned WICKET-3518:
----------------------------------

    Assignee: Peter Ertl

> Multiple filter mappings in web.xml cause request.getUrl() to break
> -------------------------------------------------------------------
>
>                 Key: WICKET-3518
>                 URL: https://issues.apache.org/jira/browse/WICKET-3518
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Peter Ertl
>
> This issue is derived from WICKET-3497
> Here is the problem
> If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.
> here is an example
> 2 mappings
> /app/*
> /longapp/*
> when accessing with /app/ request.getUrl() works fine.
> when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)
> -------ServletWebRequest.getUrl()--------------
> ...
> final int start = request.getContextPath().length() + filterPrefix.length() + 1;
> url.append(uri.substring(start));
> ...
> -------------------------------------------------------------
> filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)
> you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

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

Frans Stofberg commented on WICKET-3518:
----------------------------------------

okay,
But one more question.
would It be acceptable to have multiple servlets configured, each with its own mapping?

eg...
servlet-name: servlet.app1
mapping: /app/*

servlet-name: servlet.app2
mapping: /longapp/*

I found that this does work, I just dont know If I may run into issues like this. Do you foresee any?


> Multiple filter mappings in web.xml cause request.getUrl() to break
> -------------------------------------------------------------------
>
>                 Key: WICKET-3518
>                 URL: https://issues.apache.org/jira/browse/WICKET-3518
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Peter Ertl
>             Fix For: 1.5-RC3
>
>
> This issue is derived from WICKET-3497
> Here is the problem
> If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.
> here is an example
> 2 mappings
> /app/*
> /longapp/*
> when accessing with /app/ request.getUrl() works fine.
> when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)
> -------ServletWebRequest.getUrl()--------------
> ...
> final int start = request.getContextPath().length() + filterPrefix.length() + 1;
> url.append(uri.substring(start));
> ...
> -------------------------------------------------------------
> filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)
> you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

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

Peter Ertl commented on WICKET-3518:
------------------------------------

^ This would mean you have multiple instances of wicket application. Should probably work though it's quite quick & dirty...

If you just need some kind of discriminator between different application types you should consider using subhosts in your domain name, e.g.

  app.mydomain.org 

and

  longapp.mydomain.org

These will have different wicket sessions since the session cookie uses the domain name for separation.

You can check the domain name in your app using the current request information.


> Multiple filter mappings in web.xml cause request.getUrl() to break
> -------------------------------------------------------------------
>
>                 Key: WICKET-3518
>                 URL: https://issues.apache.org/jira/browse/WICKET-3518
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Peter Ertl
>             Fix For: 1.5-RC3
>
>
> This issue is derived from WICKET-3497
> Here is the problem
> If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.
> here is an example
> 2 mappings
> /app/*
> /longapp/*
> when accessing with /app/ request.getUrl() works fine.
> when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)
> -------ServletWebRequest.getUrl()--------------
> ...
> final int start = request.getContextPath().length() + filterPrefix.length() + 1;
> url.append(uri.substring(start));
> ...
> -------------------------------------------------------------
> filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)
> you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Resolved: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

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

Peter Ertl resolved WICKET-3518.
--------------------------------

       Resolution: Won't Fix
    Fix Version/s: 1.5-RC3

Wicket currently does not support multiple filter / servlet paths and probably never will. There is not much reason to make things a lot more complicated inside wicket core for a tiny benefit in a very rare use case. If you really need flexible urls you could consider using a front-end proxy like apache or nginx which gives you all the power of rewriting urls, even better than by utilizing web.xml's restricted possibilties.

> Multiple filter mappings in web.xml cause request.getUrl() to break
> -------------------------------------------------------------------
>
>                 Key: WICKET-3518
>                 URL: https://issues.apache.org/jira/browse/WICKET-3518
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Peter Ertl
>             Fix For: 1.5-RC3
>
>
> This issue is derived from WICKET-3497
> Here is the problem
> If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.
> here is an example
> 2 mappings
> /app/*
> /longapp/*
> when accessing with /app/ request.getUrl() works fine.
> when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)
> -------ServletWebRequest.getUrl()--------------
> ...
> final int start = request.getContextPath().length() + filterPrefix.length() + 1;
> url.append(uri.substring(start));
> ...
> -------------------------------------------------------------
> filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)
> you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3518) Multiple filter mappings in web.xml cause request.getUrl() to break

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

Frans Stofberg commented on WICKET-3518:
----------------------------------------

Thank you Peter for the info


> Multiple filter mappings in web.xml cause request.getUrl() to break
> -------------------------------------------------------------------
>
>                 Key: WICKET-3518
>                 URL: https://issues.apache.org/jira/browse/WICKET-3518
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Peter Ertl
>             Fix For: 1.5-RC3
>
>
> This issue is derived from WICKET-3497
> Here is the problem
> If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.
> here is an example
> 2 mappings
> /app/*
> /longapp/*
> when accessing with /app/ request.getUrl() works fine.
> when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)
> -------ServletWebRequest.getUrl()--------------
> ...
> final int start = request.getContextPath().length() + filterPrefix.length() + 1;
> url.append(uri.substring(start));
> ...
> -------------------------------------------------------------
> filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)
> you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira