Send both parameters and objects to servlet

Discussion in 'Java' started by kikotores@yahoo.com, May 31, 2006.

  1. Guest

    Is it possible to send both parameters ( as if coming from a form) and
    binary objects( such as vector) from an applet to a servlet. I want to
    be able to read properties as regular parameters using getParameter and
    also get objects. Is this possible and if so how do I set up the
    regular parameters ( provided I am writing the binary objects to a
    stream) and how do I then retrieve them.
    , May 31, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Is it possible to send both parameters ( as if coming from a form) and
    > binary objects( such as vector) from an applet to a servlet. I want to
    > be able to read properties as regular parameters using getParameter and
    > also get objects. Is this possible and if so how do I set up the
    > regular parameters ( provided I am writing the binary objects to a
    > stream) and how do I then retrieve them.


    getParameter () returns a String so you have to encode your object as a
    String--essentially making it a parameter. You can do this by serializing to
    byte [] and then encoding with Base64 or serializing to XML (e.g. XStream)
    and encoding with URLEncoder (or it's non-deprecated equivalent). String
    representations of objects (object graphs) can get very big and there may be
    limits on the total sizes of all the parameters in a GET request. You
    should be able to send via POST without problem.

    When you perform getParameter, just decode and deserialize back to get a
    copy of the object.

    Matt Humphrey http://www.iviz.com/
    Matt Humphrey, Jun 1, 2006
    #2
    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,984
    Jack Jia
    Apr 4, 2004
  2. Jonck van der Kogel
    Replies:
    2
    Views:
    967
    Jonck van der Kogel
    May 27, 2004
  3. =?utf-8?B?6L65IOaxnw==?=

    [Servlet] how to send a stream to servlet doPost

    =?utf-8?B?6L65IOaxnw==?=, Sep 14, 2007, in forum: Java
    Replies:
    3
    Views:
    634
    GArlington
    Sep 14, 2007
  4. ABCL
    Replies:
    0
    Views:
    527
  5. Replies:
    0
    Views:
    89
Loading...

Share This Page