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 |
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 |
In reply to this post by Adrian Baker-2
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. -- 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 |
Free forum by Nabble | Edit this page |