Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Using Appletstub I created AppeltEnvironment and initilized applet but I keep getting Invalid Stream

Scenario: I am replicating Website Applet behavior in my Java program, website is https://carelink.minimed.eu/patient/entry.jsp?bhcp=1. I have .Jar file downloaded for a applet. I added it to my Java Project. Using AppletStub I have passed relevant parameters and called classLoader. I am able to open applet window

But I am getting error as Invalid Stram Header:0A0A0A0A error

Below is the code

`public class AppletSnipper{ 

public static void main(String args[]) throws InstantiationException, IllegalAccessException, ClassNotFoundException, URISyntaxException, IOException{
//CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));

 Connection.Response res = Jsoup.connect("https://carelink.minimed.eu/patient/j_security_check")
         .data("j_username", "chikhalehero").data("j_password", "heroaahe").method(Connection.Method.POST)
         .execute();
 Map<String, String> loginCookies = res.cookies();


//CookieHandler.setDefault((CookieHandler) loginCookies);
CookieHandler.setDefault(new CookieManager());
URL url[] = { 
    // new File("/ddmsDTWApplet.jar").toURI().toURL()
        new URL("https://carelink.minimed.eu/patient/main/deviceUpload.do/applets/ddmsDTWApplet.jar").toURI().toURL()


    };


AppletEnvironment appletEnvironment = new AppletEnvironment(url[0]);




appletEnvironment.put("width", "715");
appletEnvironment.put("height", "390");
appletEnvironment.put("src", "");

appletEnvironment.put("CODE", "minimed.ddms.applet.dtw.DTWApplet");
appletEnvironment.put("type","application/x-java-applet;jpi-version=1.6");
appletEnvironment.put("scriptable","true");
appletEnvironment.put("cache_option","Plugin");
appletEnvironment.put("cache_archive","ddmsDTWApplet.jar");
appletEnvironment.put("archive","ddmsDTWApplet.jar");
appletEnvironment.put("mayscript","true");
appletEnvironment.put("userName","abc");
appletEnvironment.put("password","xyz");
appletEnvironment.put("locale","en_IN");
appletEnvironment.put("systemVersion","7333-8.1.019");
appletEnvironment.put("lastPumpUniqueID","");
appletEnvironment.put("lastMeterUniqueID","");
appletEnvironment.put("lastCGMUniqueID","");
appletEnvironment.put("uploadParadigmLinkMeterOnly","false");
appletEnvironment.put("uploadCGM","true");
appletEnvironment.put("uploadG3B","false");
appletEnvironment.put("ngpUploadBlackList","[MMT-1581, MMT-1582, MMT-1780, MMT-1781, MMT-1782]");
appletEnvironment.put("hideNGP","N");
appletEnvironment.put("hideCNL","N");
appletEnvironment.put("progressbar","true");
appletEnvironment.put("boxmessage","Loading Device Reader Applet...");
appletEnvironment.put("troubleshooting","Troubleshooting");
appletEnvironment.put("boxbgcolor","238,238,238");
appletEnvironment.put("boxfgcolor","black");









//Frame frame = new Frame("chikhalehero");


//DTWApplet appletClass = new DTWApplet();
URLClassLoader classLoader = new URLClassLoader(url);
DTWApplet appletClass = (DTWApplet)classLoader.loadClass("minimed.ddms.applet.dtw.DTWApplet").newInstance();

//appletClass.start();

JFrame frame = new JFrame();
frame.setLayout(new GridLayout(1, 1));


appletClass.setName("Custom Applet Name");
//appletClass.set

frame.getContentPane().add(appletClass);

if( appletClass == null )   System.out.println("Not intialiyed.");
//else  appletClass.init();
//appletClass.start();



appletClass.setStub(appletEnvironment);


appletClass.init();
appletClass.start();

frame.pack();
frame.isResizable();
frame.setVisible(true);
System.out.println("I have pressed Sync");

}`

Tagged:
Sign In or Register to comment.