• Post Reply Bookmark Topic Watch Topic
  • New Topic

Where I will use reponse.setHeader and response.setIntHeader

 
Layla Rashid
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Layla Rashid
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!