org.ops4j.pax.url.classpath.internal
Class Connection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.ops4j.pax.url.classpath.internal.Connection

public class Connection
extends URLConnection

An URLConnection that supports classpath: protocol.
Syntax:
classpath:[//bundle_symbolic_name/]path_to_resource
where:
...


Field Summary
static String PROTOCOL
          The protocol name.
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
Connection(URL url, org.osgi.framework.BundleContext bundleContext)
          Creates a new connection.
 
Method Summary
 void connect()
          Does nothing.
 InputStream getInputStream()
          Returns the input stream denoted by the url.
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, 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 inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOL

public static final String PROTOCOL
The protocol name.

See Also:
Constant Field Values
Constructor Detail

Connection

public Connection(URL url,
                  org.osgi.framework.BundleContext bundleContext)
           throws MalformedURLException
Creates a new connection.

Parameters:
url - the url; cannot be null
bundleContext - the bundle context; can be null for standalone use
Throws:
MalformedURLException - in case of a malformed url
Method Detail

connect

public void connect()
Does nothing.

Specified by:
connect in class URLConnection
See Also:
URLConnection.connect()

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns the input stream denoted by the url. Resource resolution: 1. if a bundle symbolic name is present then search the specific bundle. If not found then stop. 2. search the current thread classpath 3. search all bundles if allowed (has permittion)

Overrides:
getInputStream in class URLConnection
Returns:
the input stream for the resource denoted by url
Throws:
IOException - in case of an exception during accessing the resource
See Also:
URLConnection.getInputStream()


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.