SetRequestProperty

I am trying to write in a text file on HTTP server, using URLconnection and setRequestProperty. How could I avoid this errors "Server returned HTTP response code: 405" and "Server returned HTTP response code: 401"?
Thanks.

It all depends upon the authentication scheme IIS uses.
For authentication schemes used in IIS see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconiisauthentication.asp
Here is an example for the basic authentication
URL url;
URLConnection uc;
url = new URL("some-url");
uc = u.openConnection();
uc.setRequestProperty("Authorization", "Basic " + encodeBase64(Name + ":"+ Password));
...The client must send the userid and password, separated by a single colon (":")
character, within a base64 encoded string in the credentials.
see rfc2069 section 11 Access Authentication
http://www.w3.org/Protocols/rfc2068/rfc2068
BG

Similar Messages

  • URLConnection.setRequestProperty no longer works in 1.6.0_22?

    Anyone else having a problem? A program on one of our user's machines suddenly no longer works, and it looks like it's because their JRE has updated itself.
    The program makes a request to a server using a digitally signed, serialized object thusly:
            SignedObject so = new SignedObject(request, codeKey, signer);
            HttpURLConnection con = (HttpURLConnection)url.openConnection();
            con.setRequestProperty("Content-Transfer-Encoding", "gzip");
            con.setRequestMethod("POST");
            con.setDoInput(true);
            con.setDoOutput(true);
            ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(con.getOutputStream()));
            out.writeObject(so);
            out.close();This interaction has been untouched for some years now. The Servlet handling the request does:
                InputStream is = request.getInputStream();
                String coding = request.getHeader("Content-Transfer-Encoding");
                if (coding != null && coding.trim().equalsIgnoreCase("gzip")) {
                    is = new GZIPInputStream(is);
                    log.debug("Request will be de-zipped");
                ObjectInputStream ois = new ObjectInputStream(is);
                Object o = ois.readObject();
                ois.close();Suddenly the user was getting error 400 (invalid request) The server was throwing java.io.StreamCorruptedException: invalid stream header: 1F8B0800
    After a lot of head scratching I noticed he was using rev 22, so I installed it on my own machine and I get the error too. It appears that the Content-Transfer-Encoding header is simply not happening any more. The coding variable in the server is now null. Debugging the sending code calling setRequestProperty no longer adds an entry to the requests field of HttpURLConnection. 1F8B0800 is the "magic number" of a gzip file.
    What's going on? This is the second release in a row that's broken existing code (the first by adding a restriction to LDAP search field names).
    Later:
    I've constructed an SSCE and submitted a bug report on this one. We'll see if anything happens. I'm concerned that pre-release regression testing isn't what it was under Sun.
    Edited by: malcolmmc on 29-Oct-2010 20:02

    No, Since I didn't particularly intend to install the upgrade myself, but I have now and nothing seems relevant.
    This is a moderately significant piece of functionality, and they have no business changing it in a minor bug fix release.
    By the way, when constructing my example I first accidentally put in the header key without the hyphens and that did get through.
    1/11:
    My [bug report|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6996110] has now been entered:
    The work around suggested is to add -Dsun.net.http.allowRestrictedHeaders=true which implies that this was a deliberate change. Google turns up no results for this flag suggesting this is the first public documentation of it.
    So this is, indeed, a deliberate change which is not backward compatible, not highlighted in the release notes and made on a minor revision.
    Edited by: malcolmmc on 01-Nov-2010 09:12

  • URLConnection setRequestProperty doesn't seem to work

    G'day, I am trying to set a URLConnection property for proxy authentication. Here's a simple test I've created:
    import java.net.*;
    public class ProxyTest {
        public static void main(String[] args) {
            try {
                System.setProperty("http.proxyHost", "192.168.107.24");
                System.setProperty("http.proxyPort", "3128");
                URL url=new URL("http://google.com");
                URLConnection uc = url.openConnection ();
                uc.setRequestProperty( "Proxy-Authorization", "foobar");
                System.out.println("Proxy-Authorization is: " + uc.getRequestProperty("Proxy-Authorization"));
                uc.connect();
            } catch (Exception e) {
                e.printStackTrace();
    }This always gives my "Proxy-Authorization is null". I have tested this on java 1.6 and 1.5, on a linux system and a windows xp system. In my real app the url connection always gives me 407 unauthorized, I have used tcpdump to check just in case the Proxy-Authorization is being sent, but it isn't.
    I am probably missing something simple - can anyone see what it might be? Cheers.

    Try the below.
    package test;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    * @author asiri_godage
    public class Main {
    public static void main(String[] args) {
    System.out.println("HHHHH");
    String message;
    System.out.println(System.getProperty("proxySet"));
    System.getProperties().put( "proxySet", "true" );
    System.getProperties().put( "proxyHost", "proxy.server.com" );
    System.getProperties().put( "proxyPort", "8080" );
    String password = "UserName:LoginPassword";
    String encodedPassword = base64Encode( password );
    try{
    URL u = new URL("[http://www.rarlab.com/rar/wrar390.exe]");
    URLConnection uc = u.openConnection();
    {color:#000000}uc.setRequestProperty( "Proxy-Authorization", " Basic " + encodedPassword );{color}
    String contentType = uc.getContentType();
    int contentLength = uc.getContentLength();
    if (contentType.startsWith("text/") || contentLength == -1) {
    throw new IOException("This is not a binary file.");
    InputStream raw = uc.getInputStream();
    InputStream in = new BufferedInputStream(raw);
    byte[] data = new byte[contentLength];
    int bytesRead = 0;
    int offset = 0;
    while (offset < contentLength) {
    bytesRead = in.read(data, offset, data.length - offset);
    if (bytesRead == -1) {
    break;
    offset += bytesRead;
    in.close();
    if (offset != contentLength) {
    throw new IOException("Only read " + offset + " bytes; Expected " + contentLength + " bytes");
    String filename = "";
    filename = "C:" + u.getFile().substring(filename.lastIndexOf('/') + 1);
    FileOutputStream out = new FileOutputStream(filename);
    out.write(data);
    out.flush();
    out.close();
    }catch(Exception e){
    e.printStackTrace();
    private static String base64Encode(String password) {
    char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".toCharArray();
    char [] data= password.toCharArray();
    char[] out = new char[((data.length + 2) / 3) * 4];
    // 3 bytes encode to 4 chars. Output is always an even
    // multiple of 4 characters.
    for (int i = 0, index = 0; i < data.length; i += 3, index += 4) {
    boolean quad = false;
    boolean triple = false;
    //convert to unsigned byte
    int val = (0xFF & (int) data);
    val <<= 8;
    if ((i + 1) < data.length) {
    val |= (0xFF & (int) data[i + 1]);
    triple = true;
    val <<= 8;
    if ((i + 2) < data.length) {
    val |= (0xFF & (int) data[i + 2]);
    quad = true;
    out[index + 3] = alphabet[(quad ? (val & 0x3F) : 64)];
    val >>= 6;
    out[index + 2] = alphabet[(triple ? (val & 0x3F) : 64)];
    val >>= 6;
    out[index + 1] = alphabet[val & 0x3F];
    val >>= 6;
    out[index + 0] = alphabet[val & 0x3F];
    String sout=new String(out);
    return sout;

  • HttpUrlConnection's setRequestProperty() doesn't work

    Hi,
    I am trying to set the request properties of a HttpUrlConnection to specific settings before I download the given page. however, the response code is 200(OK) for pages that have different property from what I set. For Example, I set
    connection.setRequestProperty("Accept","image/jpg");
    connection.setRequestProperty("Accept-charset","utf-8");
    for the connection and ask for the page with accept :text/html and accept-charset:iso-8859-1, but the response is 200(Ok).
    can anybody tell what is wrong with my code, the code is as follows:
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.HttpURLConnection;
    import java.util.Properties;
    class Headok
    private int code;
         String proxy = "proxy.xxx.xxx.xx";
         String port = "8080";
    public boolean headOk(URL HeadUrl)
              try
              Properties systemproperties = System.getProperties();
              systemproperties.setProperty("http.proxyHost",proxy);
              systemproperties.setProperty("http.proxyPort",port);
              //URLConnection HeadUrl = new URLConnection(url);
              HttpURLConnection connection = (HttpURLConnection)HeadUrl.openConnection();
              connection.setDoOutput(true);
              connection.setRequestMethod("HEAD");
              connection.setRequestProperty("Accept","image/jpg");
              connection.setRequestProperty("Accept-charset","utf-8");
         connection.setRequestProperty("From","[email protected]");
    connection.setRequestProperty("Connection","Keep-Alive");
              connection.connect();
              code=connection.getResponseCode();
              //System.out.println(code);
                   if (code==connection.HTTP_OK)
                        return true;
    catch (Exception e)
         return false;
    return false;     
    public static void main (String args[]) throws Exception
         Headok head = new Headok();
    boolean k=     head.headOk(new URL("http://news.bbc.co.uk/"));
         if(k==true)
              System.out.println("ok");
         else{
              System.out.println("not-ok");
    }

    Dear ethiio,
    First a big thanks for your keen in knowing this problem. Please help me in this issue. I am breaking my head for the past four days. Here i explain it in detail... All the sites i have referred does the same and i am also following the same but not getting the solution.
    SCENARIO:
    I want to mimic a browser using the java code. i will supply the first page url then the java code should read the html of the given url. then the second url and it should do the same.... then the third url....fourth and so on...
    Problem:
    The code works fine... but the problem is : when i give the second url i am getting a cookie in the response header. I am able to read header and get the "Set-Cookie" value. I am using setRequestProperty("Cookie",cookie) to set the read value of cookie to next request. But instead of getting the html of the url i supplied i am gettin the html of "ERROR PAGE" which contains the message as follows: "Cookies Should be enabled for this service, Please enable cookies in your browser" i dont know where i am going wrong... Please help me to fix this problem
    SOURCE CODE:
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.net.MalformedURLException;
    import java.net.URL;
    public class UrlCheck
         int stepCount=1;
         int fileSuffix=1;
         int cookieSuffix=1;
    URL url = null;
         BufferedReader bufferedReader = null;
         boolean isCookieFound=false;
         String copyCookie=null;
         public static void main(String[] urls) throws MalformedURLException,IOException
              System.getProperties().put("proxySet","true");
              System.getProperties().put("proxyHost","a.b.c.d");// a,b,c,d is not the actual value
              System.getProperties().put("proxyPort","X");//X is not the actual value
              UrlCheck readHtml = new UrlCheck();
              while(readHtml.stepCount<6)
              readHtml.url=new URL(readHtml.urlDesigner());
              readHtml.cookieAndContent();
         public String urlDesigner()
              String url=null;
              switch(stepCount)
                   case 1:
                        url="URL 1";
                        stepCount++;
                   break;
                   case 2:
                        url="URL 2";
                        stepCount++;
                        break;
                   case 3:
                        url="URL 3";
                        stepCount++;
                        break;
                   case 4:
                        url="URL 4";
                        stepCount++;
                        break;
                   case 5:
                        url="URL 5";
                        stepCount++;
                        break;
              return url;
         public void cookieAndContent() throws IOException
              int n=1;
              String cookie=null;
              String temp=null;
              boolean done = false;
              FileOutputStream fileOutputStream = new FileOutputStream("D:/Cookie/Cookie"+cookieSuffix+".txt/");
              DataOutputStream dataOutputStream= new DataOutputStream(fileOutputStream);
              FileOutputStream fileOutputStream1 = new FileOutputStream("D:/ReadHtml/Page"+fileSuffix+".txt/");
              DataOutputStream dataOutputStream1= new DataOutputStream(fileOutputStream1);
              HttpURLConnection connection = (HttpURLConnection) (url.openConnection());
              if(isCookieFound)
                   System.out.println("----------"+copyCookie+"----------");
                   connection.setUseCaches(false);
                   connection.setDefaultUseCaches(false);
                   connection.setDoInput(true);
                   connection.setDoOutput(true);
                   connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              connection.setRequestProperty("Cookie",copyCookie);
              PrintWriter pw = new PrintWriter(connection.getOutputStream());
              pw.flush();
                   pw.close();
              connection.connect();
              InputStream ip = connection.getInputStream();
              /**************Header Value Getter************************/
              while (!done)
                   String headerKey = connection.getHeaderFieldKey(n);
              String headerVal = connection.getHeaderField(n);
              if (headerKey!=null || headerVal!=null)
              //System.out.println(headerKey+"="+headerVal);
              dataOutputStream.writeBytes(headerKey+"+"+headerVal);
              else
                   done = true;
                   cookie=connection.getHeaderField("Set-Cookie");
                   //copyCookie=cookie;
                        if(cookie!=null)
                             int index = cookie.indexOf(";");
                             if(index >= 0)
                                  isCookieFound=true;
                                  cookie = cookie.substring(0, index);
                                  copyCookie=cookie;
                                  System.out.println("##########"+cookie+"##########");
                                  dataOutputStream.writeBytes("****************"+cookie+"****************");
              n++;
              cookieSuffix++;
              //System.out.print(copyCookie);
              /**************Content Value Getter************************/
              int ch;
              char value;
              while((ch=(ip.read()))!=-1)
                             value=(char)ch;
                             //System.out.print(value);
                             dataOutputStream1.writeBytes(String.valueOf(value));
              fileSuffix++;
              ip.close();
              connection.disconnect();
              System.out.println("*********"+isCookieFound+"*********");
    Message was edited by:
    Lokee

  • Problem using setRequestProperty on a url connection, how can I fix it?

    From what I've read on it I thought I did everything the right way. I'm just starting out with the networking aspect of Java. What I'm trying to do is download only a portion of a file. For right now I'm just worried about downloading the end of a file starting from a value I enter manually. I read that I should use the setRequestProperty to set the start position of the file I'm download. For some reason it isn't working for me. It's still download the entire file. Can anyone give me some insight into what I'm doing wrong? I've commented what I think is happening in each line of the code, if someone could verify where I'm correct and where I'm wrong at that would be helpful too. Thank you.
    import java.io.*;
    import java.net.*;
    public class FileDownload2 {
         public static void download() {
              OutputStream out = null;
              RandomAccessFile file = null;
              URLConnection conn = null;
              InputStream  in = null;
              try {
                            URL url = new URL(""); //create a new url
                   conn = url.openConnection();//set url up to be opened
                   conn.setRequestProperty("Range", "921600-"); // send a header-request
                   in = conn.getInputStream(); //open the connection to the file
                   byte[] buffer = new byte[1024];//create a buffer to hold bytes from the file
                    out = new FileOutputStream("test");//create a new file to write the bytes to
                   int numRead;
                   long numWritten = 0;
                   while ((numRead = in.read(buffer)) != -1) {
                        out.write(buffer, 0, numRead);
                        numWritten += numRead;//while there is still data read from the buffer and write the bytes to the file
              } catch (Exception exception) {
                   exception.printStackTrace();
              } finally {
                   try {
                        if (in != null) {
                             in.close();//close the inputstream
                        if (out != null) {
                             out.close();//close the file
                   } catch (IOException ioe) {
         public static void main(String[] args) {
                   download();//call method download
    }Edited by: Secondtimearound on May 3, 2008 9:05 AM

    Thanks! I ended up finding that on my own. I'll still give you the points if you want them because you gave the right answer. LOL I do have another question though. I only want to download part of a file and it seems to work fine with .mp3 files, I'm guessing because they were designed to play from any part of the file. However, when the program downloads only a part of a video file the video won't show. Sometimes the audio will still download that goes along with the video file. I read in another forum that the reason p2p programs can preview a video file is because they download the begining and end of the file. My question is, how can determine how much of the beginning and end of the file needs to be downloaded in order for the video file to play? I'm guessing there's some type of header file in the video but how to I download just that first? Then, I'm thinking I would have to use threads to download the different parts then combine them or something. I'm not sure. Any help would be appreciated. Thanks.

  • SetRequestProperty("Content-Length", ....) is not set in the POST resquest

    Hi,
    Iam sending a POST request to a servlet. Apart from other request properties iam also setting "Content-Length" property by using the
    setRequestProperty("Content-Length", data.length) on httpconnection object. When i checked the http packtes being from the toolkit to the servlet (by using ethereal tool) i see that all other properties as appropriately set by
    "Content-Length" is not being set at all. This is causing me big problem at the server side.
    Can any one tell my why the toolkit could have droped the
    "Content-Length" property in the POST request.
    Thanks in Advance
    Raju

    :) Before Sending the data only. The code snippet is as follows:
    String data="abc";                         hc.setRequestProperty( "User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0" );                              hc.setRequestProperty("Content-Language", "en-US" );
    hc.setRequestProperty( "Accept", "application/octet-stream" );
    hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    hc.setRequestProperty("Content-Length",Integer.toString(data.getBytes().length));
    hc.setRequestProperty("Cookie",sessionId);
    OutputStream out = hc.openOutputStream();
    out.write(temp.getBytes());
    out.flush();
    out.close();
    Thanks
    Rama Raju
                                            int rc = hc.getResponseCode();
                                  if (rc != HttpConnection.HTTP_OK) {
                             System.out.println("HTTP response code: " + rc);
    ....................................

  • HttpConnection.setRequestProperty DOUBLES User-Agent

    J2ME HttpConnection.setRequestProperty
    The doc states the following:
    public void setRequestProperty(String key,
    String value)
    throws IOException
    Sets the general request property.
    If a property with the key already exists, overwrite
    its value with the new value.
    Actually, (at least on Windows-XP) for User-Agent, it prepends it to always
    there "UNTRUSTED/1.0"
    Microsoft IIS has fits with User Agent with TWO agents, e.g. "KSOAP/2.0, UNTRUSTED/1.0" (it dies with a HTTP 400/Bad Request/Invalid Header Name error)
    With KSOAP, since I have source to it, I can comment out the explicit setting of User-Agent, and use it to consume IIS/dot net web services
    BUT, with JSR-172, I have no such control
    Hence, without some workaround, I'm unable to use JSR-172 with a IIS/dot net web service
    HELP, Please!
    Thanks

    A possible workaround would be to set up a proxy server that forwards the request after fixing the user agent (it's ugly but it'll work).
    But where are you getting this behaviour. I doubt it comes up with any real devices.
    shmoove

  • How does setRequestProperty holds the content permanently?

    Question:
    1. Need any framework to hold the content of .setRequestProperty(...)?
    2. Where does .setRequestProperty(..) store the content? Cookies? Session?
    3. Is .setRequestProperty(..) access any tag of HTML or XML?
    public static String postData(String urlstr, String parameters, String requestId) throws IOException {
            URL url = new URL(urlstr);
            HttpURLConnection hpcon = null;
            try{
                hpcon = (HttpURLConnection) url.openConnection();
                hpcon.setRequestMethod("POST");
                hpcon.setRequestProperty("Content-Length", "" + Integer.toString(parameters.getBytes().length));
                hpcon.setRequestProperty("Content-Language", "en-US");
                hpcon.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
                hpcon.setRequestProperty("RequestId",requestId);           
                hpcon.setDoInput(true);
                hpcon.setDoOutput(true);
                hpcon.setUseCaches (false);
                DataOutputStream printout = new DataOutputStream (hpcon.getOutputStream ());
                printout.writeBytes (parameters);
                printout.flush ();
                printout.close ();
                // getting the response is required to force the request,
                //otherwise it might not even be sent at all
                BufferedReader in = new BufferedReader(new InputStreamReader(hpcon.getInputStream()));
                String input;
                StringBuffer response = new StringBuffer(256);
                while((input = in.readLine()) != null) {
                    response.append(input + "\r");
                return response.toString();
            catch(Exception e){
                throw new IOException(e.getMessage());
            finally {
                if(hpcon != null){
                    hpcon.disconnect();
                    hpcon = null;
        }4. Is it after i .setRequestProperty() already, i can just type the code below to access at any other java class?
    URL yahoo = new URL("http://localhost:8080/Simulator/TestingServlet");
    URLConnection yc = yahoo.openConnection();
    Map map = yc.getRequestProperties();
    Set set = map.entrySet();
    Iterator iterator = set.iterator();
    while (iterator.hasNext()) {
            System.out.println(iterator.next());
    }

    1. Need any framework to hold the content of .setRequestProperty(...)? No, the HttpURLConnection does that.
    2. Where does .setRequestProperty(..) store the content? Cookies? Session?In the HTTP request header.
    3. Is .setRequestProperty(..) access any tag of HTML or XML?No.
    4. Is it after i .setRequestProperty() already, i can just type the code below to access at any other java class?What happened when you tried it?

  • GetParameterValues and setRequestProperty - multiple values

    Hello,
    I'm just getting into servlets, so any help here would be greatly appreciated...
    I'm trying to create a simple servlet that accepts a String array as one of the request keys.
    I have the following line in my Servlet, called myServlet:
    String[] servletKeywords = request.getParameterValues("keywords");
    I have tried using the following two approaches in my MIDlet code, but neither of them work:
    Approach 1
    Using the setRequestProperty method...
    HttpConnection con;
    InputStream in;
    String url = "http://localhost:8081/servlet/myServlet";
    try {
    con = (HttpConnection)Connector.open(url);
    //con.setRequestMethod(HttpConnection.POST); //doesn't make any difference
    con.setRequestProperty("keywords", "Barry,Alan,Rob");
    in = con.openInputStream();
    catch (etc.
    .... but the servletKeywords String[] in myServlet is null.
    Approach 2
    Creating the url manually, using commas to delimit the array elements...
    HttpConnection con;
    InputStream in;
    String url = "http://localhost:8081/servlet/myServlet?keywords=Barry,Alan,Rob";
    try {
    con = (HttpConnection)Connector.open(url);
    //con.setRequestMethod(HttpConnection.POST);
    in = con.openInputStream();
    catch (etc.
    .... Using this method, the servletKeywords String[] does contain something, but it's:
    servletKeywords[0] == "Barry,Alan,Rob"
    not (as hoped for!):
    servletKeywords[0] == "Barry"
    servletKeywords[1] == "Alan"
    servletKeywords[2] == "Rob"
    I've spent all day trying to find an example of how to pass a String array to a servlet, but can't find it anywhere.
    myServlet does work fine, it's just the getParameterValues (and setRequestProperty) that isn't working.
    Can anyone give me an example of how to do it?
    Thanks,
    James

    Thank you very much for your response.
    The latter approach works, i.e., using:
    String url = "http://localhost:8081/servlet/myServlet?keywords=Barry&keywords=Alan&keywords=Rob";
    Thanks very much for that. Being a bit fussy though, I prefer to use the setRequestProperty method, but this doesn't work at all - be it for single-valued keys or multiple-valued keys... they always just turn up as null in the servlet.
    Here's my MIDlet code just in case I might be missing anything obvious:
    private HttpConnection con;
    private InputStream in;
    String url = "http://localhost:8081/servlet/myServlet";
    try {
    con = (HttpConnection)Connector.open(url);
    con.setRequestProperty("mode", "1");
    con.setRequestProperty("keywords", "Barry");
    con.setRequestProperty("keywords", "Alan");
    con.setRequestProperty("keywords", "Rob");
    in = con.openInputStream();
    catch (IllegalArgumentException iae) {}
    catch (ConnectionNotFoundException cnfe) {}
    catch (IOException ioe) {}
    Thanks again,
    James
    (Thanks also lolavaerria for your response, though I am not using forms for the servlet access.)

  • Help with sending string using setRequestProperty to servlet

    I have a string that is encrpyted so it uses some wierd characters. An
    example of the integer representation of the characters for a string that is
    not working is:
    26,162,91,52,153,136,227,53,190,0
    When I recieve it on the servlet end and go to use it the integer
    representation of the characters is all messed up therefore I can't decrypt
    it properly. The servlet recieved:
    26,162,91,52, 63 , 63 ,227,53,190,0
    Where did the 63's come form??????? That is a "?" character and was not
    part of the original string. I think it has something to do with when the
    characters are converted to bytes or something but I can't seem to figure
    out a way to fix it so that I get the original characters...
    Please, any help would be very much appreciated. Thanks.

    Hmmm....my last post doesn't appear to make a whole lot of sense. I've got to start getting to bed earlier.
    I guess I was a little excited when I realized what URLEncoder and URLDecoder were doing (by looking at the source, of course) which involves a lot of char conversion on the individual portions of your String. These classes are for US-ASCII text and really don't handle non-printable characters very well.
    The passing of the characters across the connection remains a problem, and (without looking at source code) I believe the same problem is at the root; there is a basic encoding of your String into a format that doesn't support characters that aren't in the code page, and the question marks are substituted.
    I haven't tried, but can suggest, using the encode/decode methods in the javax.mail.internet.MimeUtility class. This class comes with the J2EE download, but I'm afraid it may have some of the same shortcomings when it comes to characters it doesn't like (its methods appear to be mostly for mail HEADERS.)
    You basically need either a UUEncode or Base64 encoder/decoder to translate your String into plaintext before it gets sent to the Servlet. The Java Commerce API (Java Wallet) contains a Base64Encoder/Base64Decoder but it is not licensed for reuse.
    There might be other options (I don't know the full scope of your setup), but if all else fails, I can post a UUEncode class that will convert your encrypted string into plaintext for transmission.

  • Can't post to Mircrosoft IIS machines

    Hi I am using the following code from a tutorial. But it blows up every time after a second POST. But I can post as many times as I need to a linux box or any other UNIX boxes I can think of.
    What is going on? Why does it not work with microsoft products?
    * HttpMidlet.java
    * Created on October 23, 2001, 11:19 AM
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    * @author kgabhart
    * @version
    public class HttpMidlet extends MIDlet implements CommandListener {
    // A default URL is used. User can change it from the GUI
    private static String defaultURL = "http://www.microsoft.com";
    // Main MIDP display
    private Display myDisplay = null;
    // GUI component for entering a URL
    private Form requestScreen;
    private TextField requestField;
    // GUI component for submitting request
    private List list;
    private String[] menuItems;
    // GUI component for displaying server responses
    private Form resultScreen;
    private StringItem resultField;
    // the "send" button used on requestScreen
    Command sendCommand;
    // the "exit" button used on the requestScreen
    Command exitCommand;
    // the "back" button used on resultScreen
    Command backCommand;
    public HttpMidlet(){
    // initialize the GUI components
    myDisplay = Display.getDisplay( this );
    sendCommand = new Command( "SEND", Command.OK, 1 );
    exitCommand = new Command( "EXIT", Command.OK, 1 );
    backCommand = new Command( "BACK", Command.OK, 1 );
    // display the request URL
    requestScreen = new Form( "Type in a URL:" );
    requestField = new TextField( null, defaultURL, 100, TextField.URL );
    requestScreen.append( requestField );
    requestScreen.addCommand( sendCommand );
    requestScreen.addCommand( exitCommand );
    requestScreen.setCommandListener( this );
    // select the HTTP request method desired
    menuItems = new String[] {"GET Request", "POST Request"};
    list = new List( "Select an HTTP method:", List.IMPLICIT, menuItems, null );
    list.setCommandListener( this );
    // display the message received from server
    resultScreen = new Form( "Server Response:" );
    resultScreen.addCommand( backCommand );
    resultScreen.setCommandListener( this );
    }//end HttpMidlet()
    public void startApp() {
    myDisplay.setCurrent( requestScreen );
    }//end startApp()
    public void commandAction( Command com, Displayable disp ) {
    // when user clicks on the "send" button
    if ( com == sendCommand ) {
    myDisplay.setCurrent( list );
    } else if ( com == backCommand ) {
    // do it all over again
    requestField.setString( defaultURL );
    myDisplay.setCurrent( requestScreen );
    } else if ( com == exitCommand ) {
    destroyApp( true );
    notifyDestroyed();
    }//end if ( com == sendCommand )
    if ( disp == list && com == List.SELECT_COMMAND ) {
    String result;
    if ( list.getSelectedIndex() == 0 ) { // send a GET request to server
    System.out.println("getHTTP");
    result = sendHttpGet( requestField.getString() );
    else // send a POST request to server
    System.out.println("postHTTP");
    result = sendHttpPost( requestField.getString() );
    resultField = new StringItem( null, result );
    resultScreen.append( resultField );
    myDisplay.setCurrent( resultScreen );
    }//end if ( dis == list && com == List.SELECT_COMMAND )
    }//end commandAction( Command, Displayable )
    private String sendHttpGet( String url )
    HttpConnection hcon = null;
    DataInputStream dis = null;
    StringBuffer responseMessage = new StringBuffer();
    try {
    // a standard HttpConnection with READ access
    hcon = ( HttpConnection )Connector.open( url );
    // obtain a DataInputStream from the HttpConnection
    dis = new DataInputStream( hcon.openInputStream() );
    // retrieve the response from the server
    int ch;
    while ( ( ch = dis.read() ) != -1 ) {
    responseMessage.append( (char) ch );
    }//end while ( ( ch = dis.read() ) != -1 )
    catch( Exception e )
    e.printStackTrace();
    responseMessage.append( "ERROR" );
    } finally {
    try {
    if ( hcon != null ) hcon.close();
    if ( dis != null ) dis.close();
    } catch ( IOException ioe ) {
    ioe.printStackTrace();
    }//end try/catch
    }//end try/catch/finally
    return responseMessage.toString();
    }//end sendHttpGet( String )
    private String sendHttpPost( String url )
    HttpConnection hcon = null;
    DataInputStream dis = null;
    OutputStream os = null;
    StringBuffer responseMessage = new StringBuffer();
    // the request body
    String requeststring = "This is a POST.";
    try {
    hcon = (HttpConnection)Connector.open(url);
    byte [] data = "TextField=Hello&TextField2=Hello2&Submit=Submit".getBytes ();
    hcon.setRequestMethod(HttpConnection.POST);
    hcon.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
    hcon.setRequestProperty("Content-Language","en-US");
    hcon.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
    os = hcon.openOutputStream ();
    os.write (data);
    os.close ();
    //conn.close ();
    // obtain DataInputStream for receiving server response
    dis = new DataInputStream( hcon.openInputStream() );
    // retrieve the response from server
    int ch;
    while( ( ch = dis.read() ) != -1 ) {
    responseMessage.append( (char)ch );
    }//end while( ( ch = dis.read() ) != -1 ) {
    catch( Exception e )
    e.printStackTrace();
    responseMessage.append( "ERROR" );
    finally {
    // free up i/o streams and http connection
    try {
    if( hcon != null ) hcon.close();
    if( dis != null ) dis.close();
    if( os != null ) os.close();
    } catch ( IOException ioe ) {
    ioe.printStackTrace();
    }//end try/catch
    }//end try/catch/finally
    return responseMessage.toString();
    }//end sendHttpPost( String )
    private String xsendHttpPost( String url )
    HttpConnection hcon = null;
    DataInputStream dis = null;
    DataOutputStream dos = null;
    StringBuffer responseMessage = new StringBuffer();
    // the request body
    String requeststring = "This is a POST.";
    try {
    // an HttpConnection with both read and write access
    hcon = ( HttpConnection )Connector.open( url, Connector.READ_WRITE );
    // set the request method to POST
    hcon.setRequestMethod( HttpConnection.POST );
    //hcon.setRequestProperty("Content-length", ""+ requeststring.length() );
    hcon.setRequestProperty("Content-type","application/x-www-form-urlencoded");
    //hcon.setRequestProperty("Content-language", "en-US"); // should be config.
    //hcon.setRequestProperty("Accept", "text/xml");
    //hcon.setRequestProperty("Connection", "close");
    // obtain DataOutputStream for sending the request string
    dos = hcon.openDataOutputStream();
    byte[] request_body = requeststring.getBytes();
    // send request string to server
    for( int i = 0; i < request_body.length; i++ ) {
    dos.writeByte( request_body[i] );
    }//end for( int i = 0; i < request_body.length; i++ )
    // obtain DataInputStream for receiving server response
    dis = new DataInputStream( hcon.openInputStream() );
    // retrieve the response from server
    int ch;
    while( ( ch = dis.read() ) != -1 ) {
    responseMessage.append( (char)ch );
    }//end while( ( ch = dis.read() ) != -1 ) {
    catch( Exception e )
    e.printStackTrace();
    responseMessage.append( "ERROR" );
    finally {
    // free up i/o streams and http connection
    try {
    if( hcon != null ) hcon.close();
    if( dis != null ) dis.close();
    if( dos != null ) dos.close();
    } catch ( IOException ioe ) {
    ioe.printStackTrace();
    }//end try/catch
    }//end try/catch/finally
    return responseMessage.toString();
    }//end sendHttpPost( String )
    public void pauseApp() {
    }//end pauseApp()
    public void destroyApp( boolean unconditional ) {
    // help Garbage Collector
    myDisplay = null;
    requestScreen = null;
    requestField = null;
    resultScreen = null;
    resultField = null;
    }//end destroyApp( boolean )
    }//end HttpMidlet

    Modified your code on the line:
    dos.writeByte( request_body );
    to:
    dos.write( request_body );
    and it works with 2 Microsoft IIs servers. I don't know if you ever got this working or if you went to a GET method but we were having major difficulties with IIs servers as well. I figured late was better than never for a response.

  • Error in threading

    On clicking browse I am getting
    [bold]Warning:[bold] To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler.
    Can anybody help?
    for the following code
    * MailAttachmentMidlet.java
    * Created on September 18, 2007, 12:53 PM
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.Enumeration;
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    import javax.microedition.io.file.FileConnection;
    import javax.microedition.io.file.FileSystemRegistry;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.AlertType;
    import javax.microedition.lcdui.Choice;
    import javax.microedition.lcdui.ChoiceGroup;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.List;
    import javax.microedition.lcdui.StringItem;
    import javax.microedition.lcdui.TextBox;
    import javax.microedition.lcdui.TextField;
    import javax.microedition.midlet.*;
    * @author  Sudipa
    * @version
    public class MailAttachmentMidlet extends MIDlet implements CommandListener,Runnable{
        String encodedData;
        HttpConnection conn;
       // Form mailform;
        private TextBox textattach;
        private String type=new String();
        private String agent=new String() ;
        private Display display;
        private static final String boundary = "-----------------------------" + Long.toString(System.currentTimeMillis(), 16);
        private static final String url=new String("http://localhost:8084/test/Upload2.jsp");
        private static final String[] attrList = { "Read", "Write", "Hidden" };
        private static final String[] typeList = { "Regular File", "Directory" };
        private static final String[] monthList =
            { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
        /* special string denotes upper directory */
        private static final String UP_DIRECTORY = "..";
        /* special string that denotes upper directory accessible by this browser.
         * this virtual directory contains all roots.
        private static final String MEGA_ROOT = "/";
        /* separator string as defined by FC specification */
        private static final String SEP_STR = "/";
        /* separator character as defined by FC specification */
        private static final char SEP = '/';
        private String currDirName;
        private Command upload = new Command("Upload", Command.ITEM, 1);
        private Command browse = new Command("Browse", Command.ITEM, 1);
        private Command view = new Command("View", Command.ITEM, 1);
        private Command prop = new Command("Properties", Command.ITEM, 2);
        private Command back = new Command("Back", Command.BACK, 2);
        private Command exit = new Command("Exit", Command.EXIT, 3);
        private TextField nameInput; // Input field for new file name
        private ChoiceGroup typeInput; // Input field for file type (regular/dir)
        private Image dirIcon;
        private Image fileIcon;
        private Image[] iconList;
        public MailAttachmentMidlet()
               //  encodedData=(" Content-Type: image/png�PNG  IHDR��asRGB���gAMA�? �a cHRMz&�����u0�`:�p��Q</IDAT8OE��o�Q��$������������%�? $V��\"!B$?h��/��SU�1>���L��L;)-������aA�P�����7���{�y�s���$�sR���+���/.�x��q���%6��~�]*w�I?I�1r���q?i�:��qxrN*B)��X�I�vJ�I�L�Pkp���r0��8k��4��������w��� �N��R���=��A ���^�0'����-������1�k?��I#{ ��r�'�?S�(�I|��?�Om��08�-4���R�Z�w?�\/M���� ��&ip�4��i��,�3�����7h��[x�]���7X����Mg�� �����?�.C'\MH_ ��;>^�,��^���;5�h�F.r��uHn�.�{��t��|+`���.3�?,q�@fM��J�{���!?�����hcb�s|{j?��U�G�h�>?��Yg?���������F���`�� ��9�-�v?���F������r0 &�JL���2G�%��4����> q��&y�D�� :���M����`b�L@�Ol�%���u�IEND�B`�");
        public synchronized byte[] getData(String filename)
        { byte[] b=null;
        try{
          System.out.println("file:///"+filename);
          FileConnection fc = (FileConnection)Connector.open("file:///"+filename);
          //  FileConnection fc = (FileConnection)Connector.open("file://e:/images/"+filename); 
             if(!fc.exists()) {
               Alert alert=new Alert("File do not exist");
               alert.setTimeout(Alert.FOREVER);
              display.setCurrent(alert);
             InputStream is = fc.openInputStream();
             b= new byte[(int)fc.fileSize()];
             int length = is.read(b, 0, (int)fc.fileSize());
             System.out.println
                ("Content of "+filename + ": "+ new String(b, 0, length));
          } catch (Exception e) {
             Alert alert=new Alert(e.getMessage());
               alert.setTimeout(Alert.FOREVER);
              display.setCurrent(alert);
          finally{
              return b;
    //          Enumeration filelist = fc.list("*", true);
        public void startApp() {
          startThread(); 
        public void pauseApp() {
         public void destroyApp(boolean unconditional) {
         * Show file list in the current directory .
        void showCurrDir() {
            Enumeration e;
            FileConnection currDir = null;
            List browser;
            try {
                if (MEGA_ROOT.equals(currDirName)) {
                    e = FileSystemRegistry.listRoots();
                    browser = new List(currDirName, List.IMPLICIT);
                } else {
                    currDir = (FileConnection)Connector.open("file://localhost/" + currDirName);
                    e = currDir.list();
                    browser = new List(currDirName, List.IMPLICIT);
                    // not root - draw UP_DIRECTORY
                    browser.append(UP_DIRECTORY, dirIcon);
                while (e.hasMoreElements()) {
                    String fileName = (String)e.nextElement();
                    if (fileName.charAt(fileName.length() - 1) == SEP) {
                        // This is directory
                        browser.append(fileName, dirIcon);
                    } else {
                        // this is regular file
                        browser.append(fileName, fileIcon);
                browser.setSelectCommand(view);
                //Do not allow creating files/directories beside root
                if (!MEGA_ROOT.equals(currDirName)) {
                    browser.addCommand(prop);
    //                browser.addCommand(creat);
    //                browser.addCommand(delete);
                browser.addCommand(exit);
                browser.setCommandListener(this);
                if (currDir != null) {
                    currDir.close();
                Display.getDisplay(this).setCurrent(browser);
            } catch (IOException ioe) {
                ioe.printStackTrace();
        void traverseDirectory(String fileName) {
            /* In case of directory just change the current directory
             * and show it
            if (currDirName.equals(MEGA_ROOT)) {
                if (fileName.equals(UP_DIRECTORY)) {
                    // can not go up from MEGA_ROOT
                    return;
                currDirName = fileName;
            } else if (fileName.equals(UP_DIRECTORY)) {
                // Go up one directory
                // TODO use setFileConnection when implemented
                int i = currDirName.lastIndexOf(SEP, currDirName.length() - 2);
                if (i != -1) {
                    currDirName = currDirName.substring(0, i + 1);
                } else {
                    currDirName = MEGA_ROOT;
            } else {
                currDirName = currDirName + fileName;
            showCurrDir();
        void showFile(String fileName) {
            try {
                FileConnection fc =
                    (FileConnection)Connector.open("file://localhost/" + currDirName + fileName);
                if (!fc.exists()) {
                    throw new IOException("File does not exists");
                InputStream fis = fc.openInputStream();
                byte[] b = new byte[1024];
                int length = fis.read(b, 0, 1024);
                fis.close();
                fc.close();
                TextBox viewer =
                    new TextBox("View File: " + fileName, null, 1024,
                        TextField.ANY | TextField.UNEDITABLE);
                viewer.addCommand(back);
                viewer.addCommand(exit);
                viewer.setCommandListener(this);
                if (length > 0) {
                    viewer.setString(new String(b, 0, length));
                Display.getDisplay(this).setCurrent(viewer);
            } catch (Exception e) {
                Alert alert =
                    new Alert("Error!",
                        "Can not access file " + fileName + " in directory " + currDirName +
                        "\nException: " + e.getMessage(), null, AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                Display.getDisplay(this).setCurrent(alert);
    void showProperties(String fileName) {
            try {
                if (fileName.equals(UP_DIRECTORY)) {
                    return;
                FileConnection fc =
                    (FileConnection)Connector.open("file://localhost/" + currDirName + fileName);
                if (!fc.exists()) {
                    throw new IOException("File does not exists");
                Form props = new Form("Properties: " + fileName);
                ChoiceGroup attrs = new ChoiceGroup("Attributes:", Choice.MULTIPLE, attrList, null);
                attrs.setSelectedFlags(new boolean[] { fc.canRead(), fc.canWrite(), fc.isHidden() });
                props.append(new StringItem("Location:", currDirName));
                props.append(new StringItem("Type: ", fc.isDirectory() ? "Directory" : "Regular File"));
                props.append(new StringItem("Modified:", myDate(fc.lastModified())));
                props.append(attrs);
                props.addCommand(back);
                props.addCommand(exit);
                props.setCommandListener(this);
                fc.close();
                Display.getDisplay(this).setCurrent(props);
            } catch (Exception e) {
                Alert alert =
                    new Alert("Error!",
                        "Can not access file " + fileName + " in directory " + currDirName +
                        "\nException: " + e.getMessage(), null, AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                Display.getDisplay(this).setCurrent(alert);
       private String myDate(long time) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(new Date(time));
            StringBuffer sb = new StringBuffer();
            sb.append(cal.get(Calendar.HOUR_OF_DAY));
            sb.append(':');
            sb.append(cal.get(Calendar.MINUTE));
            sb.append(':');
            sb.append(cal.get(Calendar.SECOND));
            sb.append(',');
            sb.append(' ');
            sb.append(cal.get(Calendar.DAY_OF_MONTH));
            sb.append(' ');
            sb.append(monthList[cal.get(Calendar.MONTH)]);
            sb.append(' ');
            sb.append(cal.get(Calendar.YEAR));
            return sb.toString();
      public void run()
        display=Display.getDisplay(this);
    //        mailform= new Form("Attachment");
            textattach=new TextBox("Attachment","",100,TextField.ANY);
            upload=new Command("Upload",Command.SCREEN,1);
    //        mailform.append(textattach);
            textattach.addCommand(upload);
            textattach.addCommand(browse);
            textattach.setCommandListener(this);
            display.setCurrent(textattach); 
      public void startThread()
                Thread th=new Thread(this);
                th.run();
        public void commandAction(Command command,Displayable displayable)
            if(command==browse)
               currDirName = MEGA_ROOT;
            try {
                dirIcon = Image.createImage("/icons/dir.png");
            } catch (IOException e) {
                dirIcon = null;
            try {
                fileIcon = Image.createImage("/icons/file.png");
            } catch (IOException e) {
                fileIcon = null;
            iconList = new Image[] { fileIcon, dirIcon };
            try {
                showCurrDir();
            } catch (SecurityException e) {
                Alert alert =
                    new Alert("Error", "You are not authorized to access the restricted API", null,AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                Form form = new Form("Cannot access FileConnection");
                form.append(new StringItem(null,"You cannot run this MIDlet with the current permissions. Sign the MIDlet suite, or run it in a different security domain"));
                form.addCommand(exit);
                form.setCommandListener(this);
                Display.getDisplay(this).setCurrent(alert, form);
            } catch (Exception e) {
                e.printStackTrace();
         else   if(command==upload)
               if(!textattach.getString().equals(""))
             {try {type=new String("image/png");
               encodedData=new String(getData(textattach.getString()));  
                conn = (HttpConnection) Connector.open( url,Connector.READ_WRITE );
                conn.setRequestMethod( HttpConnection.POST );
    //          conn.setRequestProperty( "User-Agent", agent );
                conn.setRequestProperty( "Content-Type", type );
                conn.setRequestProperty( "Content-Length",new Integer(encodedData.length()).toString());
                OutputStream os = conn.openOutputStream();         
                System.out.println("success");
                String HeaderStr=boundary+new String(" Content-Disposition: form-data; name=\"uname\" fsdgfs ")+boundary+new String(" Content-Disposition: form-data; name=\"upfile\"; filename=\"_suite_8.png\" Content-Type: image/png");
                String FooterStr=new String(" ")+boundary+new String("--")+new String("\r\n");
                System.out.println((HeaderStr+""+ encodedData.trim()+FooterStr).getBytes());
                os.write((HeaderStr+""+ encodedData+FooterStr).getBytes());
                os.close();
                int rc = conn.getResponseCode();
               textattach.setString("");
            } catch (IOException ex) {
               Alert alert=new Alert(ex.getMessage());
               alert.setTimeout(Alert.FOREVER);
              display.setCurrent(alert);
        }else if (command == view) {
                List curr = (List)displayable;
                final String currFile = curr.getString(curr.getSelectedIndex());
                new Thread(new Runnable() {
                        public void run() {
                            if (currFile.endsWith(SEP_STR) || currFile.equals(UP_DIRECTORY)) {
                                traverseDirectory(currFile);
                            } else {
                                // Show file contents
                                showFile(currFile);
                    }).start();
            } else if (command == prop) {
                List curr = (List)displayable;
                String currFile = curr.getString(curr.getSelectedIndex());
                showProperties(currFile);
         else if (command == back) {
                showCurrDir();
            } else if (command == exit) {
                destroyApp(false);
    //        else if (command == delete) {
    //            List curr = (List)d;
    //            String currFile = curr.getString(curr.getSelectedIndex());
    //            executeDelete(currFile);
    }

    {color:#000080}This article explains it far better than I could even attempt to ;-){color}
    http://developers.sun.com/mobility/midp/articles/threading/
    {color:#000080}db{color}

  • How to install and use certificates on client?

    Hello everyone, and first of all sorry for my poor, italian-accented english.
    I have some questions about SSL and certificates. I'm developing a java desktop application, which should connect to a https server, authenticate with a previously downloaded certificate and then gain access. Some specs: I work on a Windows Xp Pro machine with Netbeans 6.1 and jdk 1.6.0_07.
    Now, I'm using HttpUnit libraries to connect the first time, login with basic authentication and download the certificate, but after i get it I'm not sure how to install the certificate (using java, it has to be an automated procedure) on the client machine and then how to use it to connect to the server. I've tried to use the code I've found here and after using it I can see the certificate inside Control Panel > Java > Securiy > Certificates > System, but I'm not sure I'm installing it in the correct way and/or in the correct path.
    Everytime I try to connect to the server I get back a HTTP 403 forbidden exception. Does someone know any tutorials/howtos/example codes to suggest to me? Or could tell me what's the right installation procedure using java? Any help would be very appreciated.
    Thanks in advance
    K.

    After banging my head on my keyboard for a lot of hours, I've got it!
    I was trying to install a *.pfx certificate, and that was bad. I tried to convert it in *.p12 or *.cer but that workaround didn't work. Finally I've found a small code to use a *.pfx certificate without installing it and... it works! No more 403 errors now, I can get that damn page. :)
    Here is the class I've used (I've found it somewhere googling around but I've lost the link, sorry. Anyway, I've modified it a little)
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.net.*;
    import java.security.KeyStore;
    import javax.net.*;
    import javax.net.ssl.*;
    public class ConnectWithPfx {
       static final int HTTPS_PORT = 443;
       public static void main(String argv[]) throws Exception {
          // Get a Socket factory
          SocketFactory factory = SSLSocketFactory.getDefault();
          SSLSocketFactory socketFactory = null;
          try {
                KeyStore keyStoreKeys;
                KeyManagerFactory keyMgrFactory;
                SSLContext sslContext;
                keyStoreKeys = KeyStore.getInstance("PKCS12");               
                keyStoreKeys.load(new FileInputStream("mycertificate.pfx"),"certpassword".toCharArray());
                keyMgrFactory = KeyManagerFactory.getInstance("SunX509");
                keyMgrFactory.init(keyStoreKeys, "certpassword".toCharArray());
                sslContext = SSLContext.getInstance("SSL");
                sslContext.init(keyMgrFactory.getKeyManagers(), null, null);
                socketFactory = sslContext.getSocketFactory();
                Socket socket2 = factory.createSocket("www.my.host", HTTPS_PORT);
          } catch (Exception e) {
                e.printStackTrace();
            URL url = new URL("https://www.my.host/mypage");      
            // Open a HTTP connection to the URL assigning the SocketFactory we created before
            HttpsURLConnection conn = null;
            conn.setDefaultSSLSocketFactory(socketFactory);
            conn = (HttpsURLConnection) url.openConnection();              
            // Allow Inputs
            conn.setDoInput(true);
            // Allow Outputs
            conn.setDoOutput(true);
            // Don't use a cached copy.
            conn.setUseCaches(false);
            conn.setRequestProperty("Connection", "Keep-Alive");
            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String response = "";
            while ((line = in.readLine()) != null) {
                response += line+"\n";
            System.out.println(response);
    }Hope this could be useful for someone else. Thanks to everyone who read or replied to my thread. :)

  • Error trying to create https connection from Web Dynpro

    Hi experts!!
    I am trying to create a WD view with an actionButton and a form template, when the user fills the data in the form and presses the button, i want to create an Https connect and post some parameters to the URL.
    HttpsURLConnection cannot be resolved,
    com.sun.net.ssl.internal.ssl.Provider() does't not exist in the package com.sun.net.ssl.internal.ssl.Provider()
    do i need to add any jars?? I've already added the jsse.jar
    The code i use is the following.
    private void sendHttp(){
          String response = "";
          HttpsURLConnection connection = null;
          try {
                      System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
                      java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
                      URL url = new URL(<your_url>);
                      connection = (HttpsURLConnection) url.openConnection();
                      connection.setDoInput(true);
                      connection.setDoOutput(true);
                      connection.setAllowUserInteraction(true);
                      connection.setUseCaches(false);
                }     catch(Exception e) {
                      response = response +  "Error in getting connection: " ;
                      response = response +  e ;
                if (connection != null){
                      try {
                            connection.setRequestMethod("POST");
                            connection.setFollowRedirects(true);
                            //build all the parameters into 1 string
                            String query = "parameter1name=" + URLEncoder.encode(parameter1value);
                                  query += "&";
                                  query += "parameter2name=" + URLEncoder.encode(parameter2value);
                            connection.setRequestProperty("Content-length",String.valueOf (query.length()));
                            connection.setRequestProperty("Content-Type","application/x-www- form-urlencoded");
                            connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)");
                            // open up the output stream of the connection
                            DataOutputStream output = new DataOutputStream( connection.getOutputStream() );
                            // write out the data
                            int queryLength = query.length();
                            output.writeBytes( query );
                            output.close();
                            //if responsecode <> 200 you should stop: should always be 200
                            String responsecode = connection.getResponseCode();
                            if (responsecode.equalsIgnoreCase("200")){
                                  String inputLine;
                                  StringBuffer input = new StringBuffer();
                                  BufferedReader in =     new BufferedReader(     new InputStreamReader(connection.getInputStream()));
                                                                                    //Get site response
                                  while ((inputLine = in.readLine()) != null) {
                                        input.append(inputLine);
                                  in.close();
                                  response = response + input.toString();
                      }     catch(Exception e) {
                          response = response +  "Error in using connection: " ;
                          response = response +  e ;
              wdContext.currentContextElement().setResponse(response);

    Hai ,
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/526bd490-0201-0010-038e-d3ff7eb1d16e
    please check above link .
    application server u have take load balancing click on next  there u take click on radio button of Msg server .
    Regards ,
    venkat

  • JRE freeze when loading applet twice, through VSAT network

    Here is a good one for you guys I think ...
    ===========
    What I got:
    ===========
    I have a java web application, runing with Tomcat 5.5.
    I use a Apache HTTP Server 2.0.52 for my statiques ressources (html, etc ...), and the modjk connector 1.2.13 to forward all the dynamic requests from the client to the application server.
    One of my html pages contains a signed java applet.
    Basically, this applet control a scanner and send the scanned image to the web application server.
    This applet:
    - use some swing components
    - use the netscape.javascript.JSObject to call javascript functions
    - use the morena API (which include a native library) in order to control a TWAIN scanner
    - format the scanned image into a JPEG image
    - send the formatted image to the web server, using an HttpURLConnection
    (I use a servlet on server side to get the uploaded image)
    - wait for the server response, that tells my applet if the upload has been successfull or not
    Some additional infos:
    - I use morena 6.2.0.0
    - I use JRE 1.5.0.0.1 to run the applet
    - JRE on client side is configured as follow:
    - no applet caching
    - network parameters: "use the browser parameters"
    ==============
    My problem is:
    ==============
    - Through a LAN network, the applet works perfectly ...
    - Through an internet network (I use a VSAT / IDIRECT network), I can load and run my applet the first time
    but when I try to run my applet for the second time (without closing the browser), it just doesn't start, and the JRE crash
    (i.e. the java console freeze ..., just like if it was waiting for something ...)
    nothing happen after that, and I have to kill my JRE / Browser
    the funny stuff about it is that the applet works fine (even through VSAT network) when I don't upload the scanned image on the server
    load and run ok as many time as I want ...
    => seems that something's going wrong during the uploading process
    ==========================
    What I have already tried:
    ==========================
    1/ getting rid of the Java - Javascript communication (JSObject seems to have heaps of bugs ...)
    => no changes
    2/ be careful to close correctly my HttpURLConnection, with a HttpURLConnection.disconnect()
    => no changes
    3/ put the morena jars directly on the client side (in the lib/ext directory of the JRE):
    the morena API use a native library, and apparently, a native library can not be loaded by 2 different ClassLoader
    just to avoid any "java.lang.UnsatisfiedLinkError"
    as shown on http://forum.java.sun.com/thread.jspa?forumID=31&threadID=628889
    => no changes
    4/ have a closer look on the http apache server, just to get rid of the error
    "OS 64)The specified network name is no longer available. : winnt_accept: Asynchronous AcceptEx failed."
    as shown on the bug 21425 in http://issues.apache.org/bugzilla/show_bug.cgi?id=21425
    => no changes
    5/ use the upgrade version 1.5.0.6 of the JRE
    => no changes
    ==========
    ANY HELP ?
    ==========
    and as usual, I had to fix this problem for yesterday ... :)))
    Any ideas about that ?
    need more infos ?: just let me know
    ======================================================================================
    Here is the piece of code I use to upload the image from the client to the web server:
    ======================================================================================
    * Upload de cette image sur le serveur, apr�s passage au format JPEG
    * @param imageSelectionnee BufferedImage image � transf�rer
    * @throws ComposantNumerisationException exception pouvant etre lev� lors de l'upload
    public void uploadImage(BufferedImage imageSelectionnee)
        throws ComposantNumerisationException {
        // connexion http au server
        HttpURLConnection connexionServer = null;
        // flux de sortie, permettant d'envoyer les donn�es vers le serveur
        OutputStream fluxSortie = null;
        // parametres pour le libelle de l'exception
        ParametresProprietes parametres = null;
        // flux d'entr�e, pour lire la r�ponse du serveur
        BufferedReader fluxEntree = null;
        // r�ponse du serveur
        String reponseServeur = null;
        // image au format JPEG
        BufferedImage imageFormatJPEG = null;
        try {
            /* conversion de l'image au format JPEG */
            imageFormatJPEG = this.formatterImage(imageSelectionnee);
            /* ouverture d'une connexion vers le serveur */
            connexionServer = this.ouvrirConnexion(imageFormatJPEG);
            /* ecriture des donn�es dans le flux de sortie, vers le serveur */
            // cr�ation d'un outputStream
            fluxSortie = connexionServer.getOutputStream();
            // transfert des donn�es vers le serveur
            ImageIO.write(imageFormatJPEG, Constantes.TYPE_IMAGE, fluxSortie);
            fluxSortie.flush();
            /* lecture de la r�ponse du serveur */
            // cr�ation d'un flux de lecture sur le flux d'entr�e
            fluxEntree = new BufferedReader(new InputStreamReader(
                                                connexionServer.getInputStream()));
            // lecture de la r�ponse du serveur
            reponseServeur = fluxEntree.readLine();
            // v�rification du succes de l'upload, en fonction de la r�ponse du serveur
            if (!reponseServeur.startsWith("REPONSE")) {
                /* cas ou le message retour ne commence pas par "REPONSE":
                 * ce n'est pas la r�ponse de la servlet
                 *  => Tomcat nous a redirig� vers la page d'authentification */
                fenetreNumerisation.redirigerFenetreAuthentification();
            } else if (reponseServeur.compareTo("REPONSE:OK") != 0) {
                // la r�ponse du serveur indique qu'il y a eu un probl�me lors de l'upload
                throw new IOException(reponseServeur);
        } catch (IOException e) {
            // cr�ation des parametres pour ce libelle d'erreurs
            parametres = new ParametresProprietes();
            parametres.ajouterParametre("0", e.toString());
            throw new ComposantNumerisationException(
                    proprietes.getPropriete("ERREUR_UPLOAD", null),
                    proprietes.getPropriete("ERREUR_UPLOAD_TECH", parametres),
                    ComposantNumerisationException.ERREUR_NON_BLOCANTE);
        } finally {
            try {
                // fermeture de ce flux de sortie
                if (null != fluxSortie) {
                    fluxSortie.close();
                // fermeture du flux de lecture de la reponse
                if (null != fluxEntree) {
                    fluxEntree.close();
            } catch (IOException e) {
            // fermeture de la connexion
            if (null != connexionServer) {
                connexionServer.disconnect();
    * Ouverture d'une connexion vers la servlet d'upload de l'image
    * @param image BufferedImage image � transf�rer
    * @return HttpURLConnection une connexion http
    * @throws IOException exception IO
    * @throws ComposantNumerisationException exception
    private HttpURLConnection ouvrirConnexion(BufferedImage image)
        throws IOException, ComposantNumerisationException {
        // url du server
        URL urlServer = null;
        // connexion http au server
        HttpURLConnection connexionServer = null;
        // signature
        String signature = null;
        // g�n�ration de la signature de l'image � transf�rer
        signature = this.genererSignatureImage(image);
        // construction de l'url du serveur � appeler pour cet upload
        // en incluant un parametre pour transmettre la signature de l'image � transf�rer
        // + identifiant du passeport d'urgence courant
        urlServer = new URL(this.urlServeur + this.action +
                            "?" + Constantes.PARAM_SIGNATURE_IMAGE + "=" + signature +
                            "&" + Constantes.PARAM_IDDEMANDE + "=" + idDemande +
                            "&" + Constantes.PARAM_CODEMAJ + "=" + codeMaj +
                            "&" + Constantes.PARAM_TYPEDEMANDE + "=" + typeDemande);
        if (null == urlServer) {
            throw new IOException(proprietes.getPropriete(
                                "ERREUR_UPLOAD_CREATION_URL_SERVEUR", null));
        // ouverture d'une connexion http, gr�ce a cette url du server
        connexionServer = (HttpURLConnection) urlServer.openConnection();
        if (null == connexionServer) {
            throw new IOException(proprietes.getPropriete(
                    "ERREUR_UPLOAD_OUVERTURE_CONNEXION_SERVEUR", null));
        // param�trage de cette connexion
        // m�thode de transmission = POST
        connexionServer.setRequestMethod("POST");
        // autorisation de lire les donn�es venant du serveur
        connexionServer.setDoInput(true);
        // autorisation d'�crire des donn�es vers le serveur                         
        connexionServer.setDoOutput(true);
        // pas d'utilisation de caches
        connexionServer.setUseCaches(false);
        connexionServer.setDefaultUseCaches(false);
        // sp�cification du type des donn�es que l'on envoie vers le serveur
        connexionServer.setRequestProperty("content-type", "img/jpeg");
        return connexionServer;
    }=======================================================================================
    Here is the piece of code I use on server side to get the scaned image from the client:
    =======================================================================================
    * Lecture des donn�es en provenance de l'applet
    * @param request HttpServletRequest
    * @return ByteArrayOutputStream buffer contenant les donn�es lues
    * @throws TechnicalException exception
    * @throws FunctionalException si erreur fonctionnelle
    private ByteArrayOutputStream lireDonnees(HttpServletRequest request)
        throws FunctionalException, TechnicalException {
        // stream de sortie sur l'image
        ByteArrayOutputStream baos = null;
        // id du passeport d'urgence au format Integer
        // image issue de l'applet
        BufferedImage image = null;
        try {
            /* r�cup�ration de l'image */
            image = ImageIO.read(request.getInputStream());
            if (null == image) {
                logger.error(THIS_CLASS + Libelles.getLibelle("ERR-TEC-16", null));
                throw new TechnicalException(new ErreurVO("ERR-TEC-16",
                        null, "", true, false, false));
        } catch (IllegalArgumentException e) {
            logger.error(THIS_CLASS + Libelles.getLibelle("ERR-TEC-13", null));
            throw new TechnicalException(new ErreurVO("ERR-TEC-13",
                    null, "", true, false, false));
        } catch (IOException e) {
            logger.error(THIS_CLASS + Libelles.getLibelle("ERR-TEC-16", null));
            throw new TechnicalException(new ErreurVO("ERR-TEC-16",
                    null, "", true, false, false));
        return baos;
    * Ecriture de la reponse � envoyer � l'applet
    * @param response HttpServletResponse
    * @param erreur Message d'erreur
    * @throws IOException exception
    private void ecrireReponse(HttpServletResponse response, String erreur) throws IOException {
        // r�ponse � envoyer � l'applet
        String reponseServer = null;
        // flux de reponse
        PrintWriter fluxReponse = null;
        response.setContentType("text/html");
        // construction de la r�ponse � envoyer � l'applet
        if (null == erreur) {
            reponseServer = "REPONSE:OK";
        } else {
            /* cas ou il y a eu une exception lev�e lors de la reception des donn�es */
            reponseServer = "REPONSE:ERREUR:" + erreur;
        if (logger.isDebugEnabled()) {
            logger.debug(THIS_CLASS +
                    "Envoie de la r�ponse � l'applet, indiquant si l'upload s'est bien d�roul�: " +
                    reponseServer);
        //envoie de la r�ponse a l'applet
        fluxReponse = response.getWriter();
        fluxReponse.println(reponseServer);
        fluxReponse.close();
    }==============================================================================
    here is the traces I get when the applet doesn't work, through a VSAT network:
    ==============================================================================
    Java Plug-in 1.5.0_01
    Utilisation de la version JRE 1.5.0_01 Java HotSpot(TM) Client VM
    R�pertoire d'accueil de l'utilisateur = C:\Documents and Settings\assistw
    network: Chargement de la configuration du proxy d�finie par l'utilisateur ...
    network: Termin�.
    network: Chargement de la configuration du proxy � partir de Netscape Navigator ...
    network: Erreur lors de la lecture du fichier de registre : C:\Documents and Settings\assistw\Application Data\Mozilla\registry.dat
    network: Termin�.
    network: Chargement de la configuration proxy du navigateur ...
    network: Termin�.
    network: Configuration du proxy : Configuration du proxy du navigateur
    basic: Le cache est d�sactiv� par l'utilisateur
    c:   effacer la fen�tre de la console
    f:   finaliser les objets de la file d'attente de finalisation
    g:   lib�rer la m�moire
    h:   afficher ce message d'aide
    l:   vider la liste des chargeurs de classes
    m:   imprimer le relev� d'utilisation de la m�moire
    o:   d�clencher la consignation
    p:   recharger la configuration du proxy
    q:   masquer la console
    r:   recharger la configuration des politiques
    s:   vider les propri�t�s syst�me et d�ploiement
    t:   vider la liste des threads
    v:   vider la pile des threads
    x:   effacer le cache de chargeurs de classes
    0-5: fixer le niveau de tra�age � <n>
    basic: R�cepteur de modalit�s enregistr�
    basic: R�f�rence au chargeur de classes : sun.plugin.ClassLoaderInfo@b30913, refcount=1
    basic: R�cepteur de progression ajout� : sun.plugin.util.GrayBoxPainter@77eaf8
    basic: Chargement de l'applet...
    basic: Initialisation de l'applet...
    basic: D�marrage de l'applet...
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/SAppletNumerisation.jar avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/SAppletNumerisation.jar avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    security: Acc�s aux cl�s et au certificat dans le profil utilisateur Mozilla : null
    security: Chargement des certificats AC racine depuis C:\PROGRA~1\Java\JRE15~1.0_0\lib\security\cacerts
    security: Certificats AC racine charg�s depuis C:\PROGRA~1\Java\JRE15~1.0_0\lib\security\cacerts
    security: Chargement des certificats JPI depuis C:\Documents and Settings\assistw\Application Data\Sun\Java\Deployment\security\trusted.certs
    security: Certificats JPI charg�s depuis C:\Documents and Settings\assistw\Application Data\Sun\Java\Deployment\security\trusted.certs
    security: Chargement des certificats JPI depuis C:\PROGRA~1\Java\JRE15~1.0_0\lib\security\trusted.certs
    security: Certificats JPI charg�s depuis C:\PROGRA~1\Java\JRE15~1.0_0\lib\security\trusted.certs
    security: Chargement des certificats depuis la zone de stockage des certificats de session JPI
    security: Certificats charg�s depuis la zone de stockage des certificats de session JPI
    security: Recherche du certificat dans le magasin de certificats permanent JPI
    security: Recherche du certificat dans la zone de stockage des certificats de session JPI
    security: Obtenir l'objet de stockage des cl�s de la zone de stockage des certificats AC racine
    security: Obtenir l'objet de stockage des cl�s de la zone de stockage des certificats AC racine
    security: Recherche du certificat dans la zone de stockage des certificats AC racine
    security: D�terminer si le certificat peut �tre v�rifi� � l'aide des certificats de la zone de stockage des certificats AC racine
    ... [check certifications]
    sun.misc.Launcher$ExtClassLoader@92e78c
    <no principals>
    java.security.Permissions@157b46f (
    (java.lang.RuntimePermission stopThread)
    (java.security.AllPermission <all permissions> <all actions>)
    (java.io.FilePermission \C:\Program Files\Java\jre1.5.0_01\lib\ext\sunjce_provider.jar read)
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.specification.vendor read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission line.separator read)
    (java.net.SocketPermission localhost:1024- listen,resolve)
    ... [check certifications]
    security: La v�rification du certificat � l'aide des certificats AC racine a �chou�
    security: Aucune information d'horodatage disponible
    basic: Modalit� empil�e
    basic: Modalit� d�sempil�e
    basic: Utilisateur s�lectionn� : 0
    security: L'utilisateur a accord� les droits d'acc�s au code pour cette session seulement
    security: Ajout du certificat dans la zone de stockage des certificats de session JPI
    security: Certificat ajout� dans la zone de stockage des certificats de session JPI
    security: Enregistrement des certificats dans la zone de stockage des certificats de session JPI
    security: Certificats enregistr�s dans la zone de stockage des certificats de session JPI
    ... [check certifications]
    sun.plugin.security.PluginClassLoader@10fe2b9
    <no principals>
    java.security.Permissions@fe315d (
    (java.lang.RuntimePermission accessClassInPackage.sun.audio)
    (java.lang.RuntimePermission stopThread)
    (java.security.AllPermission <all permissions> <all actions>)
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission javaplugin.version read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.specification.vendor read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission browser.vendor read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission browser.version read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission browser read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission http.agent read)
    (java.util.PropertyPermission line.separator read)
    (java.net.SocketPermission rma_phileas connect,accept,resolve)
    (java.net.SocketPermission localhost:1024- listen,resolve)
    ... [check certifications]
    sun.misc.Launcher$ExtClassLoader@92e78c
    <no principals>
    java.security.Permissions@bd09e8 (
    (java.lang.RuntimePermission stopThread)
    (java.security.AllPermission <all permissions> <all actions>)
    (java.io.FilePermission \C:\Program Files\Java\jre1.5.0_01\lib\ext\Smorena.jar read)
    (java.util.PropertyPermission java.version read)
    (java.util.PropertyPermission java.vm.name read)
    (java.util.PropertyPermission java.vm.vendor read)
    (java.util.PropertyPermission os.name read)
    (java.util.PropertyPermission java.vendor.url read)
    (java.util.PropertyPermission java.vm.specification.vendor read)
    (java.util.PropertyPermission java.specification.vendor read)
    (java.util.PropertyPermission os.version read)
    (java.util.PropertyPermission java.specification.name read)
    (java.util.PropertyPermission java.class.version read)
    (java.util.PropertyPermission file.separator read)
    (java.util.PropertyPermission java.vm.version read)
    (java.util.PropertyPermission os.arch read)
    (java.util.PropertyPermission java.vm.specification.name read)
    (java.util.PropertyPermission java.vm.specification.version read)
    (java.util.PropertyPermission java.specification.version read)
    (java.util.PropertyPermission java.vendor read)
    (java.util.PropertyPermission path.separator read)
    (java.util.PropertyPermission line.separator read)
    (java.net.SocketPermission localhost:1024- listen,resolve)
    scl:
    Morena - Image Acquisition Framework version 6.2.0.0.
    Copyright (c) Gnome s.r.o. 1999-2004. All rights reserved.
    Licensed to "XXX".
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageInputStreamSpi avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageInputStreamSpi avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageTranscoderSpi avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageTranscoderSpi avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageReaderSpi avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageReaderSpi avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageWriterSpi avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/META-INF/services/javax.imageio.spi.ImageWriterSpi avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    network: Connexion de http://rma_phileas/Client/flux/protected/uploadimage.do?signature=c07690c12904320a253cbdeeded59238&idDemande=7&codeMaj=1133967329473&typeDemande=PU avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/flux/protected/uploadimage.do?signature=c07690c12904320a253cbdeeded59238&idDemande=7&codeMaj=1133967329473&typeDemande=PU avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"
    basic: Arr�t de l'applet...
    basic: R�cepteur de progression supprim� : sun.plugin.util.GrayBoxPainter@77eaf8
    basic: Jonction du thread d'applet...
    basic: Destruction de l'applet...
    basic: Elimination de l'applet...
    basic: Sortie de l'applet...
    basic: Thread d'applet joint...
    basic: R�cepteur de modalit�s non enregistr�
    basic: Recherche d'informations...
    basic: Lib�ration du chargeur de classes : sun.plugin.ClassLoaderInfo@b30913, refcount=0
    basic: Mise en cache du chargeur de classes : sun.plugin.ClassLoaderInfo@b30913
    basic: Taille de cache du chargeur de classes courant : 1
    basic: Termin�...
    basic: R�cepteur de modalit�s enregistr�
    basic: R�f�rence au chargeur de classes : sun.plugin.ClassLoaderInfo@b30913, refcount=1
    basic: R�cepteur de progression ajout� : sun.plugin.util.GrayBoxPainter@1e16483
    basic: Chargement de l'applet...
    basic: Initialisation de l'applet...
    basic: D�marrage de l'applet...
    network: Connexion de http://rma_phileas/Client/html/composants/scanner/SAppletNumerisation.jar avec proxy=DIRECT
    network: Connexion http://rma_phileas/Client/html/composants/scanner/SAppletNumerisation.jar avec cookie ":::langueSettings:::=FR; :::menuSettings_gabaritMaquette:::=%3CSETTINGS%3E%3CVERSION%3EVersion%201.2-Utilisateur%3C/VERSION%3E%3CINDEX_ITEM1%3E0%3C/INDEX_ITEM1%3E%3CINDEX_ITEM2%3E0%3C/INDEX_ITEM2%3E%3CINDEX_ITEM3%3Enull%3C/INDEX_ITEM3%3E%3C/SETTINGS%3E; JSESSIONID=D064486FD6C7CC17E7B256B66965FFEE"

    A workaround would be: don't use IE9. You want a solution, not a workaround.
    I think at this juncture you are best of creating a new bug report and be sure to reference the old closed one. It doesn't look entirely related though, your symptoms are different from what is described in it (freeze VS a crash). You tried this on several systems right? Also on machines on a different network?
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7072601

Maybe you are looking for

  • How do I use multiple local workspaces for the same website in VS2013?

    For quite some time I've been using VS2010 with multiple workspaces mapped from the same TFS branch to test different variants of a website in parallel. The internal web server (Cassini) seems quite happy to run multiple versions and simply maps a ne

  • Multiple monitor UI bugs in CC 2014/Mavericks

    I have two new bugs that I'm seeing since the 2014 update.  I'm running 10.9.4, and use two monitors, one for my images, and another for all of my palettes (less, of course, my beloved custom panel created in the now deprecated Configurator). When I

  • How to convert Oracle reports into excel?

    How can we convert Oracle reports into excel. i know there was a thread on this topic which i am not able to find. give the link / help.

  • Change the resolution of stretch screen when playing films on itunes.

    I buy all my films on iTunes, and love the service. But the majority of films on iTunes are for widescreen, which my computer and TV are. When I plug my pc into the TV the film plays and just about half of the screen- a quarter of it black at the top

  • Regarding RFC to FIle

    Hi Everyone, Would anyone Please give me steps for  RFC to File Scenario. Thanks & Regards, Varun