Check String from request parameters befor initialize it

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

Check String from request parameters befor initialize it

hahalim
This post was updated on .
Hi All,

Please check below URL with request parameter.

http://XXXX-YYYY:9081/FormsServer/xforms/hab.jsp?nonce=ae665ee1-ec84-4ab0-8938-cc70e5c7aafd&data=374415d1-b20e-41a5-aec2-846c8b&msgs=10b3c6e4-7e77-4313-aa10-ec09e511e1d5&success=b3e12-1d00-447e-85a4-2e76032b&corr=f0c6a2b3-8281-4762-83a2-b8f93fgje3b5&provCode=ON&host=http%3A%2F%2FXXXX-YYYY%3A9081%2FUploadWeb%2FCSIOServlet


We are using below code snippet in above hab.jsp page to initialize the host name from request parameters. The code is working fine.

<xforms:setvalue ref="instance('nonce-data-inst')/host" value="concat(xxforms:get-request-parameter('host'),'')" />


Now, we want to check the host name before initialize it.
For example, want to check host name with provided string value(like "http%3A%2F%2FXXXX-YYYY%3A9081%2FUploadWeb%2FCSIOServlet"). If it match then initialize host name with proper value otherwise initialize host name with blank.

I have used below code which is not working.

<xforms:setvalue ref="instance('nonce-data-inst')/host" value="if (normalize-space(xxforms:get-request-parameter('host')) != 'http%3A%2F%2FXXXX-YYYY%3A9081%2FUploadWeb%2FCSIOServlet') then '' else concat(xxforms:get-request-parameter('host'),'')" />

Can anyone suggest me with proper code?

One more query - Is there any way to debug the hab.jsp page which is written in orbeon?

Thanks,

Hasim

Reply | Threaded
Open this post in threaded view
|

Re: Check String from request parameters befor initialize it

Alessandro  Vernet
Administrator
Hi Hasim,

Since you're asking, I imagine that your comparison between `xxforms:get-request-parameter('host')` and the string you have there doesn't match when you would like it to. I'd suggest you try to output what is returned by `xxforms:get-request-parameter('host')`, says with a `<xf:message value="…"/>`.  I think you'll find the string isn't URL-encoded anymore, and this to be at least one reason why your comparison fails.

And what do you mean by "debug the hab.jsp page"? You want to use a Java debugger? You would just use the same technique to debug it that you would use if it were included in your own app.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Check String from request parameters befor initialize it

hahalim
Thank you Alex,

The issue has been resolve.

Regards,
Hasim
Reply | Threaded
Open this post in threaded view
|

Re: Check String from request parameters befor initialize it

Alessandro  Vernet
Administrator
OK, excellent Hasim, and thank you for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet