Announcement Announcement Module
No announcement yet.
HTTP Inbound - Retrieve Request Parameters Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP Inbound - Retrieve Request Parameters

    Apologies if this has been discussed before. I am still a bit new at this Spring Integration stuff.

    I have an HTTP inbound gateway and it will be used for multiple types of incoming messages. We differentiate these messages by various request parameters; typically in the query string passed to the servlet. I say typically because I would like to keep this open and be able to get any request parameter that might come my way regardless of method (i.e. GET or POST).

    I did some digging through the docs, samples, and forums and couldn't really find much regarding the acquisition of request parameters (those found in the HttpServletRequest). I read a bit about the http multipart but I don't believe that it will help. I have very little control over the message sent to me. The only flexibility is in the request parameters.

    So my question is how do I get the request parameters for an HTTP inbound request? Have I overlooked a class I need to implement? Are they already parsed? Thanks for your help. :-)

  • #2
    We have a simple 'http' sample in the repository that was added few weeks ago, so you might want to look at that as well and it might give you some hints. I will also update it with some code that logs request parameters shortly. Will let you know


    • #3
      Thank you Oleg. I look forward to your update. I took a look at the http example and it was only showing an outbound gateway. I guess the update will clarify an inbound example?


      • #4
        i'm trying to do something similar but using webflow so not sure if this would help at all.

        One workaround I use was to write a listener to extract the request attributes and put them into the session, which I have access to throughout the flow.

        I found that the request attributes were present in the listener events but not when execution was passed to the flow propper. Not sure why this is? Perhaps Oleg has the answer?

        i wrote a listener to check what the values are in the request "before" it was processed by webflow:

        <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
        			<webflow:listener ref="myListener" />
        My Listener class looks like this:
        public class MyListener implements FlowExecutionListener {
         public void sessionCreating(RequestContext arg0, FlowDefinition arg1) {
        		HttpServletRequest req = (HttpServletRequest)    arg0.getExternalContext().getNativeRequest();
        		HttpSession ses = req.getSession();
        		String verified = (String) req.getAttribute("MYATTRIBUTE");
        		if (verified!=null && verified !="") {
        			ses.setAttribute("MYATTRIBUTE", "SOME_VALUE");
        Then in your flow.xml
         	<evaluate expression="action.checkAttributes(flowRequestContext)" />
        In my action I can then access the value:
        public void checkAttributes(RequestContext rCtx) {
        		HttpServletRequest req = (HttpServletRequest) rCtx.getExternalContext().getNativeRequest();	
        		String attr = (String) req.getSession().getAttribute("MYATTRIBUTE");
        Not sure if this helps you though!
        Last edited by eoin81; Feb 3rd, 2011, 05:42 AM.