servlet request handling - escaped characters in request

Discussion in 'Java' started by Thea, Sep 15, 2006.

  1. Thea

    Thea Guest

    Hello
    I have following problem and I'm not sure where to look for solution,
    or even if this is correct group for it, so please redirect me if you
    know more apropriate group / know good webpage

    I have request coming from outside world. As many requests do, one that
    I'm recieving has parameters coming with it.
    Trouble is that parameters can come in form
    bin.id=45&res.h=150&res.w=150
    or
    bin.id=45&res.h=150&res.w=150
    When parameters are given like in first case everything works fine, but
    when second type of request comes, request.getParameterNames(),
    request.getParameter(...) and all functions that deal with parameters
    simply do not see them.
    I guess that's because of those escaped ampersand signs, but have
    absolutely no idea how to solve this problem... Is there maybe any way
    to get around it?
    I cannot avoid getting requests with escaped ampersands and they must
    be processed properly, I can't simply send error response.

    I really have no idea where to start searching...
    Thanks for help. :)
    ~Thea
    Thea, Sep 15, 2006
    #1
    1. Advertising

  2. Thea

    steepyirl Guest

    Try java.net.URLDecoder.decode(), *before* you append the params to the
    request URI.

    Thea wrote:
    > Hello
    > I have following problem and I'm not sure where to look for solution,
    > or even if this is correct group for it, so please redirect me if you
    > know more apropriate group / know good webpage
    >
    > I have request coming from outside world. As many requests do, one that
    > I'm recieving has parameters coming with it.
    > Trouble is that parameters can come in form
    > bin.id=45&res.h=150&res.w=150
    > or
    > bin.id=45&res.h=150&res.w=150
    > When parameters are given like in first case everything works fine, but
    > when second type of request comes, request.getParameterNames(),
    > request.getParameter(...) and all functions that deal with parameters
    > simply do not see them.
    > I guess that's because of those escaped ampersand signs, but have
    > absolutely no idea how to solve this problem... Is there maybe any way
    > to get around it?
    > I cannot avoid getting requests with escaped ampersands and they must
    > be processed properly, I can't simply send error response.
    >
    > I really have no idea where to start searching...
    > Thanks for help. :)
    > ~Thea
    steepyirl, Sep 15, 2006
    #2
    1. Advertising

  3. Thea

    Thea Guest

    Thanks :)
    Thea, Sep 22, 2006
    #3
    1. Advertising

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. circuit_breaker
    Replies:
    2
    Views:
    1,989
    Jack Jia
    Apr 4, 2004
  2. Replies:
    2
    Views:
    754
  3. Ben Finney
    Replies:
    2
    Views:
    334
    Josiah Carlson
    Apr 3, 2004
  4. Henrik S. Hansen

    Translating escaped characters

    Henrik S. Hansen, Nov 1, 2004, in forum: Python
    Replies:
    2
    Views:
    284
    Henrik S. Hansen
    Nov 2, 2004
  5. Derek Basch
    Replies:
    2
    Views:
    449
    Derek Basch
    Mar 25, 2005
Loading...

Share This Page