This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet working only when connected to VPN

 
Vijayata Bawankar
Greenhorn
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 {
resp.setContentType("application/xml");
String userName = req.getParameter("userName");
String userPassword = req.getParameter("userPassword");
System.out.println("Inside queryOnDemand();");

try
{
URL url = new URL(queryStr);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setRequestMethod("GET");
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
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!");
else
CookieValue = CookieValue.substring(CookieValue.indexOf("JSESSIONID"), CookieValue.indexOf("; path"));

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


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,
Vijayata.
[ August 21, 2008: Message edited by: Vijayata Bawankar ]
 
Ali Khalfan
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?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
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