Results 1 to 9 of 9

Thread: Usage of HTTPS

  1. #1
    Sayed is offline Member
    Join Date
    Jan 2008
    Posts
    18
    Rep Power
    0

    Default Usage of HTTPS

    Hi, can somebody help me how to upload a file using HTTPS POST?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    Sayed is offline Member
    Join Date
    Jan 2008
    Posts
    18
    Rep Power
    0

    Default

    Yes i have done little bit search on Google it is telling about JSSE(Java Secure Socket Extensions) i just want the steps that i need to do so that i can send Https requets to server

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  5. #5
    Sayed is offline Member
    Join Date
    Jan 2008
    Posts
    18
    Rep Power
    0

    Default

    Could you please brief me basic steps that we have to fallow on both the side Server side as well as Client side

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  7. #7
    Sayed is offline Member
    Join Date
    Jan 2008
    Posts
    18
    Rep Power
    0

    Default

    Right now i need some help to create SSL connection between client and server.

  8. #8
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    6

    Default

    Are you writing the client? or the server?

    This is well documented. What have you done so far (if anything)?
    What specific problems are you having?

    This is not a forum for finding packaged answers. We will help, but not do your homework. You learn nothing from cheating.

  9. #9
    w3user is offline Member
    Join Date
    Dec 2008
    Posts
    6
    Rep Power
    0

    Default

    Use apache httpclient APIs
    Note: when uploading to https web server, the web server's "public key certificate" should be present in the client machine's JRE's keystore file.
    normally present in <jdkhome>\jre\lib\security\cacerts
    here cacerts file is the keystore file
    you need to import the certificate into this keystore file using keytool command


    sample code;
    import org.apache.commons.httpclient.HttpClient;
    import org.apache.commons.httpclient.methods.PostMethod;

    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;

    public class PostAFile {
    private static String url =
    "url to server, where you want to upload file";

    public static void main(String[] args) throws IOException {
    HttpClient client = new HttpClient();
    PostMethod postMethod = new PostMethod(url);

    client.setConnectionTimeout(8000);

    // Send any XML file as the body of the POST request
    File f = new File("students.xml");
    System.out.println("File Length = " + f.length());

    postMethod.setRequestBody(new FileInputStream(f));
    postMethod.setRequestHeader("Content-type",
    "text/xml; charset=ISO-8859-1");

    int statusCode1 = client.executeMethod(postMethod);

    System.out.println("statusLine>>>" + postMethod.getStatusLine());
    postMethod.releaseConnection();
    }
    }


    refer to: theserverside.com/tt/articles/article.tss?l=HttpClient_FileUpload

Similar Threads

  1. https client
    By karine in forum Advanced Java
    Replies: 6
    Last Post: 10-31-2008, 12:41 PM
  2. HTTPS using certificate
    By MCJP in forum Advanced Java
    Replies: 1
    Last Post: 09-25-2008, 01:48 PM
  3. JVM memory usage
    By lardum in forum New To Java
    Replies: 7
    Last Post: 06-26-2008, 03:30 AM
  4. JDK 1.3 with HTTPS
    By sriram in forum Advanced Java
    Replies: 2
    Last Post: 01-21-2008, 10:51 PM
  5. HTTPS and JBoss
    By Heather in forum Advanced Java
    Replies: 2
    Last Post: 06-30-2007, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •