< prev index next >

src/java.base/share/classes/java/net/URLConnection.java

Print this page




  34 import java.util.Date;
  35 import java.util.Iterator;
  36 import java.util.Locale;
  37 import java.util.Objects;
  38 import java.util.ServiceConfigurationError;
  39 import java.util.ServiceLoader;
  40 import java.util.StringTokenizer;
  41 import java.util.Collections;
  42 import java.util.Map;
  43 import java.util.List;
  44 import java.security.Permission;
  45 import java.security.AccessController;
  46 import sun.security.util.SecurityConstants;
  47 import sun.net.www.MessageHeader;
  48 import sun.security.action.GetPropertyAction;
  49 
  50 /**
  51  * The abstract class {@code URLConnection} is the superclass
  52  * of all classes that represent a communications link between the
  53  * application and a URL. Instances of this class can be used both to
  54  * read from and to write to the resource referenced by the URL. In
  55  * general, creating a connection to a URL is a multistep process:
  56  *
  57  * <div style="text-align:center"><table class="plain" style="margin:0 auto">
  58  * <caption style="display:none">Describes the process of creating a connection to a URL: openConnection() and connect() over time.</caption>
  59  * <thead>
  60  * <tr><th>{@code openConnection()}</th>
  61  *     <th>{@code connect()}</th></tr>
  62  * </thead>
  63  * <tbody>
  64  * <tr><td>Manipulate parameters that affect the connection to the remote
  65  *         resource.</td>
  66  *     <td>Interact with the resource; query header fields and
  67  *         contents.</td></tr>
  68  * </tbody>
  69  * </table>
  70  * ----------------------------&gt;
  71  * <br>time</div>
  72  *


  73  * <ol>
  74  * <li>The connection object is created by invoking the
  75  *     {@code openConnection} method on a URL.
  76  * <li>The setup parameters and general request properties are manipulated.
  77  * <li>The actual connection to the remote object is made, using the
  78  *    {@code connect} method.
  79  * <li>The remote object becomes available. The header fields and the contents
  80  *     of the remote object can be accessed.
  81  * </ol>
  82  * <p>
  83  * The setup parameters are modified using the following methods:
  84  * <ul>
  85  *   <li>{@code setAllowUserInteraction}
  86  *   <li>{@code setDoInput}
  87  *   <li>{@code setDoOutput}
  88  *   <li>{@code setIfModifiedSince}
  89  *   <li>{@code setUseCaches}
  90  * </ul>
  91  * <p>
  92  * and the general request properties are modified using the method:
  93  * <ul>
  94  *   <li>{@code setRequestProperty}
  95  * </ul>
  96  * <p>
  97  * Default values for the {@code AllowUserInteraction} and
  98  * {@code UseCaches} parameters can be set using the methods




  34 import java.util.Date;
  35 import java.util.Iterator;
  36 import java.util.Locale;
  37 import java.util.Objects;
  38 import java.util.ServiceConfigurationError;
  39 import java.util.ServiceLoader;
  40 import java.util.StringTokenizer;
  41 import java.util.Collections;
  42 import java.util.Map;
  43 import java.util.List;
  44 import java.security.Permission;
  45 import java.security.AccessController;
  46 import sun.security.util.SecurityConstants;
  47 import sun.net.www.MessageHeader;
  48 import sun.security.action.GetPropertyAction;
  49 
  50 /**
  51  * The abstract class {@code URLConnection} is the superclass
  52  * of all classes that represent a communications link between the
  53  * application and a URL. Instances of this class can be used both to
  54  * read from and to write to the resource referenced by the URL. 

















  55  *
  56  * <p>
  57  * In general, creating a connection to a URL is a multistep process:
  58  * <ol>
  59  * <li>The connection object is created by invoking the
  60  *     {@link URL#openConnection() openConnection} method on a URL.
  61  * <li>The setup parameters and general request properties are manipulated.
  62  * <li>The actual connection to the remote object is made, using the
  63  *    {@link #connect() connect} method.
  64  * <li>The remote object becomes available. The header fields and the contents
  65  *     of the remote object can be accessed.
  66  * </ol>
  67  * <p>
  68  * The setup parameters are modified using the following methods:
  69  * <ul>
  70  *   <li>{@code setAllowUserInteraction}
  71  *   <li>{@code setDoInput}
  72  *   <li>{@code setDoOutput}
  73  *   <li>{@code setIfModifiedSince}
  74  *   <li>{@code setUseCaches}
  75  * </ul>
  76  * <p>
  77  * and the general request properties are modified using the method:
  78  * <ul>
  79  *   <li>{@code setRequestProperty}
  80  * </ul>
  81  * <p>
  82  * Default values for the {@code AllowUserInteraction} and
  83  * {@code UseCaches} parameters can be set using the methods


< prev index next >