This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet working only when connected to VPN  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

First of all sorry for the previous wrong post.

What i mean is,
I have written an servlet, wherein i have made a request to get the data from OnDemand server which is an secured server (https), it works fine if i am connected to VPN (i.e. with proxy) and does not give the repsonse if i am not connected to VPN.

I'm providing you the snippet of the servlet:

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String userName = req.getParameter("userName");
String userPassword = req.getParameter("userPassword");
System.out.println("Inside queryOnDemand();");

URL url = new URL(queryStr);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Content-Type", "application/xml");
urlConnection.setRequestProperty("UserName", userName);
urlConnection.setRequestProperty("Password", userPassword);

CookieValue = urlConnection.getHeaderField ("JSESSIONID").toString();

System.out.println("CookieValue ---> "+CookieValue);

if(CookieValue == "")
System.out.println("Login Failure!");
CookieValue = CookieValue.substring(CookieValue.indexOf("JSESSIONID"), CookieValue.indexOf("; path"));

System.out.println("My Seesion ID = " + CookieValue);
} catch (Exception e) {

So when i run the servlet and when connected to vpn through proxy, it does not give me the session ID.

So does anybody has any solution to it?

Thanks in advance,
[ August 21, 2008: Message edited by: Vijayata Bawankar ]
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your body says the opposite of what you're topic says.

what exactly are you trying to do? when does it work and when does it not? do you have any logs?
author & internet detective
Posts: 37879
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vijayata Bawankar:
doesnt work if i am not.

What does "doesn't work" mean. Please see why you should TellTheDetails.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!