Class HTTPPostEncoder
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.messaging.encoder.AbstractMessageEncoder
-
- org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder
-
- org.opensaml.messaging.encoder.servlet.BaseHttpServletResponseXMLMessageEncoder
-
- org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder
-
- org.opensaml.saml.saml2.binding.encoding.impl.HTTPPostEncoder
-
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,UnmodifiableComponent
,MessageEncoder
,HttpServletResponseMessageEncoder
,SAMLMessageEncoder
- Direct Known Subclasses:
HTTPPostSimpleSignEncoder
public class HTTPPostEncoder extends BaseSAML2MessageEncoder
SAML 2.0 HTTP Post binding message encoder.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_TEMPLATE_ID
Default template ID.private org.slf4j.Logger
log
Class logger.private org.apache.velocity.app.VelocityEngine
velocityEngine
Velocity engine used to evaluate the template when performing POST encoding.private String
velocityTemplateId
ID of the Velocity template used when performing POST encoding.
-
Constructor Summary
Constructors Constructor Description HTTPPostEncoder()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doDestroy()
protected void
doEncode()
protected void
doInitialize()
String
getBindingURI()
org.apache.velocity.app.VelocityEngine
getVelocityEngine()
Get the VelocityEngine instance.String
getVelocityTemplateId()
Get the Velocity template id.protected void
populateVelocityContext(org.apache.velocity.VelocityContext velocityContext, MessageContext messageContext, String endpointURL)
Populate the Velocity context instance which will be used to render the POST body.protected void
postEncode(MessageContext messageContext, String endpointURL)
Base64 and POST encodes the outbound message and writes it to the outbound transport.void
setVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine)
Set the VelocityEngine instance.void
setVelocityTemplateId(String newVelocityTemplateId)
Set the Velocity template id.-
Methods inherited from class org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder
getEndpointURL
-
Methods inherited from class org.opensaml.messaging.encoder.servlet.BaseHttpServletResponseXMLMessageEncoder
encode, getMessageToLog, logEncodedMessage, marshallMessage
-
Methods inherited from class org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder
getHttpServletResponse, setHttpServletResponse
-
Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
getMessageContext, prepareContext, setMessageContext
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Methods inherited from interface org.opensaml.messaging.encoder.MessageEncoder
encode, prepareContext, setMessageContext
-
-
-
-
Field Detail
-
DEFAULT_TEMPLATE_ID
public static final String DEFAULT_TEMPLATE_ID
Default template ID.- See Also:
- Constant Field Values
-
log
private final org.slf4j.Logger log
Class logger.
-
velocityEngine
private org.apache.velocity.app.VelocityEngine velocityEngine
Velocity engine used to evaluate the template when performing POST encoding.
-
velocityTemplateId
private String velocityTemplateId
ID of the Velocity template used when performing POST encoding.
-
-
Method Detail
-
getBindingURI
public String getBindingURI()
-
getVelocityEngine
public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Get the VelocityEngine instance.- Returns:
- return the VelocityEngine instance
-
setVelocityEngine
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine newVelocityEngine)
Set the VelocityEngine instance.- Parameters:
newVelocityEngine
- the new VelocityEngine instane
-
getVelocityTemplateId
public String getVelocityTemplateId()
Get the Velocity template id.Defaults to
DEFAULT_TEMPLATE_ID
.- Returns:
- return the Velocity template id
-
setVelocityTemplateId
public void setVelocityTemplateId(String newVelocityTemplateId)
Set the Velocity template id.Defaults to
DEFAULT_TEMPLATE_ID
.- Parameters:
newVelocityTemplateId
- the new Velocity template id
-
doDestroy
protected void doDestroy()
- Overrides:
doDestroy
in classAbstractHttpServletResponseMessageEncoder
-
doInitialize
protected void doInitialize() throws ComponentInitializationException
- Overrides:
doInitialize
in classAbstractHttpServletResponseMessageEncoder
- Throws:
ComponentInitializationException
-
doEncode
protected void doEncode() throws MessageEncodingException
- Specified by:
doEncode
in classAbstractMessageEncoder
- Throws:
MessageEncodingException
-
postEncode
protected void postEncode(MessageContext messageContext, String endpointURL) throws MessageEncodingException
Base64 and POST encodes the outbound message and writes it to the outbound transport.- Parameters:
messageContext
- current message contextendpointURL
- endpoint URL to which to encode message- Throws:
MessageEncodingException
- thrown if there is a problem encoding the message
-
populateVelocityContext
protected void populateVelocityContext(org.apache.velocity.VelocityContext velocityContext, MessageContext messageContext, String endpointURL) throws MessageEncodingException
Populate the Velocity context instance which will be used to render the POST body.- Parameters:
velocityContext
- the Velocity context instance to populate with datamessageContext
- the SAML message context source of dataendpointURL
- endpoint URL to which to encode message- Throws:
MessageEncodingException
- thrown if there is a problem encoding the message
-
-