Save This Page
Home » org.apache.sling.launchpad.base-2.2.0-source-release » org.apache.sling.launchpad.base.impl » [javadoc | source]
org.apache.sling.launchpad.base.impl
public class: ContextConnection [javadoc | source]
java.lang.Object
   java.net.URLConnection
      org.apache.sling.launchpad.base.impl.ContextConnection
The ContextConnection extends the java.net.URLConnection to provide access to a resource which is available from ResourceProvider provided to Sling .

This class is implemented by actually connecting to a resource URL which is provided by the resource provider and delegating the relevant method calls. Currently only #getContentLength() , #getContentType() , #getInputStream() and #getLastModified() are supported.
Fields inherited from java.net.URLConnection:
url,  doInput,  doOutput,  allowUserInteraction,  useCaches,  ifModifiedSince,  connected,  factory
Constructor:
 ContextConnection(URL url,
    ResourceProvider resourceProvider) 
    Creates an instance of this context connection.
    Parameters:
    url - The original URL whose path part is used to address the resource from the resource provider.
    resourceProvider - The ResourceProvider to which requests for content access are delegated.
Method from org.apache.sling.launchpad.base.impl.ContextConnection Summary:
connect,   getContentLength,   getContentType,   getInputStream,   getLastModified
Methods from java.net.URLConnection:
access$000,   addRequestProperty,   connect,   getAllowUserInteraction,   getConnectTimeout,   getContent,   getContent,   getContentEncoding,   getContentHandler,   getContentLength,   getContentType,   getDate,   getDefaultAllowUserInteraction,   getDefaultRequestProperty,   getDefaultUseCaches,   getDoInput,   getDoOutput,   getExpiration,   getFileNameMap,   getHeaderField,   getHeaderField,   getHeaderFieldDate,   getHeaderFieldInt,   getHeaderFieldKey,   getHeaderFields,   getIfModifiedSince,   getInputStream,   getLastModified,   getOutputStream,   getPermission,   getReadTimeout,   getRequestProperties,   getRequestProperty,   getURL,   getUseCaches,   guessContentTypeFromName,   guessContentTypeFromStream,   setAllowUserInteraction,   setConnectTimeout,   setContentHandlerFactory,   setDefaultAllowUserInteraction,   setDefaultRequestProperty,   setDefaultUseCaches,   setDoInput,   setDoOutput,   setFileNameMap,   setIfModifiedSince,   setReadTimeout,   setRequestProperty,   setUseCaches,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.sling.launchpad.base.impl.ContextConnection Detail:
 public  void connect() throws IOException 
    Accesses the the resource from the underlaying resource provider at the URL's path.
 public int getContentLength() 
    Returns the length in bytes of the resource or -1 if this connection has not been connected yet.
 public String getContentType() 
    Returns a guess at the content type of the resource or null if this connection has not been connected yet.
 public InputStream getInputStream() throws IOException 
    Returns a InputStream on the resource. If this connection is not connected yet, the conneciton is opened.
 public long getLastModified() 
    Returns the last modification timestamp of the resource or -1 if this connection has not been connected yet.