Class HttpRequestHashGenerator
- java.lang.Object
-
- org.wso2.carbon.mediator.cache.digest.HttpRequestHashGenerator
-
- All Implemented Interfaces:
Serializable
,DigestGenerator
public class HttpRequestHashGenerator extends Object implements DigestGenerator
TheDigestGenerator
for the HTTP protocol type.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HttpRequestHashGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection
getAttributesWithoutNS(org.apache.axiom.om.OMElement element)
Gets the collection of attributes which are none namespace declarations for an OMElement sorted according to the expanded names of the attributes.byte[]
getDigest(String toAddress, String digestAlgorithm)
For the digest generation using the to address.byte[]
getDigest(String key, String value, String digestAlgorithm)
byte[]
getDigest(org.apache.axiom.om.OMAttribute attribute, String digestAlgorithm)
This is an overloaded method for the digest generation for OMAttribute.byte[]
getDigest(org.apache.axiom.om.OMElement element, String toAddress, Map<String,String> headers, String digestAlgorithm)
This is an overloaded method for the digest generation for OMElement.byte[]
getDigest(org.apache.axiom.om.OMNode node, String digestAlgorithm)
This is an overloaded method for the digest generation for OMNode.byte[]
getDigest(org.apache.axiom.om.OMNode node, String toAddress, Map<String,String> headers, String digestAlgorithm)
This is an overloaded method for the digest generation for OMNode and request.byte[]
getDigest(org.apache.axiom.om.OMProcessingInstruction pi, String digestAlgorithm)
This method is an overloaded method for the digest generation for OMProcessingInstruction.byte[]
getDigest(org.apache.axiom.om.OMText text, String digestAlgorithm)
This method is an overloaded method for the digest generation for OMText.String
getDigest(org.apache.axis2.context.MessageContext msgContext)
This method will be implemented to return the unique XML node identifier on the given XML nodeString
getExpandedName(org.apache.axiom.om.OMAttribute attribute)
This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for OMAttribute.String
getExpandedName(org.apache.axiom.om.OMElement element)
This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for OMElement.String
getStringRepresentation(byte[] array)
Gets the String representation of the byte array.void
init(Map<String,Object> properties)
If more properties are needed to generate the hash other than theMessageContext
it can be initialized via this method
-
-
-
Method Detail
-
getDigest
public String getDigest(org.apache.axis2.context.MessageContext msgContext) throws CachingException
This method will be implemented to return the unique XML node identifier on the given XML node- Specified by:
getDigest
in interfaceDigestGenerator
- Parameters:
msgContext
- - MessageContext on which the unique identifier will be generated- Returns:
- Object representing the unique identifier for the msgContext
- Throws:
CachingException
- if there is an error in generating the digest key
-
getDigest
public byte[] getDigest(String toAddress, String digestAlgorithm) throws CachingException
For the digest generation using the to address.- Parameters:
toAddress
- Request To address to be subjected to the key generationdigestAlgorithm
- digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the toAddress
- Throws:
CachingException
- if there is an error in generating the digest
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMNode node, String digestAlgorithm) throws CachingException
This is an overloaded method for the digest generation for OMNode.- Parameters:
node
- - OMNode to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] c node
- Throws:
CachingException
- if there is an error in generating the digest
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMNode node, String toAddress, Map<String,String> headers, String digestAlgorithm) throws CachingException
This is an overloaded method for the digest generation for OMNode and request.- Parameters:
node
- - OMNode to be subjected to the key generationtoAddress
- - Request To address to be subjected to the key generationheaders
- - Header parameters to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the provided node
- Throws:
CachingException
- if there is an error in generating the digest
-
getDigest
public byte[] getDigest(String key, String value, String digestAlgorithm) throws CachingException
- Throws:
CachingException
-
getStringRepresentation
public String getStringRepresentation(byte[] array)
Gets the String representation of the byte array.- Parameters:
array
- - byte[] of which the String representation is required- Returns:
- the String representation of the byte[]
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMElement element, String toAddress, Map<String,String> headers, String digestAlgorithm) throws CachingException
This is an overloaded method for the digest generation for OMElement.- Parameters:
element
- - OMElement to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the provided element
- Throws:
CachingException
- if there is an io error or the specified algorithm is incorrect
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMText text, String digestAlgorithm) throws CachingException
This method is an overloaded method for the digest generation for OMText.- Parameters:
text
- - OMText to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the provided text
- Throws:
CachingException
- if the specified algorithm is incorrect or the encoding is not supported by the processor
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMProcessingInstruction pi, String digestAlgorithm) throws CachingException
This method is an overloaded method for the digest generation for OMProcessingInstruction.- Parameters:
pi
- - OMProcessingInstruction to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the provided pi
- Throws:
CachingException
- if the specified algorithm is incorrect or the encoding is not supported by the processor
-
getDigest
public byte[] getDigest(org.apache.axiom.om.OMAttribute attribute, String digestAlgorithm) throws CachingException
This is an overloaded method for the digest generation for OMAttribute.- Parameters:
attribute
- - OMAttribute to be subjected to the key generationdigestAlgorithm
- - digest algorithm as a String- Returns:
- byte[] representing the calculated digest over the provided attribute
- Throws:
CachingException
- if the specified algorithm is incorrect or the encoding is not supported by the processor
-
getExpandedName
public String getExpandedName(org.apache.axiom.om.OMElement element)
This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for OMElement.- Parameters:
element
- - OMElement of which the expanded name is retrieved- Returns:
- expanded name of OMElement as an String in the form {ns-uri:local-name}
-
getExpandedName
public String getExpandedName(org.apache.axiom.om.OMAttribute attribute)
This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for OMAttribute.- Parameters:
attribute
- - OMAttribute of which the expanded name is retrieved- Returns:
- expanded name of the OMAttribute as an String in the form {ns-uri:local-name}
-
getAttributesWithoutNS
public Collection getAttributesWithoutNS(org.apache.axiom.om.OMElement element)
Gets the collection of attributes which are none namespace declarations for an OMElement sorted according to the expanded names of the attributes.- Parameters:
element
- - OMElement of which the none ns declaration attributes to be retrieved- Returns:
- the collection of attributes which are none namespace declarations
-
init
public void init(Map<String,Object> properties)
Description copied from interface:DigestGenerator
If more properties are needed to generate the hash other than theMessageContext
it can be initialized via this method- Specified by:
init
in interfaceDigestGenerator
- Parameters:
properties
- A list of other properties used to generate the hash
-
-