aspose file tools*
The moose likes I/O and Streams and the fly likes URL getInputstream() & Javascript Issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "URL getInputstream() & Javascript Issues" Watch "URL getInputstream() & Javascript Issues" New topic
Author

URL getInputstream() & Javascript Issues

Shawn Franks
Greenhorn

Joined: May 18, 2010
Posts: 23
Hello All,

I have been having a very difficult time reading the input-stream of a form submitted Via Java URL connection, it appears that there is a JavaScript file on the site that looks for some specific object to fill in the results of the form into a div after it is submitted. The form works fine via html and via xmlhttprequest, Also i have tried a ajax engine for java and preformed an xmlhttprequest via java and still have the same issue of that object the javascript is looking preventing the Java input stream to return the desired form results. So basically what I am looking for is, is there a way to access a website via java but prevent javascript from running? Since javascript is client and not server side i would think there would be an option in java to disable javascript.
Gokul Nanthakumar
Ranch Hand

Joined: May 11, 2010
Posts: 56
Java Script is purely a client side language, when you access some website via java URL connection, you should not get any problem because of javascript, please post the error you are getting
Shawn Franks
Greenhorn

Joined: May 18, 2010
Posts: 23
Gokul Nanthakumar wrote:Java Script is purely a client side language, when you access some website via java URL connection, you should not get any problem because of javascript, please post the error you are getting


I cannot post the error because of it being work related but basically here is how this site works.

on the clients web browser you submit the form via xmlhttprequest. The result is returned and parsed via a specialized javascript engine and then inserted into a DIV via innerHTML.

Now when Submitting this form via Java the DIV doesn't exist and the JavaScript engine replaces the source code with the error message stating the DIV cannot be found. I know it is the Javascript causing the issue, because if i submit the form it fake data it knows that there is no div to fill the requested data into and lets the source stay as it should.
Shawn Franks
Greenhorn

Joined: May 18, 2010
Posts: 23
Any Ideas?
Gokul Nanthakumar
Ranch Hand

Joined: May 11, 2010
Posts: 56
Shawn Franks wrote:
on the clients web browser you submit the form via xmlhttprequest. The result is returned and parsed via a specialized javascript engine and then inserted into a DIV via innerHTML.


if you are submitting the form via xmlhttprequest, then thel logic to inserting the result into DIV must be in a javascript function outside the response of the request.

so the response must not contain javascript code to insert into DIV.

anyway with out code and error message, giving solution with 100% assumption will not work.

if you still feel that the response has the javascript code, then remove convert the response to string and remove the <Script>.....</script> portion, it may help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL getInputstream() & Javascript Issues