Skip navigation links

Oracle® WebLogic Server Web Clipping Transport API Reference
11g Release 1 (11.1.1)

E14346-01


oracle.portal.wcs.transport.http
Class DefaultHttpInputContext

java.lang.Object
  extended by oracle.portal.wcs.transport.AbstractInputContext
      extended by oracle.portal.wcs.transport.http.DefaultHttpInputContext

All Implemented Interfaces:
java.io.Serializable, HttpHeaderConstants, ContentTypeConstants, HttpInputContext, InputContext
Direct Known Subclasses:
DefaultWcrHttpInputContext

public class DefaultHttpInputContext
extends AbstractInputContext
implements HttpInputContext, HttpHeaderConstants

This is an abstraction at Studio time to let any transportation layer to fire off the HTTP request and get the response back. Currently, we only test it against HTTPClient package. The implementation for Provider mode is WcrHttpInputContext. Note: At Studio mode, if the request gets 401 error, a new HttpInputContext will be created the handle the credential entered by the user. When this context is saved into database, the non-ascii characters are escaped in URL but not in parameter name-values pair.

See Also:
Serialized Form

Field Summary
protected  boolean m_bActive
          True means it will be included in the clipping definition
protected  boolean m_bNew
          False is for reusing (SECTION, CLIPPING) in studio mode
protected  java.util.Hashtable m_htHeaders
           
protected  java.util.Hashtable m_htParams
          The parameters (name - value pair) should be encoded according to right encoding by calling WcEncoder.encodeNonAscii().
protected  HttpTransportProperties m_props
          The HTTP properties, includes ProxyHost, proxyPort, WalletLocation, WalletPassword AUTH_TYPE (basic)
protected  java.lang.String m_szAuthRealm
           
protected  java.lang.String m_szAuthType
          The Authorization stuff for both basic and digest
protected  java.lang.String m_szEffectiveUri
          The effective URI
protected  java.lang.String m_szMethod
           
protected  java.lang.String m_szPassword
           
protected  java.lang.String m_szUrl
           
protected  java.lang.String m_szUsername
           
protected  HttpTransportLiaison m_transport
          The actual transport implementation to handle connection.
protected  TransportSessionContext m_tsc
          The transport context to maintain cookies to outside

 

Fields inherited from class oracle.portal.wcs.transport.AbstractInputContext
m_r, m_szContentType, m_szReqEncoding, m_szRespEncoding

 

Fields inherited from interface oracle.portal.wcs.transport.InputContext
BUFFER_SIZE

 

Fields inherited from interface oracle.portal.wcs.common.HttpHeaderConstants
COOKIE_NAME_VAL_JSESSIONID, DEFAULT_HTTP_PORT, DEFAULT_PROXY_PORT, HEADER_ACCEPT, HEADER_ACCEPT_CHARSET, HEADER_ACCEPT_DELIMITER, HEADER_ACCEPT_ENCODING, HEADER_ACCEPT_LANGUAGE, HEADER_ACCEPT_VAL_ANY, HEADER_ACCEPT_VAL_APP_JS, HEADER_ACCEPT_VAL_IMAGE_GIF, HEADER_ACCEPT_VAL_IMAGE_JPEG, HEADER_ACCEPT_VAL_IMAGE_PJPEG, HEADER_ACCEPT_VAL_IMAGE_X_XBITMAP, HEADER_ACCEPT_VAL_TEXT_HTML, HEADER_AUTHORIZATION, HEADER_CHARSET_VAL_SJIS, HEADER_CHARSET_VAL_UTF8, HEADER_CONNECTION, HEADER_CONTENT_TYPE, HEADER_COOKIE, HEADER_EXPIRES, HEADER_HOST, HEADER_IF_MODIFIED_SINCE, HEADER_IF_NONE_MATCH, HEADER_KEEP_ALIVE, HEADER_LAST_MODIFIED, HEADER_PROXY_AUTHORIZATION, HEADER_REFERER, HEADER_USER_AGENT, HEADER_USER_AGENT_NOVERSION, HEADER_WWW_AUTHENTICATE, HEADER_X_ORACLE_PREFIX, HTTP_AUTH_DIGEST_NAME_NONCE, HTTP_AUTH_DIGEST_NAME_OPAQUE, HTTP_AUTH_DIGEST_NAME_QOP, HTTP_AUTH_DIGEST_NAME_RESPONSE, HTTP_AUTH_DIGEST_NAME_USERNAME, HTTP_AUTH_NAME_REALM, HTTP_AUTH_SCHEME_VALUE_BASIC, HTTP_AUTH_SCHEME_VALUE_DIGEST, HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_STATUS_200_OK, HTTP_STATUS_400_BAD_REQUEST, HTTP_STATUS_401_UNAUTHORIZED, HTTP_STATUS_402_PAYMENT_REQUIRED, HTTP_STATUS_403_FORBIDDEN, HTTP_STATUS_404_NOT_FOUND, HTTP_STATUS_405_METHOD_NOT_ALLOWED, HTTP_STATUS_406_NOT_ACCEPTABLE, HTTP_STATUS_407_PROXY_AUTH_REQUIRED, HTTP_STATUS_408_REQUEST_TIMEOUT, METATAG_CHARSET_VAL_EUCJP, METATAG_CHARSET_VAL_SJIS, METATAG_CHARSET_VAL_WIN31J

 

Fields inherited from interface oracle.portal.wcs.ContentTypeConstants
CHARSET_UTF8, CONTENT_TYPE_APP_JS, CONTENT_TYPE_APP_OS, CONTENT_TYPE_APP_PDF, CONTENT_TYPE_IMAGES, CONTENT_TYPE_TEXT_CSS, CONTENT_TYPE_TEXT_HTML, CONTENT_TYPE_TEXT_JS, CONTENT_TYPE_TEXT_PLAIN, CONTENT_TYPE_TEXT_XML, CONTENT_TYPE_UNDEFINED, ISO_LATIN_1, SZ_CONTENT_TYPE_APP_DL, SZ_CONTENT_TYPE_APP_JS, SZ_CONTENT_TYPE_APP_OS, SZ_CONTENT_TYPE_APP_PDF, SZ_CONTENT_TYPE_APP_WFU, SZ_CONTENT_TYPE_DUMMY, SZ_CONTENT_TYPE_IMAGE_PREFIX, SZ_CONTENT_TYPE_MULTIPART_FORM_DATA, SZ_CONTENT_TYPE_TEXT_CSS, SZ_CONTENT_TYPE_TEXT_HTML, SZ_CONTENT_TYPE_TEXT_HTML_UTF8, SZ_CONTENT_TYPE_TEXT_JS, SZ_CONTENT_TYPE_TEXT_PLAIN, SZ_CONTENT_TYPE_TEXT_XML, SZ_CONTENT_TYPE_UNDEFINED, SZ_CONTENT_TYPE_WCRESULTSET, SZ_DEFAULT_CONTENT_TYPE_WITH_CHARSET, UTF_8

 

Constructor Summary
protected DefaultHttpInputContext()
          Make subclass easy to construct
  DefaultHttpInputContext(HttpInputContext hic)
          Create a new Object, with the same TransportSessionContext, and it's always "new" and "active".
  DefaultHttpInputContext(java.lang.String szUrl)
          Test constructor
  DefaultHttpInputContext(java.lang.String szUrl, java.util.Hashtable htParams, java.util.Hashtable htHeaders, java.lang.String szMethod)
          This constuctor is called in both STUDIO and PROVIDER mode from InputContextFactory.

 

Method Summary
 void addParam(java.lang.String szName, java.lang.String szValue)
          Http parameters.
 void addParam(java.lang.String szName, java.lang.String[] szValues)
           
 void close()
          Relay the call down to the transport
protected  HttpTransportLiaison createHttpTransportLiaison()
          The factory method to create Transport layer
protected  HttpTransportLiaison createHttpTransportLiaison(java.lang.String className, HttpInputContext hic)
          The factory method to create Tranport layer
 java.lang.String getAuthPassword()
           
 java.lang.String getAuthRealm()
          The realm of the http authorization
 java.lang.String getAuthType()
          This method must be called first to check the supported auth type
 java.lang.String getAuthUsername()
          This method must be called before any other calls except getAuthType()
 java.lang.String getContentType()
          If the content-type is set by the caller, simply return it.
 java.lang.String getEffectiveUri()
          Returns the effective uri.
 java.util.Hashtable getHeaders()
          Headers
 java.io.InputStream getInputStream()
          This method needs to be implemented by all subclasses in case they depend on getReader from this class.
 java.lang.String getMethod()
          Http method
 java.lang.String[] getParam(java.lang.String szName)
          Return the parameter value give a name
 java.util.Enumeration getParamNames()
          Returns the enumeration of parameter names
 java.util.Hashtable getParams()
          Deep copy of the parameters since the parameter value is String array.
 java.lang.String getProxyAuthRealm()
           
 java.lang.String getProxyAuthType()
           
 java.lang.String getProxyHost()
          Proxy information
 java.lang.String getProxyPassword()
           
 int getProxyPort()
           
 java.lang.String getProxyUsername()
           
 java.lang.String getQueryString()
          Convert the hashtbale into querystring.
 java.io.Reader getReader()
          If character set is defined, let super handle it, otherwise, create our own one
 javax.servlet.http.Cookie[] getResponseCookies()
           
 java.lang.String getResponseEncoding()
          This method could return null for html, since the content-type return could be simple "text/html" However, for javascript, it should not return null, rather, it will return the default one.
 java.util.Hashtable getResponseHeaders()
           
 int getResponseStatus()
           
 TransportSessionContext getSessionContext()
           
 int getTimeConsumed()
          Get the number of milliseconds consumed for this request
 int getTimeout()
          Timeout
 HttpTransportLiaison getTransportLiaison()
          The main reason we do not have method setTransportLiaison is to support cluster.
 java.lang.String getUrl()
          Http Url which could contains querystring
 java.security.Principal getUser()
          Gets the principal -used by the TransportLiaison to much with transport
 java.lang.String getWalletLocation()
          SSL
 java.lang.String getWalletPassword()
           
 boolean isNew()
          This method tells that if this HttpInputContext is a new one (browse) or the reused one (section, clip, backwards and forwards)
 boolean isStateChanged()
          This method tells that if this HttpInputContext needs to be added into the ClippingDef.
 void open()
          Opens up the stream so that subsequent calls to getReader will be ok.
 void setAuthPassword(java.lang.String szPwd)
           
 void setAuthRealm(java.lang.String szAuthRealm)
          set in HttpClientTransportLiaison.getHeaders() which is part of the HTTP Authorization challenge.
 void setAuthType(java.lang.String szType)
          This value should be set either from 401 error or from repository
 void setAuthUsername(java.lang.String szUsername)
           
 void setHeaders(java.util.Hashtable htHeaders)
           
 void setNonStateChanged()
          Mark this HttpInputContext to be nonactive.
 void setOld()
           
 void setResponseEncoding(java.lang.String szEncoding)
          After this call, the engine will not go to external resource to retrieve response charset encoding.
 void setSessionContext(TransportSessionContext tsc)
          Http session context which could be null in the copy construtor.
 void setUrl(java.lang.String szUrl)
          Only supposed to use for SSO effective URL support
 void setUser(java.security.Principal user)
          Sets the principal so that the implementationof the HttpTransportLiaison can use that Principal to fetch other tokens required for authentication.
 java.lang.String toString()
           

 

Methods inherited from class oracle.portal.wcs.transport.AbstractInputContext
getRequestEncoding, setContentType, setRequestEncoding

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface oracle.portal.wcs.transport.InputContext
getRequestEncoding, setContentType, setRequestEncoding

 

Field Detail

m_szUrl

protected java.lang.String m_szUrl

m_szMethod

protected java.lang.String m_szMethod

m_htParams

protected java.util.Hashtable m_htParams
The parameters (name - value pair) should be encoded according to right encoding by calling WcEncoder.encodeNonAscii().

m_htHeaders

protected java.util.Hashtable m_htHeaders

m_szAuthType

protected java.lang.String m_szAuthType
The Authorization stuff for both basic and digest

m_szAuthRealm

protected java.lang.String m_szAuthRealm

m_szUsername

protected java.lang.String m_szUsername

m_szPassword

protected java.lang.String m_szPassword

m_tsc

protected TransportSessionContext m_tsc
The transport context to maintain cookies to outside

m_bActive

protected boolean m_bActive
True means it will be included in the clipping definition

m_bNew

protected boolean m_bNew
False is for reusing (SECTION, CLIPPING) in studio mode

m_props

protected HttpTransportProperties m_props
The HTTP properties, includes

m_transport

protected transient HttpTransportLiaison m_transport
The actual transport implementation to handle connection.

m_szEffectiveUri

protected java.lang.String m_szEffectiveUri
The effective URI

Constructor Detail

DefaultHttpInputContext

protected DefaultHttpInputContext()
Make subclass easy to construct
See Also:
DefaultWcrHttpInputContext

DefaultHttpInputContext

public DefaultHttpInputContext(java.lang.String szUrl)
Test constructor

DefaultHttpInputContext

public DefaultHttpInputContext(java.lang.String szUrl,
                               java.util.Hashtable htParams,
                               java.util.Hashtable htHeaders,
                               java.lang.String szMethod)
This constuctor is called in both STUDIO and PROVIDER mode from InputContextFactory. The name-value pair in parameter hashtable is not encoded yet, which is generated HttpServletUtil.inheritOrignalParams(javax.servlet.http.HttpServletRequest, java.lang.String)
Parameters:
szUrl - the url to external web site
htParams - the hashtable contains the name-value[] pair for all parameters
htHeaders - the HTTP request headers
szMethod - the HTTP request method, either GET or POST

DefaultHttpInputContext

public DefaultHttpInputContext(HttpInputContext hic)
Create a new Object, with the same TransportSessionContext, and it's always "new" and "active".

Method Detail

getTransportLiaison

public HttpTransportLiaison getTransportLiaison()
The main reason we do not have method setTransportLiaison is to support cluster. The class HttpTransportLiaison is not serializable, and we need to be able to created by its own here.
Specified by:
getTransportLiaison in interface HttpInputContext

createHttpTransportLiaison

protected HttpTransportLiaison createHttpTransportLiaison()
The factory method to create Transport layer

createHttpTransportLiaison

protected final HttpTransportLiaison createHttpTransportLiaison(java.lang.String className,
                                                                HttpInputContext hic)
The factory method to create Tranport layer

getReader

public java.io.Reader getReader()
                         throws TransportException
If character set is defined, let super handle it, otherwise, create our own one
Specified by:
getReader in interface InputContext
Overrides:
getReader in class AbstractInputContext
Throws:
TransportException

getUrl

public java.lang.String getUrl()
Http Url which could contains querystring
Specified by:
getUrl in interface InputContext
Overrides:
getUrl in class AbstractInputContext

setUrl

public void setUrl(java.lang.String szUrl)
Only supposed to use for SSO effective URL support
Specified by:
setUrl in interface HttpInputContext

setUser

public void setUser(java.security.Principal user)
Description copied from interface: HttpInputContext
Sets the principal so that the implementationof the HttpTransportLiaison can use that Principal to fetch other tokens required for authentication.
Specified by:
setUser in interface HttpInputContext

getUser

public java.security.Principal getUser()
Description copied from interface: HttpInputContext
Gets the principal -used by the TransportLiaison to much with transport
Specified by:
getUser in interface HttpInputContext

addParam

public void addParam(java.lang.String szName,
                     java.lang.String szValue)
Http parameters. The caller of this method is from WcrBrowseUrl, which retrieves the name-value pair from database. And they should be already encoded/escaped by right encoding. We support multiple values here too.
Specified by:
addParam in interface HttpInputContext
See Also:
WcrBrowseUrl.getHttpInputContext(), WcRepository.getClippingDef(oracle.portal.wcs.ClippingKey)

addParam

public void addParam(java.lang.String szName,
                     java.lang.String[] szValues)
Specified by:
addParam in interface HttpInputContext

getParamNames

public java.util.Enumeration getParamNames()
Returns the enumeration of parameter names
Specified by:
getParamNames in interface HttpInputContext

getParam

public java.lang.String[] getParam(java.lang.String szName)
Return the parameter value give a name
Specified by:
getParam in interface HttpInputContext

getMethod

public java.lang.String getMethod()
Http method
Specified by:
getMethod in interface HttpInputContext

getAuthType

public java.lang.String getAuthType()
                             throws HttpTransportException
This method must be called first to check the supported auth type

In HTTP scenaroir, there could be two levels of Authentications, one for http proxy server, and the other the actual web site. Currently, we only support one of them, i.e., you can not visit a web site needing authentication via a proxy server needing authentication too. Or, does this scenaroir exist in the real world? Can browser handler it? The one different behavior against browser is that now we can not use the HTTP Authorization header directly for Basic since the realm is not part of it. Therefore, if there are two clips access a restricted website, user needs to log in twice.

Specified by:
getAuthType in interface HttpInputContext
Throws:
- - if authentication type not equals to Basic or Digest
HttpTransportException

setAuthType

public void setAuthType(java.lang.String szType)
This value should be set either from 401 error or from repository
Specified by:
setAuthType in interface HttpInputContext

getAuthUsername

public java.lang.String getAuthUsername()
This method must be called before any other calls except getAuthType()
Specified by:
getAuthUsername in interface HttpInputContext

setAuthUsername

public void setAuthUsername(java.lang.String szUsername)
Specified by:
setAuthUsername in interface HttpInputContext

getAuthPassword

public java.lang.String getAuthPassword()
Specified by:
getAuthPassword in interface HttpInputContext

setAuthPassword

public void setAuthPassword(java.lang.String szPwd)
Specified by:
setAuthPassword in interface HttpInputContext

getAuthRealm

public java.lang.String getAuthRealm()
The realm of the http authorization
Specified by:
getAuthRealm in interface HttpInputContext

setAuthRealm

public void setAuthRealm(java.lang.String szAuthRealm)
set in HttpClientTransportLiaison.getHeaders() which is part of the HTTP Authorization challenge.
Specified by:
setAuthRealm in interface HttpInputContext

getProxyHost

public java.lang.String getProxyHost()
Proxy information
Specified by:
getProxyHost in interface HttpInputContext

getProxyPort

public int getProxyPort()
Specified by:
getProxyPort in interface HttpInputContext

getProxyUsername

public java.lang.String getProxyUsername()
Specified by:
getProxyUsername in interface HttpInputContext

getProxyPassword

public java.lang.String getProxyPassword()
Specified by:
getProxyPassword in interface HttpInputContext

getProxyAuthType

public java.lang.String getProxyAuthType()
Specified by:
getProxyAuthType in interface HttpInputContext

getProxyAuthRealm

public java.lang.String getProxyAuthRealm()
Specified by:
getProxyAuthRealm in interface HttpInputContext

getWalletLocation

public java.lang.String getWalletLocation()
SSL
Specified by:
getWalletLocation in interface HttpInputContext

getWalletPassword

public java.lang.String getWalletPassword()
Specified by:
getWalletPassword in interface HttpInputContext

getHeaders

public java.util.Hashtable getHeaders()
Headers
Specified by:
getHeaders in interface HttpInputContext

setHeaders

public void setHeaders(java.util.Hashtable htHeaders)
Specified by:
setHeaders in interface HttpInputContext

getQueryString

public java.lang.String getQueryString()
Convert the hashtbale into querystring. The output of this call must be URL encoded already since some parameter values may contain url parameters also. If we do not encoded them, HTTPClient will be confused.
Specified by:
getQueryString in interface HttpInputContext
See Also:
HttpServletUtil.inheritOrignalParams(javax.servlet.http.HttpServletRequest, java.lang.String), oracle.portal.wcs.transport.http.HttpClientTransportLiaison#getHttpResponse

setSessionContext

public void setSessionContext(TransportSessionContext tsc)
Http session context which could be null in the copy construtor. If not null, use it as the key for Cookies to be sent to http server.
Specified by:
setSessionContext in interface HttpInputContext

getSessionContext

public TransportSessionContext getSessionContext()
Specified by:
getSessionContext in interface HttpInputContext

getTimeout

public int getTimeout()
Timeout
Specified by:
getTimeout in interface HttpInputContext

getTimeConsumed

public int getTimeConsumed()
Get the number of milliseconds consumed for this request
Specified by:
getTimeConsumed in interface HttpInputContext
Specified by:
getTimeConsumed in interface InputContext
Overrides:
getTimeConsumed in class AbstractInputContext

getContentType

public java.lang.String getContentType()
                                throws TransportException
If the content-type is set by the caller, simply return it. Otherwise, let tranport layer get it. Normally, the content-type is retrieved from the server side as a HTTP header "content-type". However, for certain protocol, such as ftp, there is no content-type from the server. In such case, it's caller's resposibility to call setContentType to set a client-defined value or not to call this method at all. Otherwise, the default value defined by ContentTypeConstants.SZ_DEFAULT_CONTENT_TYPE_WITH_CHARSET is returned.
Specified by:
getContentType in interface InputContext
Overrides:
getContentType in class AbstractInputContext
Throws:
TransportException

getResponseEncoding

public java.lang.String getResponseEncoding()
                                     throws TransportException
This method could return null for html, since the content-type return could be simple "text/html" However, for javascript, it should not return null, rather, it will return the default one. In some cases, e.g., http://auctions.excite.com the content type from a javascript source is lied to "text/html", however, since we let the caller set the content type for javascript src, we honor the one from caller first.
Specified by:
getResponseEncoding in interface InputContext
Overrides:
getResponseEncoding in class AbstractInputContext
Returns:
the java encoding (corresponded of the charset) from the http header if it's valid.
Throws:
TransportException

setResponseEncoding

public void setResponseEncoding(java.lang.String szEncoding)
                         throws TransportException
Description copied from interface: InputContext
After this call, the engine will not go to external resource to retrieve response charset encoding.
Specified by:
setResponseEncoding in interface InputContext
Overrides:
setResponseEncoding in class AbstractInputContext
Throws:
TransportException

open

public void open()
          throws TransportException
Opens up the stream so that subsequent calls to getReader will be ok.
Specified by:
open in interface InputContext
Specified by:
open in class AbstractInputContext
Throws:
TransportException

close

public void close()
           throws TransportException
Relay the call down to the transport
Specified by:
close in interface InputContext
Specified by:
close in class AbstractInputContext
Throws:
TransportException

getEffectiveUri

public java.lang.String getEffectiveUri()
                                 throws TransportException
Returns the effective uri. Relay it down to the transport
Specified by:
getEffectiveUri in interface InputContext
Specified by:
getEffectiveUri in class AbstractInputContext
Throws:
TransportException

toString

public java.lang.String toString()
Specified by:
toString in interface HttpInputContext
Overrides:
toString in class java.lang.Object

getResponseHeaders

public java.util.Hashtable getResponseHeaders()
                                       throws TransportException
Specified by:
getResponseHeaders in interface HttpInputContext
Throws:
TransportException

getResponseStatus

public int getResponseStatus()
                      throws TransportException
Specified by:
getResponseStatus in interface HttpInputContext
Throws:
TransportException

getResponseCookies

public javax.servlet.http.Cookie[] getResponseCookies()
Specified by:
getResponseCookies in interface HttpInputContext

isStateChanged

public boolean isStateChanged()
This method tells that if this HttpInputContext needs to be added into the ClippingDef.
Specified by:
isStateChanged in interface HttpInputContext
See Also:
oracle.portal.wcs.model.UrlModel

setNonStateChanged

public void setNonStateChanged()
Mark this HttpInputContext to be nonactive.
Specified by:
setNonStateChanged in interface HttpInputContext
See Also:
HttpClientTransportLiaison

isNew

public boolean isNew()
This method tells that if this HttpInputContext is a new one (browse) or the reused one (section, clip, backwards and forwards)
Specified by:
isNew in interface HttpInputContext
See Also:
HttpClientTransportLiaison

setOld

public void setOld()
Specified by:
setOld in interface HttpInputContext

getInputStream

public java.io.InputStream getInputStream()
                                   throws TransportException
Description copied from class: AbstractInputContext
This method needs to be implemented by all subclasses in case they depend on getReader from this class.
Specified by:
getInputStream in interface InputContext
Specified by:
getInputStream in class AbstractInputContext
Throws:
TransportException

getParams

public java.util.Hashtable getParams()
Deep copy of the parameters since the parameter value is String array.
Specified by:
getParams in interface HttpInputContext

Skip navigation links

Oracle® WebLogic Server Web Clipping Transport API Reference
11g Release 1 (11.1.1)

E14346-01


Copyright © 2003, 2009, Oracle Corporation. All Rights Reserved