submitting to relative url forwards bad request.getPathInfo() ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

submitting to relative url forwards bad request.getPathInfo() ?

Adrian Baker-2
I'm having an issue submitting to a Struts action using a combination of
a relative path, replace="all", and a wildcard match in my web.xml.

In web.xml there is the following mapping:

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

In the form there is the following submission:

<xforms:submission action="/AddField.do?type=existingField"
method="post" ... replace="all"/>

And in the struts-config.xml:

        <action
            path="/AddField"
           
type="com.orchestral.component.dictionary.web.action.AddFieldAction"
            input="/velocity/add-field-success.vm"
            scope="request"/>

This doesn't work: struts bombs out with the following:
    DEBUG org.apache.struts.action.RequestProcessor  - Processing a
'POST' for path '/AddField.do'
    ...
    ERROR org.apache.struts.action.RequestProcessor  - Invalid path
/AddField.do was requested

Ok, so here struts is receiving an incorrect path: AFAIK it should get
/AddField, not /AddField.do.

Now, if I switch the submission element to an absolute url:
    <xforms:submission
action="http://localhost/dictionary/AddField.do?type=existingField"
method="post" ... replace="all"/>

It works ok, and we see this debug instead:
    DEBUG org.apache.struts.action.RequestProcessor  - Processing a
'POST' for path '/AddField'

Looking through XFormsSubmissionUtils, at I guess I'd say that when
using the relative path (doOptimized), the various request wrapping
logic results in forwarding a request for which request.getPathInfo()
returns an incorrect value, because this is the first thing Struts tries
to use to identify the action. I need to debug through the struts source
to confirm this though.

Adrian






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting to relative url forwards bad request.getPathInfo() ?

Adrian Baker-2
I should mention, disabling the optimised local submissions in
properties.xml works as a workaround for this problem.

Adrian Baker wrote:

> I'm having an issue submitting to a Struts action using a combination
> of a relative path, replace="all", and a wildcard match in my web.xml.
>
> In web.xml there is the following mapping:
>
>    <servlet-mapping>
>        <servlet-name>action</servlet-name>
>        <url-pattern>*.do</url-pattern>
>    </servlet-mapping>
>
> In the form there is the following submission:
>
> <xforms:submission action="/AddField.do?type=existingField"
> method="post" ... replace="all"/>
>
> And in the struts-config.xml:
>
>        <action
>            path="/AddField"
>            
> type="com.orchestral.component.dictionary.web.action.AddFieldAction"
>            input="/velocity/add-field-success.vm"
>            scope="request"/>
>
> This doesn't work: struts bombs out with the following:
>    DEBUG org.apache.struts.action.RequestProcessor  - Processing a
> 'POST' for path '/AddField.do'
>    ...
>    ERROR org.apache.struts.action.RequestProcessor  - Invalid path
> /AddField.do was requested
>
> Ok, so here struts is receiving an incorrect path: AFAIK it should get
> /AddField, not /AddField.do.
>
> Now, if I switch the submission element to an absolute url:
>    <xforms:submission
> action="http://localhost/dictionary/AddField.do?type=existingField"
> method="post" ... replace="all"/>
>
> It works ok, and we see this debug instead:
>    DEBUG org.apache.struts.action.RequestProcessor  - Processing a
> 'POST' for path '/AddField'
>
> Looking through XFormsSubmissionUtils, at I guess I'd say that when
> using the relative path (doOptimized), the various request wrapping
> logic results in forwarding a request for which request.getPathInfo()
> returns an incorrect value, because this is the first thing Struts
> tries to use to identify the action. I need to debug through the
> struts source to confirm this though.
>
> Adrian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting to relative url forwards bad request.getPathInfo() ?

Adrian Baker-2
In reply to this post by Adrian Baker-2
I was able to submit to a struts action by removing the wildcard url and using a direct mapping instead.

However, the struts action forwards to a velocity template (a fairly common scenario - http://jakarta.apache.org/velocity/tools/struts/), and when this happens velocity seems to cough on a similar error (org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '' ).

I expect this is also caused by the same path problem with the request, or a related one - unfortunately I've run out of time to pursue the cause, but in short it appears there are some issues with Struts/Velocity integration.

Adrian

Adrian Baker wrote:
I'm having an issue submitting to a Struts action using a combination of a relative path, replace="all", and a wildcard match in my web.xml.

In web.xml there is the following mapping:

   <servlet-mapping>
       <servlet-name>action</servlet-name>
       <url-pattern>*.do</url-pattern>
   </servlet-mapping>

In the form there is the following submission:

<xforms:submission action="/AddField.do?type=existingField" method="post" ... replace="all"/>

And in the struts-config.xml:

       <action
           path="/AddField"
           type="com.orchestral.component.dictionary.web.action.AddFieldAction"
           input="/velocity/add-field-success.vm"
           scope="request"/>

This doesn't work: struts bombs out with the following:
   DEBUG org.apache.struts.action.RequestProcessor  - Processing a 'POST' for path '/AddField.do'
   ...
   ERROR org.apache.struts.action.RequestProcessor  - Invalid path /AddField.do was requested

Ok, so here struts is receiving an incorrect path: AFAIK it should get /AddField, not /AddField.do.

Now, if I switch the submission element to an absolute url:
   <xforms:submission action="http://localhost/dictionary/AddField.do?type=existingField" method="post" ... replace="all"/>

It works ok, and we see this debug instead:
   DEBUG org.apache.struts.action.RequestProcessor  - Processing a 'POST' for path '/AddField'

Looking through XFormsSubmissionUtils, at I guess I'd say that when using the relative path (doOptimized), the various request wrapping logic results in forwarding a request for which request.getPathInfo() returns an incorrect value, because this is the first thing Struts tries to use to identify the action. I need to debug through the struts source to confirm this though.

Adrian






______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws