access HTTP payload in Java

Discussion in 'Java' started by zhengyu, Feb 11, 2004.

  1. zhengyu

    zhengyu Guest

    Hi, I am looking for ways to access HTTP payload, i.e. HTTP message stripped
    of the header.
    I searched thru various classes under Java.net, but could not find anything
    that fits what
    I have mind. I was expecting to be able to retrieve the HTTP body in a
    single byte array, or something
    similar. Is my expectation correct??

    Cheers,
    Jimmy
     
    zhengyu, Feb 11, 2004
    #1
    1. Advertising

  2. zhengyu

    Andy Fish Guest

    if you are on the server and writing a servlet, just use getInputStream

    if you are writing an HTTP client, try using the jakarta commons http client
    package.

    "zhengyu" <> wrote in message
    news:F_jWb.3779$uV3.12595@attbi_s51...
    > Hi, I am looking for ways to access HTTP payload, i.e. HTTP message

    stripped
    > of the header.
    > I searched thru various classes under Java.net, but could not find

    anything
    > that fits what
    > I have mind. I was expecting to be able to retrieve the HTTP body in a
    > single byte array, or something
    > similar. Is my expectation correct??
    >
    > Cheers,
    > Jimmy
    >
    >
     
    Andy Fish, Feb 11, 2004
    #2
    1. Advertising

  3. zhengyu

    Jimmy Zhang Guest

    Is it possible to retrieve the byte from the input stream into a large byte
    array?
    Thanks,
    Jimmy
    "Andy Fish" <> wrote in message
    news:g%lWb.1747$...
    > if you are on the server and writing a servlet, just use getInputStream
    >
    > if you are writing an HTTP client, try using the jakarta commons http

    client
    > package.
    >
    > "zhengyu" <> wrote in message
    > news:F_jWb.3779$uV3.12595@attbi_s51...
    > > Hi, I am looking for ways to access HTTP payload, i.e. HTTP message

    > stripped
    > > of the header.
    > > I searched thru various classes under Java.net, but could not find

    > anything
    > > that fits what
    > > I have mind. I was expecting to be able to retrieve the HTTP body in a
    > > single byte array, or something
    > > similar. Is my expectation correct??
    > >
    > > Cheers,
    > > Jimmy
    > >
    > >

    >
    >
     
    Jimmy Zhang, Feb 11, 2004
    #3
  4. zhengyu

    Jimmy Zhang Guest

    Sorry, my real question is that if there is a way to access the underlying
    buffers of the input stream object instead of
    allocating then copying to another piece of memory.
    Also does the input stream give access to headers or only to the
    payload/body?

    Thanks,
    Jimmy
    Also is there a way to
    "Jimmy Zhang" <> wrote in message
    news:5PwWb.9284$_44.11630@attbi_s52...
    > Is it possible to retrieve the byte from the input stream into a large

    byte
    > array?
    > Thanks,
    > Jimmy
    > "Andy Fish" <> wrote in message
    > news:g%lWb.1747$...
    > > if you are on the server and writing a servlet, just use getInputStream
    > >
    > > if you are writing an HTTP client, try using the jakarta commons http

    > client
    > > package.
    > >
    > > "zhengyu" <> wrote in message
    > > news:F_jWb.3779$uV3.12595@attbi_s51...
    > > > Hi, I am looking for ways to access HTTP payload, i.e. HTTP message

    > > stripped
    > > > of the header.
    > > > I searched thru various classes under Java.net, but could not find

    > > anything
    > > > that fits what
    > > > I have mind. I was expecting to be able to retrieve the HTTP body in a
    > > > single byte array, or something
    > > > similar. Is my expectation correct??
    > > >
    > > > Cheers,
    > > > Jimmy
    > > >
    > > >

    > >
    > >

    >
    >
     
    Jimmy Zhang, Feb 11, 2004
    #4
  5. zhengyu

    Andy Fish Guest

    the inputstream object gives access to the body only. there are other
    methods on the request object to access the header fields

    I don't think you can directly access the buffers of the underlying input
    stream - you would need to read or copy it using the normal java mechanisms
    for processing input streams. apart from a marginal increase in performance
    I don't see why you would want to do this anyway.

    Andy

    "Jimmy Zhang" <> wrote in message
    news:U1xWb.274016$I06.2929562@attbi_s01...
    > Sorry, my real question is that if there is a way to access the underlying
    > buffers of the input stream object instead of
    > allocating then copying to another piece of memory.
    > Also does the input stream give access to headers or only to the
    > payload/body?
    >
    > Thanks,
    > Jimmy
    > Also is there a way to
    > "Jimmy Zhang" <> wrote in message
    > news:5PwWb.9284$_44.11630@attbi_s52...
    > > Is it possible to retrieve the byte from the input stream into a large

    > byte
    > > array?
    > > Thanks,
    > > Jimmy
    > > "Andy Fish" <> wrote in message
    > > news:g%lWb.1747$...
    > > > if you are on the server and writing a servlet, just use

    getInputStream
    > > >
    > > > if you are writing an HTTP client, try using the jakarta commons http

    > > client
    > > > package.
    > > >
    > > > "zhengyu" <> wrote in message
    > > > news:F_jWb.3779$uV3.12595@attbi_s51...
    > > > > Hi, I am looking for ways to access HTTP payload, i.e. HTTP message
    > > > stripped
    > > > > of the header.
    > > > > I searched thru various classes under Java.net, but could not find
    > > > anything
    > > > > that fits what
    > > > > I have mind. I was expecting to be able to retrieve the HTTP body in

    a
    > > > > single byte array, or something
    > > > > similar. Is my expectation correct??
    > > > >
    > > > > Cheers,
    > > > > Jimmy
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Andy Fish, Feb 12, 2004
    #5
    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. junaid

    JMF: encrypting rtp payload

    junaid, Dec 30, 2003, in forum: Java
    Replies:
    0
    Views:
    433
    junaid
    Dec 30, 2003
  2. andrew blah
    Replies:
    6
    Views:
    728
    M.E.Farmer
    Oct 16, 2004
  3. brad

    post xml payload with urllib

    brad, Aug 14, 2007, in forum: Python
    Replies:
    1
    Views:
    634
  4. Jon Sargeant

    Floating-Point Constant with Payload

    Jon Sargeant, Apr 20, 2008, in forum: C Programming
    Replies:
    1
    Views:
    312
    Barry Schwarz
    Apr 20, 2008
  5. Ravi

    XML payload

    Ravi, Jun 4, 2009, in forum: XML
    Replies:
    1
    Views:
    2,331
Loading...

Share This Page