Hi there,
I'm trying to test a scenario where I have a servlet that does a post to my form that is in resources/forms/App/Form/form. This is the code to send via forwarding and POST that is on Servlet String encoded = new String(Base64.encode(dataToSent .getBytes())); requestWrapper.setParameter("fr-form-data", encoded); ServletContext cntx = getServletContext(); RequestDispatcher dispatcher = cntx.getRequestDispatcher("fr/App/Form/new"); dispatcher.forward(requestWrapper, response); The data comes well. The form is showed with my data overrided but when I click send button the getPost(...) of the same servlet is called and the contentType is "application/x-www-form-urlencoded" . My goal is that the orbeon form when I click Send it goes to another servlet and does: request.getInputStream() and show the data. I have this properties configured in properties-local.xml: <properties xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oxf="http://www.orbeon.com/oxf/processors"> <property as="xs:string" name="oxf.fr.persistence.provider.*.*.form" value="resource" /> <property as="xs:boolean" name="oxf.fr.version.*.*" value="true" /> <property as="xs:boolean" name="oxf.fr.detail.send.pdf.*.*" value="false" /> <property as="xs:boolean" name="oxf.fr.email.attach-pdf.*.*" value="false" /> <property as="xs:boolean" name="oxf.fr.alfresco.send-pdf.*.*" value="false" /> <property as="xs:boolean" name="oxf.fr.detail.send.alfresco.*.*" value="false" /> <property as="xs:boolean" name="oxf.fr.detail.send.email.*.*" value="false" /> <property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="close clear workflow-send" /> <property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" value="true" /> <property as="xs:anyURI" name="oxf.fr.detail.send.success.uri.*.*" value="http://localhost:9086/wI2SXfrmR2/ServetReceiveDemo" /> <property as="xs:string" name="oxf.fr.detail.send.success.method.*.*" value="post" /> <property as="xs:string" name="oxf.fr.detail.send.error.method.*.*" value="get" /> <property as="xs:anyURI" name="oxf.fr.detail.send.error.uri.*.*" value="http://www.google.pt" /> </properties> The data is only sent to ServetReceiveDemo when instead of send the xml form via forwarding just do: response.sendRedirect("http://localhost:9086/wI2SXfrmR2/fr/App/Form/new"); doing ,then filling the form and then submiting it goes right to ServetReceiveDemo and then the inputStream show me the xml string without any decoding. But that way I cant do the inicial post of the data.~ So: How can I do Post of inicial data with forwarding and then receive the filled form in another servlet? I aprecciate your help, Many Thanks :) |
Administrator
|
I am a little bit confused as to the whole story:
- You are saying that you can send data to the new page without problem, right? - However somehow Form Runner cannot send back data to the other servlet? - I don't understand what the redirect is doing in this scenario! The configuration properties look fine to me. -Erik On Tue, Oct 9, 2012 at 10:39 AM, Henrique Barros <[hidden email]> wrote: > Hi there, > > I'm trying to test a scenario where I have a servlet that does a post to my > form that is in resources/forms/App/Form/form. > > This is the code to send via forwarding and POST that is on Servlet > > String encoded = new String(Base64.encode(dataToSent > .getBytes())); > requestWrapper.setParameter("fr-form-data", encoded); > > ServletContext cntx = getServletContext(); > RequestDispatcher dispatcher = cntx.getRequestDispatcher("fr/App/Form/new"); > dispatcher.forward(requestWrapper, response); > > The data comes well. The form is showed with my data overrided but when I > click send button the getPost(...) of the same servlet is called and the > contentType is "application/x-www-form-urlencoded" . > > *My goal is that the orbeon form when I click Send it goes to another > servlet and does: request.getInputStream() and show the data.* > > I have this properties configured in properties-local.xml: > > <properties xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > > > <property as="xs:string" name="oxf.fr.persistence.provider.*.*.form" > value="resource" /> > > > <property as="xs:boolean" name="oxf.fr.version.*.*" value="true" /> > > > <property as="xs:boolean" name="oxf.fr.detail.send.pdf.*.*" > value="false" /> > <property as="xs:boolean" name="oxf.fr.email.attach-pdf.*.*" > value="false" /> > <property as="xs:boolean" name="oxf.fr.alfresco.send-pdf.*.*" > value="false" /> > <property as="xs:boolean" name="oxf.fr.detail.send.alfresco.*.*" > value="false" /> > <property as="xs:boolean" name="oxf.fr.detail.send.email.*.*" > value="false" /> > > > <property as="xs:string" name="oxf.fr.detail.buttons.*.*" > value="close clear workflow-send" /> > > > > <property as="xs:boolean" name="oxf.fr.detail.new.accept-post.*.*" > value="true" /> > > <property as="xs:anyURI" name="oxf.fr.detail.send.success.uri.*.*" > value="http://localhost:9086/wI2SXfrmR2/ServetReceiveDemo" /> > <property as="xs:string" name="oxf.fr.detail.send.success.method.*.*" > value="post" /> > > > <property as="xs:string" name="oxf.fr.detail.send.error.method.*.*" > value="get" /> > <property as="xs:anyURI" name="oxf.fr.detail.send.error.uri.*.*" > value="http://www.google.pt" /> > > </properties> > > The data is only sent to ServetReceiveDemo when instead of send the xml form > via forwarding just do: > > response.sendRedirect("http://localhost:9086/wI2SXfrmR2/fr/App/Form/new"); > > doing ,then filling the form and then submiting it goes right to > ServetReceiveDemo and then the inputStream show me the xml string without > any decoding. But that way I cant do the inicial post of the data.~ > > So: > > How can I do Post of inicial data with forwarding and then receive the > filled form in another servlet? > > I aprecciate your help, > Many Thanks :) > > > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Forwarding-from-a-servlet-to-orbeon-and-then-back-to-another-servlet-tp4655810.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.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 OW2 mailing lists service home page: http://www.ow2.org/wws |
This post was updated on .
Good morning,
Thanks for your response! I'll explain better.
I can send the data of the form from the servlet to the formRunner via post by doing a forward from the servlet to the FormRunner. And I can receive in the servlet the form sent by formRunner via the servletSend.
The ideal scenario is this:
But I can't acomplish that scenario because the response from the formRunner when I click the send button don't go to the servlet defined in the properties, it goes back to the same servlet that made the forward inicially (the servletSend) and it does't return a xml with the form, it returns an outputStream in the body via post with this contentType: "application/x-www-form-urlencoded" and the string in that outputStream is like:
$uuid=f7e750cb94b2f72c244ebf650e08cda9cf7548cc&$static-state=&$dynamic-state=&$server-events=X2d0e/7lVgsbFambNQLaDpkX5CoGtypqbXA3/cIe7cI0tjQuQLoNrrYLAuTvq/Z27jFl4DWrjEjNcNSP0B4bV2YFlcFNsRoaZV7zQenrTQoKaFtYaF6bbDiWk+m11zEef89U5Tos9EN3DSbsMKxkpOx8F9c3iuu0bpt8Xe5IlFrNBML6XZu9kD7kiYd5D8OCoLtr7IIC7JMpK66gwyFg06UJaptlwJ/FASLaBldNR5kQahjh/LFz2KMEmNw7EI3O1zbHNF0VrSDmyaxQlJN4WRtUVJqvb47FPDbmNhD9J82G3UfoM8+5swATT206Kq9SdH8FC9XHVdN3nsr8ELs6vkew==&$client-state=initial-dynamic-state&&uuid&f7e750cb94b2f72c244ebf650e08cda9cf7548cc&load-did-run&true&sequence&5&$repeat-tree=xf-298$xf-385,dadosgerais-section-control$coberturas-section-section$coberturas-grid-control$coberturas-grid-control-repeat,error-summary-control-bottom$er,xf-349&$repeat-indexes=xf-298$xf-385 0,dadosgerais-section-control$coberturas-section-section$coberturas-grid-control$coberturas-grid-control-repeat 1,error-summary-control-bottom$er 0,xf-349 1&dadosgerais-section-control$xf-417$datafim-control-control$xf-456=&dadosgerais-section-control$xf-417$datafim-control-control$xf-463=&dadosgerais-section-control$xf-417$datafim-control-control$xf-470=&dadosgerais-section-control$xf-417$capitalseguro-control-control$xf-526$xforms-input-1=&dadosgerais-section-control$
I know that it contains part of the form, but the problem is: Why is't the response in XML and why is the form not sending the post to the servlet I indicated in the properties File.
|
This post was updated on .
I must add that I should receive the ContentType "application/xml" in the request body but I'm receiving "application/x-www-form-urlencoded" instead. But if I call http://localhost:9086/myWar/fr/App/Form/new directly in the browser (instead of it being called by the servlet with forward) and then fill the form and click on send button, the form goes straight to the servlet defined in the properties and the contentType of the body is "application/xml" -> that's what we want.
I think that the send button is making form runner send the data directly to the same servlet from where it came because of the forward -> (the url never changes). And because of that I think that after click on send-workflow button the data should pass through orbeon first so that the XML could be generated and sent to the servlet in the end. Am I correct? If it's like that so FormRunner should read the property "oxf.fr.detail.send.success.uri.*.*" and it's not reading it when I use forward data to it. |
Free forum by Nabble | Edit this page |