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 HttpClientTransportLiaison

java.lang.Object
  extended by oracle.portal.wcs.transport.http.HttpClientTransportLiaison

All Implemented Interfaces:
HttpHeaderConstants, WcExceptionConstants, HttpTransportLiaison
Direct Known Subclasses:
HttpClientProviderTransportLiaison, HttpClientStudioTransportLiaison

public abstract class HttpClientTransportLiaison
extends java.lang.Object
implements HttpTransportLiaison, HttpHeaderConstants, WcExceptionConstants

This implementation of handing HTTP connection is based on HTTPClient. This HTTP request is defined in HttpInputContext


Field Summary
protected  HTTPClient.HTTPConnection m_conn
          HTTPClient.HTTPConnection
protected  HttpInputContext m_ctx
          The information needed to open HTTPConnection
protected  java.util.Hashtable m_htHeaders
           
protected  java.io.InputStream m_is
           
protected  int m_iStatusCode
           
protected  int m_iTimeConsumed
           
protected  java.lang.String m_remoteHost
           
protected  java.lang.String m_szContentType
           
protected  java.lang.String m_szEffectiveUri
           
protected  HTTPClient.URI m_uri
          The URI representation for URL from HttpInputContext

 

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.exmsgs.WcExceptionConstants
AUTH_DECODING_FAILED, CLIP_CHECK_FAILED, CLIP_DEF_LOOKUP_FAILURE_UTF8_CONV, CLIP_DEF_NOT_FOUND, CLIP_NOT_FOUND, ENCODING_SET_TWICE_ERROR, EXPIMP_BASE, EXPIMP_INVALID_VERSION, EXPIMP_ROOT_NOT_CLIPPING_DEF, GENERIC_TRANSPORT_ERROR, HTML_PARSE_FAILED, HTTP_AUTH_FAILED, HTTP_INVALID_URI_ERROR, HTTP_NOT_ALLOWED_TO_ACCESS, HTTP_PROXY_AUTH_FAILED, HTTP_TRANSPORT_ERROR, HTTP_TRANSPORT_STATUS_ERROR, HTTPS_NOT_SUPPORTED, HTTPS_TRANSPORT_ERROR, ILLEGAL_REQUEST, INVALID_ACTION, INVALID_CLIPPING_KEY, INVALID_MODE, IO_OP_FAILED, JS_PARSE_FAILED, NO_ACTION_DEFINED, PORTAL_EDIT_URL_MISSING, RAA_SCHEMA_INIT_FAILED, RAA_SCHEMA_NOT_EXIST, REPOSITORY_NOT_INSTALLED, REPOSITORY_OP_FAILED, SESSION_CLEANED, SESSION_TIMEOUT, SET_ENCODING_TWICE_ERROR, TRANSPORT_TIMEOUT_ERROR, UNDEFINED_CONTENT_TYPE, UNDEFINED_NODE_RELATION, UNSUPPORTED_ENCODING, UNSUPPORTED_HTTP_AUTH, UNSUPPORTED_HTTP_OP, UNSUPPORTED_MIME_CHARSET, UNSUPPORTED_REQ_CONTENT_TYPE, UNSUPPORTED_RSRC_CONTENT_TYPE

 

Constructor Summary
protected HttpClientTransportLiaison(HttpInputContext ctx)
          Can only be called from this package

 

Method Summary
protected abstract  void addRequestHeaders(java.util.Vector vctHeaders)
          This method is to be implemented by subclasses to add their own request headers.
 void close()
          close the connection by closing the InputStream and resetting the membder variables.
 java.lang.String encodeBasicAuthorization(java.lang.String szUsername, java.lang.String szPassword)
          Deprecated.  
 HttpAuthorizationInfo getAuthorizationInfo()
          This method is currently only called by the subclass HttpClientProviderTransportLiaison.
 java.lang.String getContentType()
          Return the content type
 java.lang.String getEffectiveUri()
          Get the effective uri string in external form.
 java.util.Hashtable getHeaders()
          Pass the header from response to browser
 java.io.InputStream getInputStream()
          return the input stream
 javax.servlet.http.Cookie[] getResponseCookies()
          Return response cookie in javax.servlet.http.Cookie format
 int getStatus()
           
 int getTimeConsumed()
          Returns the time consumed for fetching the current URL.
protected  void handleAuthChallenge(java.util.Hashtable htHeaders, java.lang.String szChallenge)
          Save the authorization scheme and realm back to HttpInputContext.
protected  void handleError()
           
protected abstract  void handleStatusCode(int iStatusCode, java.lang.String szReasonLine)
          Let my children handle their own interpretation of the status code.
 void open()
          This method creates the HTTPConnection and get the HTTPResponse.
 void setRemoteHost(java.lang.String reHost)
           
protected abstract  void setupHttpAuthorization()
          Setup the HTTP Authorization information via TransportSessionContext.
protected  void setupProxyAuthorization()
          Always do this

 

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

 

Field Detail

m_ctx

protected HttpInputContext m_ctx
The information needed to open HTTPConnection

m_conn

protected HTTPClient.HTTPConnection m_conn
HTTPClient.HTTPConnection

m_remoteHost

protected java.lang.String m_remoteHost

m_is

protected java.io.InputStream m_is

m_szContentType

protected java.lang.String m_szContentType

m_szEffectiveUri

protected java.lang.String m_szEffectiveUri

m_htHeaders

protected java.util.Hashtable m_htHeaders

m_iStatusCode

protected int m_iStatusCode

m_iTimeConsumed

protected int m_iTimeConsumed

m_uri

protected HTTPClient.URI m_uri
The URI representation for URL from HttpInputContext

Constructor Detail

HttpClientTransportLiaison

protected HttpClientTransportLiaison(HttpInputContext ctx)
Can only be called from this package

Method Detail

setRemoteHost

public void setRemoteHost(java.lang.String reHost)

open

public void open()
          throws TransportException
This method creates the HTTPConnection and get the HTTPResponse.
Specified by:
open in interface HttpTransportLiaison
Throws:
TransportException

getInputStream

public java.io.InputStream getInputStream()
                                   throws TransportException
return the input stream
Specified by:
getInputStream in interface HttpTransportLiaison
Throws:
TransportException

getEffectiveUri

public java.lang.String getEffectiveUri()
                                 throws TransportException
Get the effective uri string in external form.
Specified by:
getEffectiveUri in interface HttpTransportLiaison
Throws:
TransportException

getContentType

public java.lang.String getContentType()
                                throws TransportException
Description copied from interface: HttpTransportLiaison
Return the content type
Specified by:
getContentType in interface HttpTransportLiaison
Throws:
TransportException

getHeaders

public java.util.Hashtable getHeaders()
                               throws TransportException
Pass the header from response to browser
Specified by:
getHeaders in interface HttpTransportLiaison
Throws:
TransportException

getStatus

public int getStatus()
              throws TransportException
Specified by:
getStatus in interface HttpTransportLiaison
Throws:
TransportException

handleAuthChallenge

protected void handleAuthChallenge(java.util.Hashtable htHeaders,
                                   java.lang.String szChallenge)
Save the authorization scheme and realm back to HttpInputContext. If the scheme is Digest, we rewrite the header to be Basic (MITM) so as to get the user password. The challegne is in format of
Parameters:
htHeaders - HTTP headers retrieved from the HTTP connection response. this method allows for modifying that list of HTTP headers like described above for Digest authentication.
szChallenge - HTTP Header WWW-Authenticate value, which indicates the HTTP authenticate challenge type - Basic, Digest, as well as other authentication related information like realm.

close

public void close()
           throws TransportException
close the connection by closing the InputStream and resetting the membder variables.
Specified by:
close in interface HttpTransportLiaison
Throws:
TransportException
See Also:
HttpInputContext

setupProxyAuthorization

protected void setupProxyAuthorization()
                                throws HttpTransportException
Always do this
Throws:
HttpTransportException

setupHttpAuthorization

protected abstract void setupHttpAuthorization()
                                        throws HttpTransportException
Setup the HTTP Authorization information via TransportSessionContext. The reason why we do not support Digest Authentication right now (copied from RFC-2617) First, the WWW-Authenticate header of the server's initial 401 response contains a few more name-value pairs beyond the realm string, including a value called a nonce. It is the server's responsibility to make sure that every 401 response comes with a unique, previously unused nonce value. The Authentication header of your browsers follow-up request contains your clear-text username, the nonce value it just received, and the so-called digest-request According to RFC-2617, This should be the header we got from web server: HTTP/1.1 401 Unauthorized WWW-Authenticate: Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="5ccc069c403ebaf9f0171e9517f40e41" here should be the HTTP header we got from browser Authorization: Digest username="Mufasa", realm="testrealm@host.com", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="/dir/index.html", qop=auth, nc=00000001, cnonce="0a4f113b", response="6629fae49393a05397450978507c4ef1", opaque="5ccc069c403ebaf9f0171e9517f40e41" An implementation might choose not to accept a previously used nonce or a previously used digest, in order to protect against a replay attack. From a simple test of Digest Authorization, it seems to me that IE6.0 and netscape6.2 does not work with Apache mod_digest module. I have tested new mod_auth_digest module yet. However, it seems that we can not support Digest as the same way as the Basic, since the password is need in either way
Throws:
- - if auth type(scheme) is not Basic or Digest
HttpTransportException

handleError

protected void handleError()

handleStatusCode

protected abstract void handleStatusCode(int iStatusCode,
                                         java.lang.String szReasonLine)
                                  throws TransportException
Let my children handle their own interpretation of the status code.
Throws:
TransportException

getTimeConsumed

public int getTimeConsumed()
Returns the time consumed for fetching the current URL.
Specified by:
getTimeConsumed in interface HttpTransportLiaison
Returns:
Time consumed after receiving a status code of HTTP 200

addRequestHeaders

protected abstract void addRequestHeaders(java.util.Vector vctHeaders)
This method is to be implemented by subclasses to add their own request headers.

encodeBasicAuthorization

public java.lang.String encodeBasicAuthorization(java.lang.String szUsername,
                                                 java.lang.String szPassword)
Deprecated. 
Returns the HTTP-basic encoded authorization string given the supplied username and password
Parameters:
szUsername - username to be encoded
szPassword - password to be encoded
Returns:
Encoded string comprised of the username and the password, encoded in BASE 64

getResponseCookies

public javax.servlet.http.Cookie[] getResponseCookies()
Return response cookie in javax.servlet.http.Cookie format
Specified by:
getResponseCookies in interface HttpTransportLiaison
Returns:
An array of Cookies retrieved from the HTTP response

getAuthorizationInfo

public HttpAuthorizationInfo getAuthorizationInfo()
                                           throws HttpTransportException
This method is currently only called by the subclass HttpClientProviderTransportLiaison. We can make it protected. This is not to be confused with the authorization info of the proxy The reason we need to call Transport layer to retrieve the AuthorizationInfo is to avoid throw HTTP_INVALID_URI_ERROR exception
Specified by:
getAuthorizationInfo in interface HttpTransportLiaison
Throws:
HttpTransportException

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