This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Where I will use reponse.setHeader and response.setIntHeader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Where I will use reponse.setHeader and response.setIntHeader" Watch "Where I will use reponse.setHeader and response.setIntHeader" New topic
Author

Where I will use reponse.setHeader and response.setIntHeader

Layla Rashid
Ranch Hand

Joined: Dec 25, 2006
Posts: 36
Hi

If I want to set content-lent is 128 then which method I will use.

response.setHeader("Content-length","128") or response.setIntHeader("Content-lenght",128)

Thanks
Layla
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
either of those would work here, since the setIntHeader() method is just a convenience wrapper, internally it would do a String.valueOf(int) to render the int value as a String into the HTTP header.

Though, technically, at the spot where you are setting these content length headers, you could just call


This will set the HTTP header Content-Type for you in the same manner as these setHeader methods.


Error: Keyboard not attached. Press F1 to continue.
Layla Rashid
Ranch Hand

Joined: Dec 25, 2006
Posts: 36
thanks
 
wood burning stoves
 
subject: Where I will use reponse.setHeader and response.setIntHeader
 
Similar Threads
Passed SCEA Part-2 and 3
Refreshing a jsp page
remove cache from java code in jsp
How to avoid the internet files which will be stored in internet temporary folder?
auto servlet refresh