• Post Reply Bookmark Topic Watch Topic
  • New Topic

URLConnection

 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, the following code snippet:
URL url = new URL(http://localhost:8080/SomeContext/servlet/SomeServlet);
URLConnection con = url.openConnection();
con.setUseCaches(false);
con.getInputStream();
Will the above code get connection to localhost:8080/SomeContext/servlet/SomeServlet?
 
Anoop Krishnan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes provided it is a valid URL(!!!ofcourse)
but i do it like this
URL url = new URL http://localhost:8080/SomeContext/servlet/SomeServlet);
URLConnection con = url.openConnection();
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
Object content=con.getContent();

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!