SAP NetWeaver '04

com.sapportals.wcm.util.http
Interface IContext

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
public interface IContext

Interface for user and authentication information objects in http requests. A IWDContext represents a user on which behalf connections are made. When authorization is necessary, the context is asked to calculate the credentials which shall be sent to the http server.

Copyright (c) SAP AG 2001-2002


Method Summary
 boolean appliesCredentials()
          Answer if authorization credentials are used in this context.
 boolean applyCredentials(IRequester requester, java.lang.String uri, IRequest request)
          Apply the credentials for a HTTP request.
 boolean canTriggerAuthentication(IRequester requester)
          Return if authentication responses (HTTP 401) can be triggered in this context.
 void endUse(IRequester requester)
          This context will no longer be used for the given requester
 java.lang.String getCookieHeaderValue(HttpUrl requestUri)
          Return string in HTTP header value format for cookies in this context.
 java.util.Map getCookies()
           
 UserInfo getProxyUserInfo()
          Return user info for proxy server
 ICredentials getSpecialCredentials()
          Return any installed special credentials or null if none is installed
 UserInfo getUserInfo()
          Return user info for this context.
 boolean isNew()
           
 void openedConnection(IRequester requester)
          New connection in requester was opened for this context.
 void responseCredentials(IRequester requester, IResponse response)
          Give the context the possiblity to process authenticate information in the response message, like Authenticate-Info.
 void setCookie(ICookie cookie)
          Sets a new cookie in this context
 void setProxyUserInfo(UserInfo ui)
          Sets username/password to be used in this context for proxy.
 void setSpecialCredentials(ICredentials handler)
          Set a special credentials handler which is run before any of the known authentication schemes (basic, digest) are run.
 boolean setupCredentials(IRequester requester, Headers header)
          Set the credentials for this context depending on the header information (received from a 401 response).
 boolean setupProxyCredentials(IRequester requester, Headers header)
          Set the credentials for this context depending on the header information (received from a 407 response).
 void setUserInfo(UserInfo ui)
          Sets username/password to be used in this context.
 void startUse(IRequester requester)
          This context will be used for the given requester
 

Method Detail

getUserInfo

public UserInfo getUserInfo()
Return user info for this context.
Returns:
userinfo for this context.

getProxyUserInfo

public UserInfo getProxyUserInfo()
Return user info for proxy server
Returns:
userinfo for proxy server

getCookies

public java.util.Map getCookies()
Returns:
the map of valid cookies

getCookieHeaderValue

public java.lang.String getCookieHeaderValue(HttpUrl requestUri)
Return string in HTTP header value format for cookies in this context. When no cookies are present, the method returns null .
Parameters:
requestUri - TBD: Description of the incoming method parameter
Returns:
cookies in HTTP header value format or null

isNew

public boolean isNew()

setCookie

public void setCookie(ICookie cookie)
Sets a new cookie in this context
Parameters:
cookie -  

setUserInfo

public void setUserInfo(UserInfo ui)
Sets username/password to be used in this context.
Parameters:
ui - userInfo to be set

setProxyUserInfo

public void setProxyUserInfo(UserInfo ui)
Sets username/password to be used in this context for proxy.
Parameters:
ui - proxyUserInfo to be set

appliesCredentials

public boolean appliesCredentials()
Answer if authorization credentials are used in this context.
Returns:
if authorization credentials are used in this context

applyCredentials

public boolean applyCredentials(IRequester requester,
                                java.lang.String uri,
                                IRequest request)
                         throws WcmException
Apply the credentials for a HTTP request. The type of credentials depends on the last call to setupCredentials . The credentials are applied to the request header fields.
Parameters:
uri - the requested uri
request - the request to calculate the credentials for
requester - TBD: Description of the incoming method parameter
Returns:
if credentials have been added to the header fields
Throws:
WcmException - Exception raised in failure situation

setupCredentials

public boolean setupCredentials(IRequester requester,
                                Headers header)
                         throws WcmException
Set the credentials for this context depending on the header information (received from a 401 response). The header is assumed to containt one ore more WWW-Authenticate headers, which indicate the authorization schemes the server understands.
Parameters:
requester - TBD: Description of the incoming method parameter
header - TBD: Description of the incoming method parameter
Returns:
if successful
Throws:
WcmException - Exception raised in failure situation

setupProxyCredentials

public boolean setupProxyCredentials(IRequester requester,
                                     Headers header)
                              throws WcmException
Set the credentials for this context depending on the header information (received from a 407 response). The header is assumed to containt one ore more Proxy-Authenticate headers, which indicate the authorization schemes the server understands.
Parameters:
requester - TBD: Description of the incoming method parameter
header - TBD: Description of the incoming method parameter
Returns:
if successful
Throws:
WcmException - Exception raised in failure situation

responseCredentials

public void responseCredentials(IRequester requester,
                                IResponse response)
                         throws WcmException
Give the context the possiblity to process authenticate information in the response message, like Authenticate-Info.
Parameters:
requester - TBD: Description of the incoming method parameter
response - TBD: Description of the incoming method parameter
Throws:
WcmException - Exception raised in failure situation

setSpecialCredentials

public void setSpecialCredentials(ICredentials handler)
Set a special credentials handler which is run before any of the known authentication schemes (basic, digest) are run.
Parameters:
handler - to installed (or null to remove)

getSpecialCredentials

public ICredentials getSpecialCredentials()
Return any installed special credentials or null if none is installed
Returns:
installed special credentials handler

openedConnection

public void openedConnection(IRequester requester)
New connection in requester was opened for this context.
Parameters:
requester - which opened new connection

startUse

public void startUse(IRequester requester)
This context will be used for the given requester
Parameters:
requester -  

endUse

public void endUse(IRequester requester)
This context will no longer be used for the given requester
Parameters:
requester -  

canTriggerAuthentication

public boolean canTriggerAuthentication(IRequester requester)
Return if authentication responses (HTTP 401) can be triggered in this context.
Parameters:
requester - to work in
Returns:
TBD: Description of the outgoing return value

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.