This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi, I am calling a servlet residing in a domino server from a java program.I am passing a cookie value but servlet is not getting invoked.I would like to know how i can test whether the connection is active or not(can you suggest any programs that i can use for testing the same) I am providing here few lines of code which i am using to get urlconnection and set cookie. HttpURLConnection urlconnection = null; URL serverURL = new URL("http://192.168.10.55:8001/servlet/testing"); urlconnection= (HttpURLConnection)serverURL.openConnection(); urlconnection.setRequestProperty("cookie",cookie); urlconnection.setRequestMethod("GET"); urlconnection.setFollowRedirects(true); urlconnection.setDoOutput(true); urlconnection.setDoInput(true); Please go through and give suggestion/sample programs Thanks and Regards Subha
Mohamed Yousuff
Ranch Hand
Joined: Jun 23, 2001
Posts: 73
posted
0
Your code is fine to some extent. I dont really understand what you really mean by 'connection is active or not'. If the openConnection method is successfull (without exception), it definitely means that the connection to the server is established. If the servlet does not get invoked, it indicates invalid usage of HTTP Protocol. If you use setdooutput(true) and setdoinput(true), you need to get the outputstream of the httpurlconnection and write whatever you want to write to it. Then u need to get the inputstream. Also when you use setdooutput(true), setrequestmethod("GET") does not make sense because setdooutput(true) implicitly means you want POST method.
Originally posted by subha neithilath: Hi, I am calling a servlet residing in a domino server from a java program.I am passing a cookie value but servlet is not getting invoked.I would like to know how i can test whether the connection is active or not(can you suggest any programs that i can use for testing the same) I am providing here few lines of code which i am using to get urlconnection and set cookie. HttpURLConnection urlconnection = null; URL serverURL = new URL("http://192.168.10.55:8001/servlet/testing"); urlconnection= (HttpURLConnection)serverURL.openConnection(); urlconnection.setRequestProperty("cookie",cookie); urlconnection.setRequestMethod("GET"); urlconnection.setFollowRedirects(true); urlconnection.setDoOutput(true); urlconnection.setDoInput(true); Please go through and give suggestion/sample programs Thanks and Regards Subha
[ November 11, 2002: Message edited by: Mohamed Yousuff ] [ November 11, 2002: Message edited by: Mohamed Yousuff ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to check whether urlconnection is active?