Avatar of duncanb7
duncanb7

asked on 

Java application through proxy Charles

Dear Experts,


I get one applet java application  and I am using it in IE every day.
Now I would like to save the data I want from the application through
the proxy , now I am using Charles debugger proxy.
From the Sun document,http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html, it mention set the java for proxy  at command line.
I tried it at my PC at C:/program files/java/jre7/bin/java -D http.proxyHost=127.0.0.1 -D
http.proxyPort=8888, but it doesn't work, just error Can't find the variable

And I try to use javascript,
<html>
<head>
</head>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
java.lang.System.getProperties().put("http.proxyHost", "127.0.0.1");
java.lang.System.getProperties().put("http.proxyPort", "8888");
 
   var javaVersion = java.lang.System.getProperty("java.version");  
   alert(javaVersion);
//--></SCRIPT></COMMENT>
<body>
</body>
</html>

Firefox reports,
Error: uncaught exception: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "*" "read,write")
and only alert(javaVersion) is working.

I already open or run Charles proxy software and its client adress is set 127.0.0.1:8888
before I do the previous action and  Charles running is fine from IE and Firefox.
But it doesn't show any information data  I want  from my applet application that is
probably related to those proxy setting for Java proxy is not correct.
And my PC I login in as  adminstrative manager mode  already
Any advise to solve the issue, I am not familar with java code  and if provide
the simple code for setting system proxy property for Java that is
strongly welcome.

Please advise
Duncan
JavaJavaScriptPHP

Avatar of undefined
Last Comment
duncanb7
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

This is confusing. Forget the proxy issue at the moment

You have an applet - are you showing it in a browser?
Avatar of duncanb7
duncanb7

ASKER

Yes.  the application is running in IE browser. Charles can trace the address
only for http/https from browser. If the data is streaming data into applet java application in IE, Charles is not able to grab the streaming data. That is why I want to
set the applet java 's proxy to let all data going into Charles first before going to
the applet application.

SO I want  as follows to do so,
C:/program files/java/jre7/bin/java -D http.proxyHost=127.0.0.1 -D
http.proxyPort=8888 but it is not working.
Now I am try to re-write the java.policy file to grant all file access right to the users
such as system property like http.proxyHOST, but access file right on window is
getting issue. May be I need to re-install all java in my directory instead of
"program files" on window


Please advise
Duncan
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

OK, so the applet makes a network connection and you want it to make it through the proxy?
Avatar of duncanb7
duncanb7

ASKER

Yes, please see the link for http.proxyHost setting in Charles

http://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration/
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I need to know how your applet is making a network connection and what's happening
Avatar of duncanb7
duncanb7

ASKER

Charles is only able to detecting html and  the javascript file sending from the remote site such as www.example.com/js/applet.js   in which will lauch applet application by setting up with <applet> tag with param. After all,  And what happen in the applet tag, Charles is no  any response or detection but I am able to see the data is changing in non-stop mode on applet in IE.

Please advise
Duncan
Avatar of duncanb7
duncanb7

ASKER

When disconnect the phone-line connection, the data in applet tag is stopped
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You didn't answer my question ...
Avatar of duncanb7
duncanb7

ASKER

I made a conection first on the remote site by login and passward, and pass
the security and going into one button and click the applet javascript will
send to my IE that I check from Charles.

Please advise and attach the html tag for applet

Duncan


<table>
<tr><td>
<p>If you cannot use the application after serveral minutes, please re-login</p>


</td></tr>
</table>

<br>

<applet code=a.b.q.a.class   codebase="http://data.com/applet/"  height=0 width=0 VIEWASTEXT name=Loading id=Loading align="bottom" MAYSCRIPT>
	
			<param name=cabbase value="Proj.cab">
			<PARAM NAME="archive" VALUE="Proj.jar">

<PARAM NAME="java_arguments" VALUE="-Xmx512m -Dsun.java2d.noddraw=true">
	<param name="color" value="1">
	<param name="isflash" value="false">
	<param name="isshowpinyininput" value="false">
	<param name="location" value="0">
	<param name="Language" value="eng">
</applet>
</body>
</html>

Open in new window

Avatar of duncanb7
duncanb7

ASKER

I tried both http and socks on Java as follows java code, the Charles is still not
working or react with the applet.

//: c02:HelloDate.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import java.util.*;

/** The first Thinking in Java example program.
 * Displays a string and today's date.
 * @author Bruce Eckel
 * @author www.BruceEckel.com
 * @version 2.0 
*/
public class HelloDate {
  /** Sole entry point to class & application
   * @param args array of string arguments
   * @return No return value
   * @exception exceptions No exceptions thrown
  */
  public static void main(String[] args) {
    System.out.println("Hello, it's: ");
    System.out.println(new Date());
	System.getProperties().put( "http.proxyHost", "127.0.0.1" );
System.getProperties().put( "http.proxyPort", "8888" );
	System.getProperties().put( "socks.ProxyHost", "127.0.0.1" );
System.getProperties().put( "socks.ProxyPort", "8889" );
	System.out.println(System.getProperty("http.proxyHost"));
  }
} ///:~

Open in new window

Avatar of duncanb7
duncanb7

ASKER

it might be FTP port
Avatar of duncanb7
duncanb7

ASKER

After using netstat, I found the application is using port number of 8044 and 80
SO what special for 8044 port.

Please advise

Duncan
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I made a conection first on the remote site by login and passward

I'm getting even more confused now. Are you saying

a. you're making a remote connection to a machine and then running an applet on it?
or
b. the applet is making a connection to the remote site?
Avatar of duncanb7
duncanb7

ASKER

a-I need to login remote website and type login and passward , just a form html page,
at this moment all link is captured by Charles.
b- after login successfully remote stie will send one html page which will included
apple tag and some javascript coding and then Java applet application is enabled and
streaming non-stop data is showing on the application
 After that, Charles  is not able to capture anything again from the remote site.
THe scenario is simple not confusing, Right.
I found the infomation on the remote site by netstat on window.
There are three ports from remote site
Nestat:
1-TCP   203.77.3.47.51280  www.remotesite.com:8044  Established
2-TCP   203.77.3.47.51527   www.remotesite.com:8044 Established
3-TCP    203.77.3.47:51000   www.remotesite.com:http Established

203.77.3.47 is my DSL ISP address
www.remotesite.com is my java applet software remote site address
From  point (3), the port is taking care http protocol to transfer all web page
from remote site.to client(me) such as login page and applet code
it seems point (1) and (2) are  address to take  care of streaming data
transferring into applet Java which recevied the data and show it to users.


Please advise
Duncan
Avatar of duncanb7
duncanb7

ASKER

If you are keeping confusing, just download Charles debugging software, and
login your https://www.experts-exchange.com account, Charles will show you something,

and imagine experts-exhange.com will send you something after login successfully
, for example, one applet java code, and then.......

You can try Fiddle and Charles, just type it in google seach
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't need to download Charles - i've used it many times and recommended it here.

The confusing part is that there's an applet in the scenario. Unless the applet picks up the correct proxy settings from the hosting software (applet context etc.) then it won't use the proxy. With any luck, it will.

The first thing you need to do is set Charles as the proxy for the browser. Do that, close the browser instance, restart with Charles running and let me know what happens
Avatar of duncanb7
duncanb7

ASKER

Charles is working on IE, and I 've already checked on IE's tools--> connection which already
select proxy for 127.0.0.1:8888
When open remote site on IE, Charles is able to show all http info and re-direct link except the streaming data into applet.

Actually, all data from DSL or telephone line should be able to be captured by
program software on widow such as C, Java program.

Is it right ?

Why charles can not capture the stream data if it is using http protocal unless
the stream data is transferred from other protocal such ftp, RIght?

I google 8044 port  which mention
http://www.corrupteddatarecovery.com/Port/8044tcp-Port-Type-fs-mgmt-fs-mgmt.asp
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Charles is an http proxy. Any network streams that don't use http will not register with it at all
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of duncanb7
duncanb7

ASKER

it seems only Java or C program  can capture the data, Right ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't know what data you mean. You haven't really said anything even about what your applet is meant to do, which is presumably your goal

http://technojeeves.com/joomla/index.php/free/117-smart-questions
Avatar of duncanb7
duncanb7

ASKER

the data is streaming data from the remote site to the applet application.
As we know Charles is http proxy only so other TCP protocol data transfer
can not be captured by Charles, Right ?
SO the answer using other ways besides Charles to capture the stream data
, for example, using C or Java program, Right.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

As we know Charles is http proxy only so other TCP protocol data transfer
can not be captured by Charles, Right ?

In general, that's probably right, as i said HERE
But i think it would depend on what the applet is doing internally, which still remains very mysterious
Avatar of duncanb7
duncanb7

ASKER

Yes, I miss your previous reply
My own download speed test monitor applet at http://www.cehjohnson.btinternet.co.uk/protean/speedtest.htm works fine with a proxy. Each timed request gets a text file from the applet's originating host (www.cehjohnson.btinternet.co.uk) and that appears in the proxy's trace. I'm using WebScarab rather than Charles. Here is how i started the applet:


appletviewer -J-Dhttp.proxyHost=127.0.0.1 -J-Dhttp.proxyPort=8008 http://www.cehjohnson.btinternet.co.uk/protean/speedtest.html

My case is similar to your example, the stream data from remote into applet automatically after success login. And it seeems you understand what I am asking for ?
<applet code=a.b.q.a.class   codebase="http://data.com/applet/"  height=0 width=0 VIEWASTEXT name=Loading id=Loading align="bottom" MAYSCRIPT>
      
                  <param name=cabbase value="Proj.cab">
                  <PARAM NAME="archive" VALUE="Proj.jar">

<PARAM NAME="java_arguments" VALUE="-Xmx512m -Dsun.java2d.noddraw=true">

FOr my case
So the codebase is remote site stream data location, RIght ?
And achive is Java applet program to be ready to receive data on my IE from remote site
stream data location, Right ?
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of duncanb7
duncanb7

ASKER

Yes, your example is good, at least starting
ASKER CERTIFIED SOLUTION
Avatar of duncanb7
duncanb7

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of duncanb7
duncanb7

ASKER

Okay, talk it into otherway or reverse the question to you.
On you example, after typing something in the applet, it  will receive message
such as  "Download 1 took 7.46 seonds at 19.50:55 on 05/07/12..." and Charles
is able to capture the link response from http://www.cehjohnson.btinternet.co.uk/protean/speedtest.txt?dummy=8505545161610364928

Could you do the same but Charles Could NOT capture the response data from
http://www.cehjohnson.btinternet.co.uk/protean/speedtest.txt?dummy=8505545161610364928  by Java program.Probably yes, if my case does.

Duncan
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Could you do the same but Charles Could NOT capture the response data from
http://www.cehjohnson.btinternet.co.uk/protean/speedtest.txt?dummy=8505545161610364928  by Java program.Probably yes, if my case does.

Sorry, i don't understand that at all
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

That's ok if you're going to shift the focus, yes
Avatar of duncanb7
duncanb7

ASKER

Just for memo on this thread as reminder, need to set  Permission on java.policy file
grant codeBase "file:${{java.ext.dirs}}/*" {
      permission java.security.AllPermission;
      permission java.net.SocketPermission "213.123.20.90:80","connect,resolve";
};


appletviewer -J-Djava.security.policy=java.policy  -J-Dhttp.proxyHost=127.0.0.1 -J-Dhttp.proxyPort=8888 http://www.cehjohnson.btinternet.co.uk/protean/speedtest.htm
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Just for memo on this thread as reminder, need to set  Permission on java.policy file ...

That's possible, for the applet that you really want to run. It isn't necessary for running my applet, the command for which you show immediately below
Avatar of duncanb7
duncanb7

ASKER

Dear CEJI,

Is it possible you can send me  webspeed.java source code(from webspeed.jar) for my Java tutorial connection study?

Please kindly advise
Ducan

<applet codebase="." archive="webspeed.jar"
    code="webspeed.Webspeed.class" width="400" height="300">
      </applet>
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

The source is in the jar
Avatar of duncanb7
duncanb7

ASKER

You mean I need to download  decomplier to convert  jar into java Right ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You mean I need to download  decomplier to convert  jar into java Right ?
No, you need to extract the source from the jar
Avatar of duncanb7
duncanb7

ASKER

If you don't mind, please let know how to extract it on java command line.
Duncan
Avatar of duncanb7
duncanb7

ASKER

If possilbe, why there is a lot decomplier in google search for jar to java
Avatar of duncanb7
duncanb7

ASKER

THanks, CEJI,

I already unzip the jar file and found the source java code  already inside   jar file
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

If possilbe, why there is a lot decomplier in google search for jar to java

Because usually a jar file only contains class files
Avatar of duncanb7
duncanb7

ASKER

I will continue this thread in new thread to focus
on Java programming
Hope you understood my question in this thread
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo