This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Request web Page on Glassfish server using java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Request web Page on Glassfish server using java code" Watch "Request web Page on Glassfish server using java code" New topic
Author

Request web Page on Glassfish server using java code

Mohamed Nahas
Greenhorn

Joined: Dec 29, 2011
Posts: 1
Dears,

am trying to read web page from java code and its fine for general web site like google.com but when using the same code to read page on glassfish server at my computer i have this error:-

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.URL.openStream(URL.java:1010)

and this is my code:-

String urlString =
"http://localhost:8080/Mirnint_Library-Mirnint_Message-context-root/Sending.jsp"
try {
URL url;
url = new URL(urlString);
Scanner in = new Scanner(url.openStream());
while (in.hasNext())
System.out.println(in.nextLine());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Request web Page on Glassfish server using java code
 
Similar Threads
Why settimeout is not working?
HttpURLConnection problem
Rampart Axis2 passwordCallback method - Urgent Please
java.net.SocketException (while getting data from an url)