Distinguishing GET and POST paramaters in jsp

Discussion in 'Java' started by Vic, Jun 24, 2004.

  1. Vic

    Vic Guest

    Hi,

    Is there a better way to determine if a parameter came through
    as a POST parameter rather than a GET one? The only way I can
    see that you can do this is by examining the query string.

    Thanks,

    Vic
     
    Vic, Jun 24, 2004
    #1
    1. Advertisements

  2. On 24 Jun 2004 05:49:10 -0700, Vic <> wrote:

    > Hi,
    >
    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.
    >
    > Thanks,
    >
    > Vic


    From the servlet API, it looks like the HttpServletRequest
    method getRequestURL will do what you want. (I have not
    actually tried this)

    Bill


    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    William Brogden, Jun 24, 2004
    #2
    1. Advertisements

  3. Vic

    Sudsy Guest

    William Brogden wrote:
    > On 24 Jun 2004 05:49:10 -0700, Vic <> wrote:
    >>
    >> Is there a better way to determine if a parameter came through
    >> as a POST parameter rather than a GET one? The only way I can
    >> see that you can do this is by examining the query string.

    >
    > From the servlet API, it looks like the HttpServletRequest
    > method getRequestURL will do what you want. (I have not
    > actually tried this)


    Even easier: HttpServletRequest#getMethod()
    Should return "GET", "POST" or "PUT".
     
    Sudsy, Jun 24, 2004
    #3
  4. Vic wrote:

    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.


    If you're worried about POST requests containing parameters in both the
    query string and the request body then you must indeed examine the query
    string to sort it out. Otherwise, though, take Sudsy's advice and just
    check the request method.


    John Bollinger
     
    John C. Bollinger, Jun 24, 2004
    #4
  5. Vic

    Ben_ Guest

    What's the point ???

    "Vic" <> wrote in message
    news:...
    > Hi,
    >
    > Is there a better way to determine if a parameter came through
    > as a POST parameter rather than a GET one? The only way I can
    > see that you can do this is by examining the query string.
    >
    > Thanks,
    >
    > Vic
     
    Ben_, Jun 24, 2004
    #5
  6. Vic

    Luke Tulkas Guest

    "Ben_" <> wrote in message
    news:40db4a19$0$8992$...
    > What's the point ???


    The point is that http parameters can be transfered by more than one method:
    GET, POST, PUT. Sometimes it would be nice if server side knew how they were
    sent. Generaly the .getMethod() takes care of that. But... you can have
    method set to GET and send some parameters as the method suggests (as in
    after "?" part of an URI) and some as POST (written directly onto output
    stream of an http connection).

    > "Vic" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > Is there a better way to determine if a parameter came through
    > > as a POST parameter rather than a GET one? The only way I can
    > > see that you can do this is by examining the query string.
    > >
    > > Thanks,
    > >
    > > Vic

    >
    >
     
    Luke Tulkas, Jun 28, 2004
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M?rcia Elias
    Replies:
    4
    Views:
    568
    M?rcia Elias
    Jan 27, 2004
  2. Guilherme Pinto
    Replies:
    1
    Views:
    450
    Victor Bazarov
    Oct 10, 2003
  3. Replies:
    0
    Views:
    4,973
  4. David Eppstein

    Distinguishing cp850 and cp1252?

    David Eppstein, Nov 3, 2003, in forum: Python
    Replies:
    3
    Views:
    1,161
    David Eppstein
    Nov 3, 2003
  5. Replies:
    28
    Views:
    700
    Boris Borcic
    Dec 19, 2007
  6. Berteun Damman
    Replies:
    4
    Views:
    426
    Berteun Damman
    Feb 8, 2008
  7. laredotornado
    Replies:
    2
    Views:
    1,015
    laredotornado
    Dec 4, 2009
  8. mbowles
    Replies:
    0
    Views:
    606
    mbowles
    Jun 17, 2010
Loading...