Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

oracle.adf.model.connection.url
Interface URLConnection

All Known Implementing Classes:
FileURLConnection, HttpURLConnection, URLConnectionProxy

public interface URLConnection

URLConnection represents a communication channel to a URL resource. The Connection provides services such as authentication , securing the communication channel, interaction management.

Clients intending to use the URLConnection must first call open(), which opens the channel. The underlying interaction model is intialized. The interaction represents the actual channel to the reosurce. Authentication if needed will be performed against the resource. Once the connection has been successfully opened, the channel is prepared for the communication to happen between the client and the URL resource.

Every communication session is represented by an Interaction. The default interaction mdoel for the URLConnection is HTTP / HTTPS. A client begins a communication session by calling getInteraction(). This will return an instance of HttpClient.HTTPConnection which represents the actual physical connection for this URLConnection. Connections representing other protocol models of communication must implement their specific interaction models and override the necessary methods to achieve the communication.

Once the communication has been completed, it is the client's responsibility to release the connection by explicitly calling the close(). This will return the connection back to the provider to be released to the connection pool.

Since:
10.1.3

Field Summary
static java.lang.String ATTR_NAME
          Connection Name attribute
static java.lang.String ATTR_URL
          Connection endpoint attribute
 
Method Summary
 void close()
          Close this connection.
 AuthenticationScheme getAuthenticationScheme()
          Get the AuthenticationScheme used by this connection to authenticate against the endpoint
 java.lang.Object getInteraction()
          Start the communication session.
 java.lang.String getName()
          Get the name of this URLConnection.
 Proxy getProxy()
          Get the proxy details associated for this URL Connection.
 int getTimeout()
          Get the timeout set on this connection.
 java.net.URL getURL()
          Get the URL resource represented by this connection
 void open()
          Open the connection.
 void release()
          Release this connection instance back to the pool.
 void setProxy(Proxy proxy)
          Configure the proxy details for the URL access
 void setTimeout(int timeout)
          Set the timeout property for the connection.
 

Field Detail

ATTR_NAME

static final java.lang.String ATTR_NAME
Connection Name attribute

See Also:
Constant Field Values

ATTR_URL

static final java.lang.String ATTR_URL
Connection endpoint attribute

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Get the name of this URLConnection.

Returns:
The name of this connection.

open

void open()
          throws ConnectionException
Open the connection. Prepare the underlying physical communication channel, by doing the necessary authentication and intializations. The physcial connection to the resource is established for the client to start an interaction.

Throws:
{@link - ConnectionException} if the connection failed to open.
ConnectionException

setProxy

void setProxy(Proxy proxy)
Configure the proxy details for the URL access

Parameters:
proxy - The Proxy details needed to access the URL

getProxy

Proxy getProxy()
Get the proxy details associated for this URL Connection.

Returns:
The {#link Proxy} details for this connection, if it exists, null otherwise.

getInteraction

java.lang.Object getInteraction()
                                throws ConnectionException
Start the communication session. The Interaction represents the actual physical connection to communication channel. The Client must call open() before starting the interaction. This is necessary to initialize and prepare the atual physical channel for communication. The default interaction model for the URLConnection is the HttpClient.HTTPConnection. The HTTPConnection supports the HTTP and HTTPS protocols of communication.

Returns:
The HTTPConnection that represents the underlying communication channel.
Throws:
{@link - ConnectionException} if an error occurred in starting the interaction.
ConnectionException

getAuthenticationScheme

AuthenticationScheme getAuthenticationScheme()
Get the AuthenticationScheme used by this connection to authenticate against the endpoint

Returns:
The AuthenticationScheme used by this connection. If the connection does not use any authentication null is returned.

getURL

java.net.URL getURL()
Get the URL resource represented by this connection

Returns:
The URL resource of this connection

getTimeout

int getTimeout()
Get the timeout set on this connection. This is the timeout property for the underlying interaction instance.

Returns:
The timeout set on the connection. If the connection has been released or the time out property is not valid for certain types of URL Connections then a -1 is returned.

setTimeout

void setTimeout(int timeout)
Set the timeout property for the connection. Clients can set the timeout on the connection before calling the open. The timeout property is preserved for the life time of this connection instance until a subsequent setTimeOut is invoked. The timeout semantics are as described for the HTTPConnection.

Parameters:
timeout - The timeout to be set on the connection instance. This is the time in milliseconds. A time of 0 means wait indefinitely.

close

void close()
           throws ConnectionException
Close this connection. Reset the state of the interaction of this connection. Clients can Reopen the connection by calling open() on the connection again. Reopening the connection will reset the state of the interaction associated with this connection.

Throws:
{@link - ConnectionException} if a failure occured in closing the connection.
ConnectionException

release

void release()
             throws ConnectionException
Release this connection instance back to the pool. This should be the last operation on a connection instance typically. Once the connection instance is released all operations on the connection reference cease to be valid. The connection reference cannot be reused again within the context of the application. The Client must do a lookup to reuse this connection instance.

Throws:
{@link - ConnectionException} if the connection could be released to the pool.
ConnectionException

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

Copyright © 1997, 2010, Oracle. All rights reserved.