How to fetch the content displayed in JAVA applet? - java

When I hit the following web page, my required document is opened in a JAVA Applet:
http://a836-acris.nyc.gov/DS/DocumentSearch/DocumentImageView?doc_id=2004111600528001
I want to download the document which opens in the applet, the document could be of multiple pages. Is there a way to communicate with applet and fetch its content?

I've found a tool named Fiddler.
"Fiddler is a free web debugging proxy which logs all HTTP(s) traffic between your computer and the Internet. Use it to debug traffic from virtually any application that supports a proxy like IE, Chrome, Safari, Firefox, Opera, and more."
So when I opened the web page and document loaded in applet, Fiddler captured the internal requests made by applet to server which I was unable to see in browser and from there I got the direct URL to that document which I then used to download it :)

Related

Java button to open URL on chrome browser

I'm trying to open a certain URL on Chrome upon button click in Java. But I'm not quite sure how. All the answers I found online is using the PC's default browser (Internet Explorer, most times).
How would it be done if I want the URL to be opened on Google Chrome?
You can use Selenium Web Driver for that. (https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/chrome/ChromeDriver.html). But you shouldn't forget about the case when Chrome isn't installed on clients PC.

How to trace 'There was an internal error and internet explorer unable to print this document' in IE

We are getting 'There was an internal error and internet explorer unable to print this document' in IE at client place for a JSP webpage in our application.
Where to verify any logs related to the above error in IE at client's place.
Does this error can be traced using F12 developer tools or any other options to verify the error log.
We are not getting the error for IE in our environment.
Please help us regarding this.
Thanks in advance
When a page is not displayed as expected client side here is what can be done, from the simpler to more complex:
search the server logs for possible server side errors
try to look at the source code of the page (normally in the contextual menu obtained with a right click). It is what the browser has received and if no javascript was involved what it is trying to display. You can try to see whether it is what you wanted the server to send
try to look at the actual page content with the F12 developper tools. This is the current page after possible Javascript code has altered the original data
use a network analyzer like wireshark. This will show you the exact requests sent by the browser and the exact responses received from server
use the developper tools to trace all actions involved in the page, including the different requests necessary to download the different component of the pages, and all javascript actions.
It may be a rather broad answer but it is the best I can do with the informations given in the question.
And for the it happens on customer machine but not on my dev machine part, I have no more than the usual advices:
try to connect to your server through a raw internet access - for example with a smartphone as router
ask the client for the exact versions of the browser and host OS
ask him for possible plugins in the browser
ask him for possible filtering rules in his proxy - and also control the server proxy rules if any...
ask him for screen images of the error page, and of the source code of the page

Is java Web Start Application using my browser each time I run the application?

I would like to know if when I launch my Java Web Start application, I'm using my browser or the connection is directly from the Java sandbox against the server through Http/Https protocol.
I want ot know, wether once the JAR has been downloaded and stored locally, next time when the applciation is launched, it will use my browser?
No, Java WebStart doesn't use the browser. It uses the JRE to connect to a remote server using HTTP or HTTPS.
The browser is only involved in the download of the .jnlp file. And even here, you could send the JNLP file by e-mail or any other mean. It would work too.

Run java applet directly from JAR itself on HTTP server

I have the following problem.
I have one JAR file, which includes Main.class and Applet.class. In the Main.class I run HTTP server on port 8888, where is set my handler for com.sun.net.httpserver.HttpHandler. I want to do the following: I want to set Headers Content-Type to Java Applet, so don't send some HTML code, but send the Applet.class to run in the browser. It means, if someone will open the IP address with port 8888, it sends him request to run Applet.class, but it won't send him any HTML. Is this somehow possible?
Could this be solved by Java (.jsp) pages?
No. A browser will not run an applet without an HTML page.
You could write a Java client app that downloads and runs your applet without any HTML, or you could use Java Web Start.

Java Networking Client Applet

Sorry if this is a stupid question. I was following the 'Networking Client Applet Example' found at http://docs.oracle.com/javase/tutorial/deployment/applet/clientExample.html. However, I am having trouble figuring out how to implement step 7:
*7. Open the web page containing your applet in a browser by entering the URL of the web page. The host name in the URL should be the same as the name of the host on which the server-side application is running.
For example, if the server-side application is running on a machine named JohnDoeMachine, you should enter a similar URL. The exact port number and path will vary depending on your web server setup.
"http://JohnDoeMachine:8080/quoteApplet/quoteApplet.html"
The QuoteClientApplet will be displayed on the web page.*
We are asked to open the web page containing the applet by entering the URL of the web page. I understand where quoteApplet comes from, but how am I supposed to find out the http address and port number of the web page? It says that the port number and path will vary depending on my web server setup. How do I set it up? Do I have to use a host web server like apache?
Yes, they're asking you put the files on a web server somewhere. If you have a hosting account, you could upload it there. Otherwise, you could install a web server like apache on your own computer(recommended for testing).
Each web server has different install instructions, but generally you install it and have it listen on port 80, which is probably the default config for most web servers. They're example assumed you have the webserver listen on port 8080
If you have the webserver listen on port 80, then url to use in your browser would be something like
http://localhost/quoteApplet/quoteApplet.html
You can omit the port in the url if its port 80. localhost is a special address that always points back to your own computer.
The reason they ask you to install a web server has to do with javas security model - if you use a browser to load the web page from the filesystem instead of from a url, java wont let you open socket connections to other domains unless you edit the java policy file - and this gets more complicated.
It says right on that page:
2 . Include the following HTML code in a web page to deploy QuoteClientApplet.
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes =
{ code:'QuoteClientApplet.class', width:500, height:100} ;
var parameters =
{codebase_lookup:'true'};
deployJava.runApplet(attributes, parameters, '1.6');
</script>
You can host that web page in any webserver you like, this applet will run in the browser, not serverside.

Categories

Resources