org.opensaml.ws.transport.http
Class HttpServletResponseAdapter

java.lang.Object
  extended by org.opensaml.ws.transport.http.HttpServletResponseAdapter
All Implemented Interfaces:
HTTPOutTransport, HTTPTransport, OutTransport, Transport

public class HttpServletResponseAdapter
extends java.lang.Object
implements HTTPOutTransport

Adapts an HttpServletResponse to an HTTPOutTransport.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opensaml.ws.transport.http.HTTPTransport
HTTPTransport.HTTP_VERSION
 
Constructor Summary
HttpServletResponseAdapter(javax.servlet.http.HttpServletResponse response, boolean isSecure)
          Constructor.
 
Method Summary
 void addParameter(java.lang.String name, java.lang.String value)
          Sets the given parameter with the given value.
 java.lang.Object getAttribute(java.lang.String name)
          Gets a transport-specific attribute.
 java.lang.String getCharacterEncoding()
          Gets the character encoding of the transport.
 java.lang.String getHeaderValue(java.lang.String name)
          Gets the first value of the header with the given name.
 java.lang.String getHTTPMethod()
          Gets the HTTP method (POST, GET, etc) used.
 org.opensaml.xml.security.credential.Credential getLocalCredential()
          Gets the local credential used to authenticate to the peer.
 java.io.OutputStream getOutgoingStream()
          Gets the outgoing data stream to the peer.
 java.lang.String getParameterValue(java.lang.String name)
          Gets the first value of the named parameter.
 java.util.List<java.lang.String> getParameterValues(java.lang.String name)
          Gets the values of the named parameter.
 org.opensaml.xml.security.credential.Credential getPeerCredential()
          Gets the credential offered by the peer to authenticate itself.
 int getStatusCode()
          Gets the status code of the request.
 HTTPTransport.HTTP_VERSION getVersion()
          Gets the HTTP version used to receive the message.
 javax.servlet.http.HttpServletResponse getWrappedResponse()
          Gets the adapted response.
 boolean isAuthenticated()
          Gets whether the peer is authenticated.
 boolean isConfidential()
          Gets whether the transport represents a confidential connection (e.g.
 boolean isIntegrityProtected()
          Gets whether the transport represents a connection that protects the integrity of transported content.
 void sendRedirect(java.lang.String location)
          Sends an HTTP 3XX redirect message back to the client.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets a transport-specific attribute.
 void setAuthenticated(boolean isAuthenticated)
          Sets whether the peer is authenticated.
 void setCharacterEncoding(java.lang.String encoding)
          Sets the character encoding of the transport.
 void setConfidential(boolean isConfidential)
          Sets whether the transport represents a confidential connection.
 void setHeader(java.lang.String name, java.lang.String value)
          Sets the given header with the given value.
 void setIntegrityProtected(boolean isIntegrityProtected)
          Sets whether the transport represents a connection that protects the integrity of transported content.
 void setStatusCode(int code)
          Sets the status code for this transport.
 void setVersion(HTTPTransport.HTTP_VERSION version)
          Sets the HTTP version to use for outgoing messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServletResponseAdapter

public HttpServletResponseAdapter(javax.servlet.http.HttpServletResponse response,
                                  boolean isSecure)
Constructor.

Parameters:
response - servlet response to adapt
isSecure - whether the outbound connection is protected by SSL/TLS
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Gets a transport-specific attribute. This method is not supported for this transport implementation and always returns null.

Specified by:
getAttribute in interface Transport
Parameters:
name - name of the attribute
Returns:
attribute value

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Gets the character encoding of the transport.

Specified by:
getCharacterEncoding in interface Transport
Returns:
character encoding of the transport

getHeaderValue

public java.lang.String getHeaderValue(java.lang.String name)
Gets the first value of the header with the given name. This method is not supported for this transport implementation.

Specified by:
getHeaderValue in interface HTTPTransport
Parameters:
name - header name
Returns:
first value of the header with the given name, or null

getHTTPMethod

public java.lang.String getHTTPMethod()
Gets the HTTP method (POST, GET, etc) used. This method is not supported for this transport implementation.

Specified by:
getHTTPMethod in interface HTTPTransport
Returns:
HTTP method used

getLocalCredential

public org.opensaml.xml.security.credential.Credential getLocalCredential()
Gets the local credential used to authenticate to the peer.

Specified by:
getLocalCredential in interface Transport
Returns:
local credential used to authenticate to the peer

getOutgoingStream

public java.io.OutputStream getOutgoingStream()
Gets the outgoing data stream to the peer.

Specified by:
getOutgoingStream in interface OutTransport
Returns:
outgoing data stream to the peer

getParameterValue

public java.lang.String getParameterValue(java.lang.String name)
Gets the first value of the named parameter. If the request is GET, this is a decoded URL parameter. If the request is POST-based, it is a parameter from the POST body. This method is not supported for this transport implementation.

Specified by:
getParameterValue in interface HTTPTransport
Parameters:
name - parameter name
Returns:
parameter value

getParameterValues

public java.util.List<java.lang.String> getParameterValues(java.lang.String name)
Gets the values of the named parameter. If the request is GET, this is a decoded URL parameter. If the request is POST-based, it is a parameter from the POST body.

Specified by:
getParameterValues in interface HTTPTransport
Parameters:
name - parameter name
Returns:
parameter values

getPeerCredential

public org.opensaml.xml.security.credential.Credential getPeerCredential()
Gets the credential offered by the peer to authenticate itself.

Specified by:
getPeerCredential in interface Transport
Returns:
credential offered by the peer to authenticate itself

getStatusCode

public int getStatusCode()
Gets the status code of the request. This method is not supported for this transport implementation.

Specified by:
getStatusCode in interface HTTPTransport
Returns:
status code of the request

getVersion

public HTTPTransport.HTTP_VERSION getVersion()
Gets the HTTP version used to receive the message. This method is not supported for this transport implementation.

Specified by:
getVersion in interface HTTPTransport
Returns:
HTTP version used to receive the message

getWrappedResponse

public javax.servlet.http.HttpServletResponse getWrappedResponse()
Gets the adapted response.

Returns:
adapted response

isAuthenticated

public boolean isAuthenticated()
Gets whether the peer is authenticated.

Specified by:
isAuthenticated in interface Transport
Returns:
whether the peer is authenticated

isConfidential

public boolean isConfidential()
Gets whether the transport represents a confidential connection (e.g. an SSL connection). This method is not supported for this transport implementation and always returns false.

Specified by:
isConfidential in interface Transport
Returns:
whether the transport represents a confidential connection

sendRedirect

public void sendRedirect(java.lang.String location)
Sends an HTTP 3XX redirect message back to the client.

Specified by:
sendRedirect in interface HTTPOutTransport
Parameters:
location - location to redirect the client to

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets a transport-specific attribute. This method is not supported for this transport implementation.

Specified by:
setAttribute in interface OutTransport
Parameters:
name - attribute name
value - attribute value

setAuthenticated

public void setAuthenticated(boolean isAuthenticated)
Sets whether the peer is authenticated.

Specified by:
setAuthenticated in interface Transport
Parameters:
isAuthenticated - whether the peer is authenticated

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
Sets the character encoding of the transport.

Specified by:
setCharacterEncoding in interface OutTransport
Parameters:
encoding - character encoding of the transport

setConfidential

public void setConfidential(boolean isConfidential)
Sets whether the transport represents a confidential connection. This method is not supported for this transport implementation.

Specified by:
setConfidential in interface Transport
Parameters:
isConfidential - whether the transport represents a confidential connection

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Sets the given header with the given value.

Specified by:
setHeader in interface HTTPOutTransport
Parameters:
name - header name
value - header value

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Sets the given parameter with the given value. This method is not supported for this transport implementation.

Specified by:
addParameter in interface HTTPOutTransport
Parameters:
name - parameter name
value - parameter value

setStatusCode

public void setStatusCode(int code)
Sets the status code for this transport.

Specified by:
setStatusCode in interface HTTPOutTransport
Parameters:
code - status code for this transport

setVersion

public void setVersion(HTTPTransport.HTTP_VERSION version)
Sets the HTTP version to use for outgoing messages. This method is not supported for this transport implementation.

Specified by:
setVersion in interface HTTPOutTransport
Parameters:
version - HTTP version to use for outgoing messages

isIntegrityProtected

public boolean isIntegrityProtected()
Gets whether the transport represents a connection that protects the integrity of transported content.

Specified by:
isIntegrityProtected in interface Transport
Returns:
whether the transport represents a connection that protects the integrity of transported content

setIntegrityProtected

public void setIntegrityProtected(boolean isIntegrityProtected)
Sets whether the transport represents a connection that protects the integrity of transported content.

Specified by:
setIntegrityProtected in interface Transport
Parameters:
isIntegrityProtected - whether the transport represents a connection that protects the integrity of transported content


Copyright © 2006-2009 Internet2. All Rights Reserved.