URLConnection and getOutputStream()

This is not a question, but more of a rant.
I'm writing an application which keeps data files in the same folder or sub-folders as itself. Obviously, it will read from and write to these files.
I cannot just specify the file name (using only the path from the app directory onward), because the working directory might be different - it depends upon the user and how 'clever' he/she is being. If so, the file will not exist, of course.
So I use the old getClass().getResource() approach. To get an InputStream from this is fine. However,trying to get an OutputStream (using getClass().getResource().openConnection().getOutputStream()) returns a java.net.UnknownServiceException, with a message telling me 'protocol doesn't support output'. What? URLConnection can't write to normal files? Doesn't seem to make sense...
And I certainly cannot use new FileOutputStream(getClass().getResource().getFile()); because this will return a Standard formatted URL, i.e. the spaces in the path will be %20, etc. But because SUN have not re-opened the bug on this (I forget the bug id at the moment) the getFile() method does not actually return a valid File. This would be no problem if the user installs to a path with no spaces, but I don't see why they should have to, as most people are used to this from windows.
The major problem I have with deploying applications is how to make them 'user-proof'. Forget the 'do I use an executable jar' or 'how do I make an exe from my jar' questions. This is far more irritating to figure out.
grr

And I certainly cannot use
newFileOutputStream(getClass().getResource().getFile());
because this will return a Standard formatted
URL, i.e. the spaces in the path will be %20, etc.Just decode the URL yourself then:
String path =
URLDecoder.decode(getClass().getResource().getPath());
File file = new File(path);
new FileOutputStream(file);(I can't remember if you should use getPath() or
getFile() on the URL. Experiment with it.)Thanks pervel! I'll give it a try.

Similar Messages

  • URLConnections and Input Streams

    I am trying to get a jar file I have up on a web server.
    First I make a connection to the server requesting the file..that works fine.
    Second i want to use an input stream to bring in the file so i can read its contents.
    The problem lies in using the InputStream to read a URL connection.
    I have tried using the JarInputStream but that wont work.
    Do I need to take my URLConnection and convert it to an object or data type that I am not aware of?
    URL url = new URL("http://www.domain.com/myfile.jar");
    URLConnection conn = url.openConnection();
    JarFile in = new JarFile(new BufferedReader(new InputStreamReader(conn)));
    Any ideas fellas?

    At this point that is all I want to do. Just download the file.
    Thats where I am having trouble.
    Once I get it downloaded it should be fine.
    Should I maybe write the input of the file coming off the server to input of a new file?

  • URLConnection and Weblogic 6.1 Problem

    I am trying to create a URL connection to a secure site from within a JSP. This is the code I am using
      try {
        System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
        URL url = new URL("https://secure2.mde.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e");
        URLConnection conn = (URLConnection)url.openConnection();
        conn.setDoOutput(true);
        conn.setUseCaches(false);
        conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
        OutputStream outStream = conn.getOutputStream();
      } catch(IOException e) {
        e.printStackTrace();
      }The problem is that when conn.getOutputStream() is executed I receieve a fatal handshake error. I am running the JSP on weblogic 6.1 with JDK1.3. I have added the JSSE libs and made the necessary changes in java.security.
    I can run the same code as a stand-alone application (using jdk1.3 still) with no problems. However once deployed to weblogic 6.1 it crashes. It does work on WL 8.1 (but this is not an option).
    I have enabled ssl debugging within WL and receive the following
    ####<28-Nov-07 17:15:05 GMT> <Debug> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Before license check - client CipherSuites: [3,9,8,0] server CipherSuites: [3,9,8,0]>
    ####<28-Nov-07 17:15:05 GMT> <Debug> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <No SSL/Domestic License found>
    ####<28-Nov-07 17:15:05 GMT> <Debug> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <After license check - client CipherSuites: [3,9,8,0] server CipherSuites: [3,9,8,0]>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <V2 client hello sent: version = 3.0, cipherSpecs = 4 {3, 9, 8, 0}, sessionID = 0 , challenge = 32 474da2196582eaff9b46529ac4ee36f563c13815a67e92bb385d72226f66ed7d>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Decrypting 2 bytes...>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> < Finished decrypting 2 bytes>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> < Read throughput = Infinity bytes/sec>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <contentLen = 2, padding.length = 0, MAC.length = 0, len = 2>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Available on alertStream: 2>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Aborting session>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Alert: fatal handshake_failure>
    ####<28-Nov-07 17:15:05 GMT> <Info> <SSL> <dt04230> <hwserver> <ExecuteThread: '12' for queue: 'default'> <> <> <000000> <Aborting session> I have not changed any of WL's keystores from the default settings but I would have thought it would use the standard java cacerts which is obviously fine as I ran the app stand-alone.
    If any body has faced this issue or knows of a possible solution I would greatly appreciate any response.
    Thanks

    As you said, it could be the WLS6 truststore which doesn't contain the certificate authority. Just check which files are used (cacerts, cacerts.jks,..), and maybe you can find it by checking the option startup : -Dweblogic.security.SSL.trustedCAKeyStore
    It doesn't matter when the exception is triggered (you can do an explicit handshake, or just write in the socket and then wait for an implicit handshake)

  • UrlConnection and Thread

    Hi all,
    Thread Tx uses UrlConnection to connect a HomeApp on Tomcat to do something
    HomeApp receives request, and sleeps for 100000milisec
    Thread Tx2 sleeps for 100milisec and wake up to interrupt Thread Tx
    I expected all operations inside Thread Tx will be destroyed..but the urlCon.getInputStream(); still waits for the server to response after Thread.interrupt();
    Does UrlConnection has its own thread ?
    how do i stop urlConnection from waiting for server's response after Tx.interrupt()?
    Runnable Rx1 = new Runnable(){
    public void run() {
        URLConnection urlCon = page.openConnection();
        urlCon.setDoInput(true);
        urlCon.setDoOutput(true);
        urlCon.setRequestProperty("Method", "POST");
        urlCon.connect();
        OutputStream rawOutStream = urlCon.getOutputStream();
        PrintWriter pw = new PrintWriter(rawOutStream);
        pw.write(this.property);
        pw.flush();
        pw.close();
        *urlCon.getInputStream();*  *// Tx thread got interrupted by Tx2,
                     //but this line of code still get executed.  It receives responses from Tomcat server*
    final Thread Tx = new Thread(Rx1);
    Tx.setName("LoginServlet-Thread");
    Tx.start();
    Runnable Rx2 = new Runnable(){
         public void run() {
              try {
                   Thread.currentThread().sleep(100);
                   if(Tx.isAlive()){
                        *if(Tx.isInterrupted())*
                        logger.info(Tx.getName() + " is already interrupted");
                                  else{logger.info("not interrupted yet");     
              } catch (InterruptedException e) {}
         Thread Tx2 = new Thread(Rx2);
         Tx2.start();thank you all
    Edited by: happy2005 on Jan 20, 2009 6:19 PM
    Edited by: happy2005 on Jan 20, 2009 6:22 PM
    Edited by: happy2005 on Jan 20, 2009 6:23 PM
    Edited by: happy2005 on Jan 20, 2009 6:24 PM

    how do you do that?
    UrlConnection doesn't have close method
    I did urlCon.getInputStream().close();but the close didn't take place until getting the stream completed.
    i want to stop / disrupt getInputStream from running.
    regards,

  • URLConnection and cookie domains

    Hello.
    I have a JSP page on one web server domain communicating with a Perl program on another. The JSP does a POST to the Perl program to submit some variables. The Perl program then responds by outputting an HTML page. In that HTML page response is a JavaScript snippet that sets two cookies. My problem is that the cookies end up looking like they're from the same domain as the JSP page (which makes sense based on my code below), but I need them to be from the same domain as the Perl program. Is there a way to do this?
    Many thanks!
    - m
    Relevant code:
    URL dataURL = new URL(postLocation);
    URLConnection connection = dataURL.openConnection();
    connection.setUseCaches(false);
    connection.setDoOutput(true);
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
    PrintWriter outPW = new PrintWriter(byteStream, true);
    String postData = MyDataToPost;
    outPW.print(postData);
    outPW.flush();
    connection.setRequestProperty("Content-Length", String.valueOf(byteStream.size()));
    connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    byteStream.writeTo(connection.getOutputStream());
    BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String line;
    while((line = in.readLine()) != null) {
         /*This is the HTML response page from the Perl program with the JavaScript cookies to set*/
         out.println(line);

    well, you'd have to pull out the cookie generating JavaScript and insert your own cookies, so the question is, is it worth it...

  • URLConnection and sessions

    Hello all!
    I am writing a harness to test a web app. Part of the harness has to do HTTP
    connections and post some data to the web server. This is a part of a
    transaction load test...
    Here is working code for HTTP POST
    >>>>>
    try {
    URL url;
    URLConnection urlConn;
    DataOutputStream dos;
    DataInputStream dis;
    url = new URL(host);
    urlConn = url.openConnection();
    urlConn.setDoInput(true);
    urlConn.setDoOutput(true);
    urlConn.setUseCaches(false);
    urlConn.setRequestProperty("Content-Type",
    "application/x-www-form-urlencoded");
    java.net.HttpURLConnection con = (HttpURLConnection)url.openConnection();
    dos = new DataOutputStream(urlConn.getOutputStream());
    dos.writeBytes(post_data);
    dos.flush();
    dos.close();
    // Read out responce
    // Without this nothing works for some reason.
    dis = new DataInputStream(urlConn.getInputStream());
    dis.read();
    dis.close();
    // Done
    }catch(Exception oops){
    System.out.println(oops.getMessage());
    <<<<<
    POST works just fine, but the problem I run in to is that the connection
    requires sessions.
    Is there is a way to get a session from URLConnection.
    Or perhaps there is a better way of doing it.
    Any one knows?
    Thank you in advance. Your input is greatly appritiated.
    Alexander. (fliger) N.

    Did you ever complete your test harness and get it working.
    Ive been asked to build a test harness to make a number of connections to a http page (I think pretty close to your example).
    If it is working, do you mind posting me hte code to validate.
    [email protected]

  • URLConnection and 100 Continue

    I'm having trouble using the URLConnection. I'm posting form data in an attempt to read cookie headers in the response. Before opening the connection, I set headers to mimic a user agent, and then post the data.
    The server sends a 100 continue, which the URLConnection follows, and then a 302 ObjectMoved which sends the cookie data. In this communication the URLConnection is dropping the pre-set headers (set and used in the initial transfer), and not creating the cookies. When it follows the 302, then, it is being redirected again as having not successfully supplied the form data posted.
    Do I have finer control than Harold points out in his book, or do I have to build a socket from scratch?

    Yes, setFollowRedirects() does prevent the follow. That solved a problem, thank you. Now the difficulty is in capturing the Set-Cookie header values passed with the 302 Object Moved. I have been capturing them with a packet spy, entering them (creating a cookie response) manually, and then proceeding with the communication, which works as it should. I'm using the following code to post data:
         public InputStream post() throws IOException {
              //open the connection and prepare it to post
              uc = (HttpURLConnection)url.openConnection();
              HttpURLConnection.setFollowRedirects(false);
              uc.setRequestProperty("User-Agent", " Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
              uc.setRequestProperty("Accept", " text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
              uc.setRequestProperty("Accept-Language", " en-us,en;q=0.5");
              uc.setRequestProperty("Accept-Encoding", " gzip,deflate");
              uc.setRequestProperty("Accept-Charset", " ISO-8859-1,utf-8;q=0.7,*;q=0.7");
              uc.setRequestProperty("Keep-Alive", " 300");
              uc.setRequestProperty("Connection", " keep-alive");               
              uc.setRequestProperty("Referer", con.referer_string); //Scripted Referer
              uc.setRequestProperty("Cookie", con.cookie_string); //My cookie data; captured and entered manually
              uc.setDoOutput(true);
              OutputStreamWriter out = new OutputStreamWriter(uc.getOutputStream(), "ASCII");
              out.write(query.toString());
              out.write("\r\n");
              out.flush();
              out.close();
              return uc.getInputStream();
         }Now, as I mentioned previously, the method encounters a 100 Continue, posts the data, receives a 302 Object Moved (which passes a Set-Cookie header), and then the connection is terminated (by me). When using an HttpURLConnection without setDoOutput , I can capture the header data like this:
         for (int j = 1; ; j++) {
              String header = uc.getHeaderField(j);
              String key = uc.getHeaderFieldKey(j);
              if (header == null || key == null) break;
              System.out.println(uc.getHeaderFieldKey(j)+": "+header);
         }However, the uc connection used in the post() method above does not return the data needed from the 302. How do I get to it?
    Message was edited by:
    phossal

  • Problems with URLConnection and sessions

    Hi all,
    I'm having a problem with some applet - php communication. We have a website that you log in to. The website is in php, and I have no idea what it does, because another guy is handling it. My applet takes in information about the session id and stuff like that, and whenever I want to communicate with a page, I send the id and the requests using a post method. I've got a simple post method which writes a string to a url, then opens an input stream from that connection. Here's the code:
            /**This method posts the given string to the given URL and returns the InputStream from the URL*/
         public InputStream postToURL(URL postURL, String post) throws IOException{
              URLConnection connect = postURL.openConnection();
              connect.setDoOutput(true);
              connect.setUseCaches(false);
              OutputStreamWriter fwdOut = new OutputStreamWriter(connect.getOutputStream());
              fwdOut.write(post);
              fwdOut.flush();
              fwdOut.close();
              return connect.getInputStream();
         }I just noticed that when you run this, it logs you out of your session on the website. I commented out parts and found out that it actually doesn't log you out until I call connect.getInputStream(). I have no idea if this is the applet's fault, or the php's fault. I was hoping that some of you might have some insight as to what the problem is, and if there is something on the applet side I should change to make it work. If it is the php side, then sorry for wasting your time, and hopefully the other guy will catch it.

    shiroganeookami wrote:
    I just wanted to clarify, the session information I'm getting is actually just a login id that is used to confirm if someone has access to certain files, so it actually isn't the session information, like I thought.If I understand you correctly.
    Your are logged in to the site in PHP.
    On the site is an applet.
    When the applet connects back to the site (and you are not using the session or login here) the BROWSER loses it's session.
    Is this correct?
    If so the problem is some shoddy PHP coding. A session or whatever it is that they are actually doing is maintained using HTTP cookies. The browser's cookies are not being wiped by the Applet. What I suspect is happening is that the PHP is doing something with IP addresses and is wiping the browser session when the applet connects from the same address. Which is a mistake for a bunch of reasons.
    If it's something else then please explain what.

  • URLConnection and applet security

    Hello,
    I've got an applet that comunicates with a servlet with a urlConnection object. If I test de application without permissions of security (Applet Viewer ->Eclipse), the program runs perfectly, but when I test it in the server throws a security exception when the URLConnection connects with the servlet? How can I resolve it?
    Thanks

    The first part works ok, but in the two try-catch show me the error-messages.
    urlServlet = new URL(new URL("http://85.59.55.122:8080/utilidades/"),"imagen");
    URLConnection con = urlServlet.openConnection();
         con.setDoInput(true);
                             con.setDoOutput(true);
                             con.setUseCaches(false);
                             con.setRequestProperty(
                                       "Content-Type",
                                  "application/x-java-serialized-object");
         ImagenPerso imagen=new ImagenPerso(img);          
    try{
                             OutputStream outstream = con.getOutputStream();
                             ObjectOutputStream oos = new ObjectOutputStream(outstream);
                             oos.writeObject(imagen);
                             oos.flush();
                             oos.close();
                        }catch(Exception er3){
                             JOptionPane.showMessageDialog( graph,
                             "Error al incrustar objetos en la peticion",
                             "Editor de procedimientos",
                             JOptionPane.ERROR_MESSAGE);
    try{
    //                    receive result from servlet
                             InputStream instr = con.getInputStream();
                             ObjectInputStream inputFromServlet = new ObjectInputStream(instr);
                             String result = (String) inputFromServlet.readObject();
                             inputFromServlet.close();
                             instr.close();
                        }catch(Exception i){
                             JOptionPane.showMessageDialog( graph,
                             "Error al leer objetos de la respuesta",
                             "Editor de procedimientos",
                             JOptionPane.ERROR_MESSAGE);
                        }

  • Cannot connect using URLConnection and JSSE

    Hi,
    I am using the following code:
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    I also pass -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
    as argument to the java VM. However, the code below throws IOException with the message: "HTTPS hostname wrong: should be <mail.yahoo.com>"
    URLConnection con;
    URL url = new URL("https://mail.yahoo.com");
    con = url.openConnection();
    con.connect();
    What can I do?

    Write your own HostnameVerifier, it sounds like mail.yahoo.com isn't sending
    a properly formed certificate.
    P.S. If you're using JSSE in 1.4 or above, the SunJSSE is already installed, and
    the setProperty/addProvider shouldn't be done.

  • Help please: URLConnection and timeout

    I want to connect to a Internet URL and retrieve the HTML code, but I have error message: "Operation timed out: connect"
    How I can resolve this?
    Thanks.
    <%
    try {
    URL theUrl = new URL("http://www.yahoo.com");
    URLConnection uc = theUrl.openConnection();
    InputStream content = uc.getInputStream();
    BufferedInputStream in = new BufferedInputStream (content);
    LineNumberReader lnr = new LineNumberReader (new InputStreamReader(in));
    String tempStr = "";
    StringBuffer str = new StringBuffer();
    while ((tempStr = lnr.readLine()) != null)
    str.append(tempStr);
    out.println(tempStr);
    in.close();
    lnr.close();
    catch(Exception e) { out.println("Error:"+e.getMessage()); }
    %>

    I was getting the same error while connecting through a proxy.
    The following lines fixed the problem:
    System.setProperty("http.proxyHost", "[your proxy's IP]");
    System.setProperty("http.proxyPort", "[your proxy's port]");
    Good Luck
    matrixPooh www.bizdisplay.com

  • Problem with getWriter() and getOutputStream()

    Hi,
    I have written two methods. Name it as A(),B().
    In A() Method i am calling getWriter()
    In B() Method I am calling getOutputStream().
    But i got the IllegalStateException saying that,
    Cannot call getOutputStream() after getWriter().
    Both are required for me.
    I should not change the A() Method which is written by somebody and all are using the same i eman A().
    But i need getOutputStream() in My method i mean B().
    Please tell me how to avoid this problem.
    Thanks in Advance

    It sounds like you are working on a Servlet and trying to use the Response object. If so then you have fundamental problems because once response.getWriter() has been called one cannot then use response.getOutputStream(). The call to response.getWriter() wraps the OutputStream in a Writer that may buffer bytes.

  • About UrlConnection and session

    Hi,
    here
    String urlString = "http://192.168.0.139:8080/Customize/setCredentials";
    URL url = new URL(urlString);
    HttpURLConnection hpcon = (HttpURLConnection) url.openConnection();
    this will establish a connection with the username and password.
    after this i need to communication with another servlet..
    String urlString1 = "http://192.168.0.139:8080/Customize/AddData";
    URL url1 = new URL(urlString1);
    HttpURLConnection hpcon 1= (HttpURLConnection) url.openConnection();
    if i do this its again asking for credenstials..
    how can i use tjhe session info from above connection..
    mean can i set this url string to the above logged in connection..
    regards,

    Hi,
    Iam not doing anything to keep the sessiions..everything inside that servlets which come software..i cannot manipulate that code.when iam using the microsftvar xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var xml_dom = new ActiveXObject("MSXML2.DOMDocument");
    var xml_domTemp = new ActiveXObject("MSXML2.DOMDocument");
    with java script its working fine..after logginng iam getting the objects using the same urls.but when iam using the UrlConnection its giving the response that the usernotLogged in..
    regards,

  • URLConnection and Proxy-Authorization error.

    My code does not work and I dont know how solve.
    I cannot be identified in proxy.
    can you help me?
    Thanks.
    FranciscoJ.
    import java.util.Properties;
    import java.net.*;
    import java.net.URLConnection;
    import java.net.HttpURLConnection;
    import java.io.*;
    public class importaURLNoticias
    public static String urlText="";
    public static URL urlInicial=null;
    public static void main(String args[])
    urlText="http://www.yahoo.com";
    Properties props = System.getProperties();
    props.setProperty("http.proxySet", "true");
    props.setProperty("http.proxyHost", "272.128.66.136");
    props.setProperty("http.proxyPort", "8080");
    props.setProperty("http.proxyUserName", new sun.misc.BASE64Encoder().encode("myuser".getBytes()));
    props.setProperty("http.proxyPassword", new sun.misc.BASE64Encoder().encode("mypwd".getBytes()));
    System.setProperties(props);
    try {
    URL theUrl = new URL(urlText);
    URLConnection uc = theUrl.openConnection();
    //HttpURLConnection uc = (HttpURLConnection)theUrl.openConnection();
    //uc.setRequestMethod("GET");
    uc.setDoInput(true);
    uc.setDoOutput(false);
    uc.setUseCaches(false);
    uc.setRequestProperty("Proxy-Authorization", new sun.misc.BASE64Encoder().encode("myuser:mypwd".getBytes()));
    uc.connect();
    InputStream content = uc.getInputStream();
    BufferedInputStream in = new BufferedInputStream (content);
    LineNumberReader lnr = new LineNumberReader (new InputStreamReader (in));
    String tempStr = "";
    StringBuffer str = new StringBuffer();
    while ((tempStr = lnr.readLine()) != null)
    str.append(tempStr);
    System.out.println(tempStr);
    in.close();
    lnr.close();
    catch(Exception e) { System.out.println("Error "+urlText+":\n\r"+e.getMessage()); }
    }

    I managed to get through my proxy by using an Authenticator (in java.net)
    Properties prop = System.getProperties();
    prop.put("http.proxyHost", PROXY_HOST);
    prop.put("http.proxyPort", PROXY_PORT);
    Authenticator aAuth = new Authenticator(){
        public PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication ("user", "pwd".toCharArray());
    Authenticator.setDefault(aAuth);

  • HttpUrlConnection, URLConnection, and Sockets for HTTP

    Suppose we want to send requests and receive documents over HTTP frequently. Is establishing direct connections and manually sending HTTP request by using Sockets faster than simply using a HttpUrlConnection instance?
    What if we want to establish persistent connections (HTTP Keep-Alive) ?

    Using raw sockets is probably slower than
    using HttpURLConnection, which runs a connection pool.Thanks for the tip.
    I searched the web for "Connection Pool" and read the first 4-5 results. As I understood, connection pools are a group of cached connections which resides on the server side in the database server or application server memory. Unfortunately I don't understand how HttpURLConnection runs a connection pool, or perhaps I didn't understand what a Connection pool really is! Would you please explain more?

Maybe you are looking for

  • MRP area for running a sale order MRP

    Hello PP experts, I come across a scenario where , I need to do the  MRP run for sale order in a MRP area. I have checked , I can put PIR with respect to MRP AREA , but when I open MD50 screen for running MRP for sale order. I did not found the MRP A

  • Switch Question

    I'm new to Java, but not to programming or IDE's. I'm in the early stages of developing a new Java application, so I've been playing with various example code from some of the number of books available on the topic. In particular I was interested in

  • Bitt locker loss a recovery Key

    my respected sir                        i am using window 7 ultimate on my computer i lost my recovery key of Bit locker when i use the password to unlock my driver Show this massage (bit lockernot Response) how i can unlock my Drive. In my drive my

  • How do I modify the "Number of Pages" setting for an existing Master Page via javascript?

    I'm learning javascripting for InDesign and I have been tinkering with the stock scripts in the tutorials. I'm developing the ability set properties and such, playing with how Javascript works, and I wanted to change the number of pages in a master p

  • Adding solman to a demo system in solman stms

    Here i need to add solman in my demo domain controller systems. As soon i give stms in solman it asks me to configure transport domain fo solman. I choose other configuration. I have given the respective ,description, target host and system no. It sh