This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design 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();
}

 
Have you checked out Aspose?
 
subject: Request web Page on Glassfish server using java code
 
It's not a secret anymore!