Please Help: Getting a Socket from a servlet, or writing the entire HTTP header
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Greg_Schmelter
Posted On:   Thursday, July 1, 2004 01:38 PM

How can I get the socket the browser is using to connect to a servlet? I want to be able to write a custom response, by writing the entire header by hand.

Is this even possible?


Also, is there anyway for my servlet to write the ENTIRE header itself, including the "POST / HTTP/1.1" portion? Perhaps a raw outputstream for the header, like what I have for the body.

Re: Please Help: Getting a Socket from a servlet, or writing the entire HTTP header

Posted By:   Sean_Owen  
Posted On:   Friday, July 2, 2004 05:45 AM

No, I don't believe there is any way to do this. You could write your own non-servlet class that listens on a socket and does whatever you want. You would not benefit from the container's resource management capabilities though.



Are you sure you need to do this? For example, you would never write "POST / HTTP/1.1" in the response; that appears in the request. What can't you do with the J2EE header API, from HttpServletResponse?

About | Sitemap | Contact