This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hello all im using tomcat as servlet container and http listener , i have client application that notify with http post requests to the server (tomcat ) when i capture the request im trying to return the client response but all i success to return is the PrintWriter out = response.getWriter(); out.println(" ").....and got print the content of the response to the html my question is how can i response directly to the client ?
If you initiate the request with a browser, the response will be returned to the browser. If you want something else you're going to have to give a lot more information than you have on what you are actually trying to do.
What prevents you from returning a 0-size response? HTTP is a request/response protocol; you can't have one without the other, or you'll confuse the client and/or the server.
Joined: Apr 27, 2006
here is the info my client is c client that construct the http request and send it via winsock send to the ip ort ( that is the tomcat listener ) im not using the browser to send the request . in the server i have simple servlet ( mybe this is my problem ...) that capture the http request via doPost and return me response. thats all .
Joined: Mar 22, 2005
I'll ask again: What prevents you from returning a 0-size response and ignoring it in the client? If for some reason you absolutely, positively can't have a response, then HTTP is not the right communication channel.
Joined: Apr 27, 2006
what do you mean by 0-size response ? i do need to build response string. i can ignore if i have no way other then that .
but an alternative to PrintWriter out = response.getWriter(); out.println(" ").. for text/html
ServletOutputStream out = response.getOutputStream(); out.write(Byte); for other mime types. You need to set the response.setContentType ("") though, and your c client needs to be able to handle the content type that is set.
when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.