org.apache.sling.discovery.impl.topology.connector
Class TopologyRequestValidator

java.lang.Object
  extended by org.apache.sling.discovery.impl.topology.connector.TopologyRequestValidator

public class TopologyRequestValidator
extends Object

Request Validator helper.


Field Summary
static String HASH_HEADER
           
static String SIG_HEADER
           
 
Constructor Summary
TopologyRequestValidator(Config config)
          Create a TopologyRequestValidator.
 
Method Summary
 String decodeMessage(org.apache.commons.httpclient.HttpMethod method)
          Decode a response from the server.
 String decodeMessage(javax.servlet.http.HttpServletRequest request)
          Decode a message sent from the client.
 String encodeMessage(String body)
          Encodes a request returning the encoded body
 boolean isTrusted(org.apache.commons.httpclient.HttpMethod method)
          Is the response from the server to be trusted by the client.
 boolean isTrusted(javax.servlet.http.HttpServletRequest request)
          Is the request from the client trusted, based on the signature headers.
 void trustMessage(org.apache.commons.httpclient.HttpMethod method, String body)
          Trust a message on the client before sending, only if trust is enabled.
 void trustMessage(javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, String body)
          Trust a response message sent from the server to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIG_HEADER

public static final String SIG_HEADER
See Also:
Constant Field Values

HASH_HEADER

public static final String HASH_HEADER
See Also:
Constant Field Values
Constructor Detail

TopologyRequestValidator

public TopologyRequestValidator(Config config)
Create a TopologyRequestValidator.

Parameters:
config - the configuation object
Method Detail

encodeMessage

public String encodeMessage(String body)
                     throws IOException
Encodes a request returning the encoded body

Parameters:
body -
Returns:
the encoded body.
Throws:
IOException

decodeMessage

public String decodeMessage(javax.servlet.http.HttpServletRequest request)
                     throws IOException
Decode a message sent from the client.

Parameters:
request - the request object for the message.
Returns:
the message in clear text.
Throws:
IOException - if there is a problem decoding the message or the message is invalid.

decodeMessage

public String decodeMessage(org.apache.commons.httpclient.HttpMethod method)
                     throws IOException
Decode a response from the server.

Parameters:
method - the method that received the response.
Returns:
the message in clear text.
Throws:
IOException - if there was a problem decoding the message.

isTrusted

public boolean isTrusted(javax.servlet.http.HttpServletRequest request)
Is the request from the client trusted, based on the signature headers.

Parameters:
request - the request.
Returns:
true if trusted, or true if this component is disabled.

isTrusted

public boolean isTrusted(org.apache.commons.httpclient.HttpMethod method)
Is the response from the server to be trusted by the client.

Parameters:
method - the client method.
Returns:
true if trusted, or true if this component is disabled.

trustMessage

public void trustMessage(org.apache.commons.httpclient.HttpMethod method,
                         String body)
Trust a message on the client before sending, only if trust is enabled.

Parameters:
method - the method which will have headers set after the call.
body - the body.

trustMessage

public void trustMessage(javax.servlet.http.HttpServletResponse response,
                         javax.servlet.http.HttpServletRequest request,
                         String body)
Trust a response message sent from the server to the client.

Parameters:
response - the response.
request - the request,
body - body of the response.


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.