Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

URL exception: no protocol

843811Jun 20 2005 — edited Jun 21 2005
I wrote a https-URL-Reader using JSDK 1.5 who includes the latest JSSE. First the https-URL-reader fetches a page from a server who uses url-rewriting for session-tracking. So far the first step is working well, I got the page content. Inside this page are hrefs pointing to follow-up-pages. These hrefs includes a url with a JSESSIONID and params who looks like this:

https://host.server.domain/path;JSESSIONID=id1...!id2..?name1=value&name2=value.

The prog gets a follow-up-href from the content extract the url and tried to fetch the related page. At this point everything went down the street ... with an URL-exception: no protocol! I guess its depending an the semi-colon inside the url!
I wondering getting a url with included JSESSIONID should be a daily task!
When I paste this URL into a browser (IE 6) it works!
So where is the mistake???
Any ideas and help are welcome.

Thanks a lot!

Detlev

Here are the related urls and the important code-parts:

// The following string represents the Start-Page

String requestedURL = "https://direkt.postbank.de/direktportalApp/index.jsp";

/*The requestedURL is proceed with https-URL-Reader and creates a file which has the page
content to the caller. It works fine!*/
// ----------------------------------------------------------------------------//

/* This next string shows the URL extract from a href which is given for
a follow-up-page. This URL contains now the JSESSIONID and some params.*/

String requestedURL = "https://direkt.postbank.de/direktportalApp/application;JSESSIONID_direktportalApp=CzJMF8h3LZzd7MnfsDDpFLKWp5y81s5FcGG9vkVnF6cyTKGnQvfv!824009080?origin=login.jsp&event=bea.portal.framework.internal.portlet.event&pageid=login&portletid=login&wfevent=button.info.weiter";

/*With this requestedURL the https-URL-Reader is called again to fetch the follow-up-page.
Immediately a malformedURLException is thrown and the game is over!*/


Code-Snippet https-URL-Reader (only the important lines):

String requestURL(String requestedURL){
try{ ......
URL search = new URL(requestedURL);
URLConnection httpscon = search.openConnection();
......
File outputFile = new File(dir,file);
FileWriter out = new FileWriter(outputFile);
BufferedReader in = new BufferedReader(new InputStreamReader(httpscon.getInputStream()));

while ((inputLine = in.readLine()) != null){
buffer.append(inputLine+"\n");
out.write(buffer.toString());
out.flush();
buffer.delete(0, buffer.length()-1);
}
in.close();
return (file);
}
catch (Exception e){
System.out.println("Error: "+e); }

}

p.s.
I apologize for my bad english
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2005
Added on Jun 20 2005
1 comment
143 views