[ 
https://issues.apache.org/jira/browse/WW-4199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-4199:
------------------------------

    Description: 
I have some webservices under /services in my webapp, and I have excluded them 
from Struts by using the excludePattern filter:

{code:xml}
<param-name>struts.action.excludePattern</param-name>
<param-value>/services/.*</param-value>
{code}

The problem is that the classes StrutsPrepareAndExecuteFilter and 
StrutsPrepareFilter do some calls before to prepare before checking if the URL 
should be treated. In the case of the webservices it provokes the following 
exception:

{noformat}
####<Sep 13, 2013 6:38:54 PM EDT> <Error> <HTTP> <naboo.mia.usa.sinvest> 
<EcoPrdInt> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default 
(self-tuning)'> <<anonymous>> <> <> <1379111934567> <BEA-101108> 
<[weblogic.servlet.internal.WebAppServletContext@2f97ff - appName: 'test-int', 
name: 'test-int.war', context-path: '/test-int', spec-version: '2.5'] 
Unsupported encoding: "UTF-8; action="urn:publishDocumentForSignature"" 
specified.
java.io.UnsupportedEncodingException: Unsupported Encoding UTF-8; 
action="urn:publishDocumentForSignature"
        at 
weblogic.servlet.internal.ServletRequestImpl.setCharacterEncoding(ServletRequestImpl.java:428)
        at 
weblogic.servlet.internal.ServletRequestImpl.initRequestEncoding(ServletRequestImpl.java:1115)
        at 
weblogic.servlet.internal.ServletRequestImpl.getCharacterEncoding(ServletRequestImpl.java:451)
        at 
org.apache.struts2.dispatcher.Dispatcher.applyEncoding(Dispatcher.java:762)
        at org.apache.struts2.dispatcher.Dispatcher.prepare(Dispatcher.java:748)
        at 
org.apache.struts2.dispatcher.ng.PrepareOperations.setEncodingAndLocale(PrepareOperations.java:121)
        at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:85)
{noformat}

And that's due to the filter calling prepare to set the encoding and locale in 
the following code in StrutsPrepareAndExecuteFilter:

{code:java}
[...]
        try {
            prepare.setEncodingAndLocale(request, response);
            prepare.createActionContext(request, response);
            prepare.assignDispatcherToThread();
            if (excludedPatterns != null && prepare.isUrlExcluded(request, 
excludedPatterns)) {
                chain.doFilter(request, response);
            } else {
[...]
{code}

But if the URL is going to be excluded, why is it doing that call? I think the 
calls to prepare should be done after checking the URL for exclusions. Unless 
I'm missing something, it shouldn't impact anything, right?

Thanks

JL

  was:
I have some webservices under /services in my webapp, and I have excluded them 
from Struts by using the excludePattern filter:

<param-name>struts.action.excludePattern</param-name>
<param-value>/services/.*</param-value>

The problem is that the classes StrutsPrepareAndExecuteFilter and 
StrutsPrepareFilter do some calls before to prepare before checking if the URL 
should be treated. In the case of the webservices it provokes the following 
exception:

####<Sep 13, 2013 6:38:54 PM EDT> <Error> <HTTP> <naboo.mia.usa.sinvest> 
<EcoPrdInt> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default 
(self-tuning)'> <<anonymous>> <> <> <1379111934567> <BEA-101108> 
<[weblogic.servlet.internal.WebAppServletContext@2f97ff - appName: 'test-int', 
name: 'test-int.war', context-path: '/test-int', spec-version: '2.5'] 
Unsupported encoding: "UTF-8; action="urn:publishDocumentForSignature"" 
specified.
java.io.UnsupportedEncodingException: Unsupported Encoding UTF-8; 
action="urn:publishDocumentForSignature"
        at 
weblogic.servlet.internal.ServletRequestImpl.setCharacterEncoding(ServletRequestImpl.java:428)
        at 
weblogic.servlet.internal.ServletRequestImpl.initRequestEncoding(ServletRequestImpl.java:1115)
        at 
weblogic.servlet.internal.ServletRequestImpl.getCharacterEncoding(ServletRequestImpl.java:451)
        at 
org.apache.struts2.dispatcher.Dispatcher.applyEncoding(Dispatcher.java:762)
        at org.apache.struts2.dispatcher.Dispatcher.prepare(Dispatcher.java:748)
        at 
org.apache.struts2.dispatcher.ng.PrepareOperations.setEncodingAndLocale(PrepareOperations.java:121)
        at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:85)

And that's due to the filter calling prepare to set the encoding and locale in 
the following code in StrutsPrepareAndExecuteFilter:

[...]
        try {
            prepare.setEncodingAndLocale(request, response);
            prepare.createActionContext(request, response);
            prepare.assignDispatcherToThread();
            if (excludedPatterns != null && prepare.isUrlExcluded(request, 
excludedPatterns)) {
                chain.doFilter(request, response);
            } else {
[...]

But if the URL is going to be excluded, why is it doing that call? I think the 
calls to prepare should be done after checking the URL for exclusions. Unless 
I'm missing something, it shouldn't impact anything, right?

Thanks

JL

    
> Exclusion of URLs should be done before calling prepare.
> --------------------------------------------------------
>
>                 Key: WW-4199
>                 URL: https://issues.apache.org/jira/browse/WW-4199
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>            Reporter: Jose L Martinez-Avial
>            Priority: Minor
>
> I have some webservices under /services in my webapp, and I have excluded 
> them from Struts by using the excludePattern filter:
> {code:xml}
> <param-name>struts.action.excludePattern</param-name>
> <param-value>/services/.*</param-value>
> {code}
> The problem is that the classes StrutsPrepareAndExecuteFilter and 
> StrutsPrepareFilter do some calls before to prepare before checking if the 
> URL should be treated. In the case of the webservices it provokes the 
> following exception:
> {noformat}
> ####<Sep 13, 2013 6:38:54 PM EDT> <Error> <HTTP> <naboo.mia.usa.sinvest> 
> <EcoPrdInt> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default 
> (self-tuning)'> <<anonymous>> <> <> <1379111934567> <BEA-101108> 
> <[weblogic.servlet.internal.WebAppServletContext@2f97ff - appName: 
> 'test-int', name: 'test-int.war', context-path: '/test-int', spec-version: 
> '2.5'] Unsupported encoding: "UTF-8; 
> action="urn:publishDocumentForSignature"" specified.
> java.io.UnsupportedEncodingException: Unsupported Encoding UTF-8; 
> action="urn:publishDocumentForSignature"
>         at 
> weblogic.servlet.internal.ServletRequestImpl.setCharacterEncoding(ServletRequestImpl.java:428)
>         at 
> weblogic.servlet.internal.ServletRequestImpl.initRequestEncoding(ServletRequestImpl.java:1115)
>         at 
> weblogic.servlet.internal.ServletRequestImpl.getCharacterEncoding(ServletRequestImpl.java:451)
>         at 
> org.apache.struts2.dispatcher.Dispatcher.applyEncoding(Dispatcher.java:762)
>         at 
> org.apache.struts2.dispatcher.Dispatcher.prepare(Dispatcher.java:748)
>         at 
> org.apache.struts2.dispatcher.ng.PrepareOperations.setEncodingAndLocale(PrepareOperations.java:121)
>         at 
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:85)
> {noformat}
> And that's due to the filter calling prepare to set the encoding and locale 
> in the following code in StrutsPrepareAndExecuteFilter:
> {code:java}
> [...]
>         try {
>             prepare.setEncodingAndLocale(request, response);
>             prepare.createActionContext(request, response);
>             prepare.assignDispatcherToThread();
>             if (excludedPatterns != null && prepare.isUrlExcluded(request, 
> excludedPatterns)) {
>                 chain.doFilter(request, response);
>             } else {
> [...]
> {code}
> But if the URL is going to be excluded, why is it doing that call? I think 
> the calls to prepare should be done after checking the URL for exclusions. 
> Unless I'm missing something, it shouldn't impact anything, right?
> Thanks
> JL

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

Reply via email to