Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > HttpServletResponse

Reply
Thread Tools

HttpServletResponse

 
 
Rasikow Gnaniyar
Guest
Posts: n/a
 
      04-24-2008
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?
 
Reply With Quote
 
 
 
 
Jean-Baptiste Nizet
Guest
Posts: n/a
 
      04-24-2008
On 24 avr, 07:41, Rasikow Gnaniyar <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
christopher@dailycrossword.com
Guest
Posts: n/a
 
      04-24-2008
On Apr 23, 10:41 pm, Rasikow Gnaniyar <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpServletResponse - does sendError terminate request stream? Tim Java 0 10-19-2004 03:57 PM
what is the relation between HTTPServletResponse setContentLength header and keep-alive Naresh Agarwal Java 1 05-29-2004 10:01 AM
Problem closing connection in HTTPServletResponse Naresh Agarwal Java 0 05-28-2004 08:47 AM
javax.servlet.http.HttpServletResponse.sendError() nullyfies any addHeader() Joerg Mueller-Tolk Java 2 12-03-2003 02:03 PM
HttpServletResponse.sendError Mike Landis Java 1 08-09-2003 12:53 AM



Advertisments