org.apache.sling.bundleresource.impl
Class BundleResourceURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.apache.sling.bundleresource.impl.BundleResourceURLConnection

public class BundleResourceURLConnection
extends URLConnection

A Bundle based UIRLConnection which uses the bundle's last modification time as the last modification time of the URL in contrast to the (Apache Felix) URLConnection used for the bundle entry, which always returns zero.


Field Summary
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
protected BundleResourceURLConnection(org.osgi.framework.Bundle bundle, String bundlePath, URL url)
           
 
Method Summary
 void connect()
          Connects this URLConnection to access the data and metadata such as the content length, last modification time and content type.
 int getContentLength()
          Returns the content length of the Bundle provided URLConnection
 String getContentType()
          Returns the content type of the Bundle provided URLConnection
 InputStream getInputStream()
          Returns the input stream of the Bundle provided URLConnection
 long getLastModified()
          Returns the last modification time of the underlying bundle, which is the last time the bundle was installed or updated
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BundleResourceURLConnection

protected BundleResourceURLConnection(org.osgi.framework.Bundle bundle,
                                      String bundlePath,
                                      URL url)
Method Detail

connect

public void connect()
             throws IOException
Connects this URLConnection to access the data and metadata such as the content length, last modification time and content type.

Specified by:
connect in class URLConnection
Throws:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns the input stream of the Bundle provided URLConnection

Overrides:
getInputStream in class URLConnection
Throws:
IOException

getContentLength

public int getContentLength()
Returns the content length of the Bundle provided URLConnection

Overrides:
getContentLength in class URLConnection

getLastModified

public long getLastModified()
Returns the last modification time of the underlying bundle, which is the last time the bundle was installed or updated

Overrides:
getLastModified in class URLConnection

getContentType

public String getContentType()
Returns the content type of the Bundle provided URLConnection

Overrides:
getContentType in class URLConnection


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.