Announcement Announcement Module
Collapse
No announcement yet.
start-state POST Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • start-state POST

    My start-state is a class that extends AbstractAction.
    When I send request parameters by get it works well, but when I send request parameters by POST it don't works.

    There is some diference ?

    I have tried to use context.getSourceEvent().getParameter(), context.getSourceEvent().getAttribute(), context.getRequestScope().getAttribute() but I didn't get.

    context = RequestContext

    Thanks in advance

  • #2
    There should be no difference. It's the servlet engine, e.g. Tomcat, that handles the difference and makes all request parameters available using 'request.getParameter("name")'. Inside of SWF, the HTTP servlet request is wrapped inside an Event, so you should be able to get the value of any request paremeter using 'context.getSourceEvent().getParameter("name")', no matter whether it was sent using HTTP GET or POST.

    Do you get the correct value if you do:
    Code:
    HttpServletRequest request = ((ServletEvent)context.getSourceEvent()).getRequest();
    request.getParameter("name");
    //assertEquals(context.getSourceEvent().getParameter("name"), request.getParameter("name"));
    If the last assert fails, please let us know because that might be a bug.

    Erwin

    Comment


    • #3
      Unfortunatelly it doesn't work too.
      When I use GET everything works well, but POST....
      I will try to show you how is my application.

      It is a shopping cart to a e-commerce application.
      I have a form like this:

      <form action="/secure/shoppingcart.do" method="POST">
      <input type="hidden" name="codProd" value="1"/>
      <input type="hidden" name="codItem" value="10"/>
      <input type="hidden" name="amount" value="1"/>

      <input type="hidden" name="codProd" value="2"/>
      <input type="hidden" name="codItem" value="20"/>
      <input type="hidden" name="amount" value="1"/>

      <input type="submit" value="OK"/>
      </form>

      When I click on OK, this URL pass by Acegi Security filters and change to security channel (https)

      for example: the codProd parameter should have been passed like a String[] with 2 elements, but when I used what you suggest it returned null

      I have tried all that options, but It just worked when I have used GET.

      I am using Tomcat-5.5.7, Apache-2.0.52 webflow r3, spring 1.2, JDK-1.5.0_03 SUN.

      If you still have some more questions, feel free to ask

      I apreciatte if you can spend your time with this problem...

      Comment


      • #4
        Could it be the Acegi stuff and the switch to HTTPS that is messing with the request parameters? Have you tried disabling your security, just as a test, and see if that works?

        If that's not it, I have absolutely no idea what could be happening to those request parameters. It's unlikely that it's a problem in SWF though.

        Erwin

        Comment


        • #5
          Everything works without https. It could be a wrong configuration or a bug in Acegi... I will read more about to see if I get the reason...
          Thank you very much by the tip...
          When I have a answer about the problem after my researches I post a reply...

          Comment


          • #6
            Ok... I understood now.
            When I use Acegi, it make a redirect to https using the class RetryWithHttpsEntryPoint
            a piece of javadoc is bellow:

            "public class RetryWithHttpsEntryPoint extends Object implements InitializingBean, ChannelEntryPoint

            Commences a secure channel by retrying the original request using HTTPS.

            This entry point should suffice in most circumstances. However, it is not intended to properly handle HTTP POSTs or other usage where a standard redirect would cause an issue. "

            Thank you

            Comment

            Working...
            X