Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.1.0)

E17483-02

oracle.adfinternal.model.adapter.url
Class SmartURL

java.lang.Object
  extended by oracle.adfinternal.model.adapter.url.SmartURL

public class SmartURL
extends java.lang.Object

Handles URL connections.

Different adapters and data controls will use this class to access a URL. This class can handle the HTTP and HTTPS protocols. It uses the proxy set by the application that runs it.

Since:
10.1.3

Constructor Summary
SmartURL(java.lang.String loc)
          Creates the URL object for a location.
SmartURL(java.lang.String loc, java.lang.String servletCtxPath)
          Creates the URL object for a location.
 
Method Summary
 java.net.URL createURL()
          Createa an URL object.
 java.io.InputStream openStream()
          Open an InputStream for a location.
 void setTimeout(int timeout)
          Sets the timeout for the connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartURL

public SmartURL(java.lang.String loc)
Creates the URL object for a location.

Parameters:
loc - Source location for the URL.

SmartURL

public SmartURL(java.lang.String loc,
                java.lang.String servletCtxPath)
Creates the URL object for a location.

Parameters:
loc - Source location for the URL.
servletCtxPath - Context path for the servlet.
Method Detail

setTimeout

public void setTimeout(int timeout)
Sets the timeout for the connection. The default is 30 seconds.

Parameters:
timeout - Timeout amount in miliseconds.

openStream

public java.io.InputStream openStream()
                               throws AdapterException
Open an InputStream for a location. If the location points to a http or https file, this method tries to connect to the file. The location can be a file name as well. This method tries to create a URL from the location. If fails it will treat the location as a file name and tries to create a URL for the file. If the file path is not an absolute path defined, It tries to resolve the name as relative to the provider home. If fails it then tries to create a URL from the file path as known to the system.

Returns:
Opened input stream of the file specified by the location.
Throws:
AdapterException - If the connection failed or no URL can be formed from the location.

createURL

public java.net.URL createURL()
                       throws AdapterException
Createa an URL object.

Returns:
Created URL. This method tries to connect the URL also to check the validity of the location. So the returned URL will be in connected state.
Throws:
AdapterException - If the connection failed or no URL can be formed from the location.

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.1.0)

E17483-02

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