HttpServletResponse

Discussion in 'Java' started by Rasikow Gnaniyar, Apr 24, 2008.

  1. I am doing web analytics program in java. I am able to get content
    length using request object HttpServletRequest ( for. ex.
    hytpReq.getContentLength() )

    But I want to get response page's content length. Is there any object
    response.getContentLength() using HttpServletResponse? or any idea How
    to get Response page's content length?
     
    Rasikow Gnaniyar, Apr 24, 2008
    #1
    1. Advertising

  2. On 24 avr, 07:41, Rasikow Gnaniyar <> wrote:
    > I am doing web analytics program in java. I am able to get content
    > length using request object HttpServletRequest ( for. ex.
    > hytpReq.getContentLength() )
    >
    > But I want to get response page's content length. Is there any object
    > response.getContentLength() using HttpServletResponse? or any idea How
    > to get Response page's content length?


    In a servlet, you're supposed to generate the response to a request.
    Since you generate the response (by writing to the output stream in
    the servlet response), you're supposed to be able to set the content
    length in the response by using the setContentLength method.

    JB.
     
    Jean-Baptiste Nizet, Apr 24, 2008
    #2
    1. Advertising

  3. Rasikow Gnaniyar

    Guest

    On Apr 23, 10:41 pm, Rasikow Gnaniyar <> wrote:
    > I am doing web analytics program in java. I am able to get content
    > length using request object HttpServletRequest ( for. ex.
    > hytpReq.getContentLength() )
    >
    > But I want to get response page's content length. Is there any object
    > response.getContentLength() using HttpServletResponse? or any idea How
    > to get Response page's content length?


    What response? The response you have not created yet? The response
    is your output back to the client, so no there is no way for the
    container to tell you how long your output is. It is useful for single
    objects like images, not so much for pages.

    It sounds to me like you are actually writing a bot to query a page
    and analyzing the page, then sending your response elsewhere. If that
    is the that case you are emulating a client, and you just read the
    page in and count the characters.
     
    , Apr 24, 2008
    #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. Mike Landis

    HttpServletResponse.sendError

    Mike Landis, Aug 8, 2003, in forum: Java
    Replies:
    1
    Views:
    4,373
    Dave Miller
    Aug 9, 2003
  2. Joerg Mueller-Tolk
    Replies:
    2
    Views:
    1,017
    Joerg Mueller-Tolk
    Dec 3, 2003
  3. Naresh Agarwal
    Replies:
    0
    Views:
    425
    Naresh Agarwal
    May 28, 2004
  4. Naresh Agarwal
    Replies:
    1
    Views:
    1,069
    ExGuardianReader
    May 29, 2004
  5. Tim
    Replies:
    0
    Views:
    633
Loading...

Share This Page