Class TopologyRequestValidator
java.lang.Object
org.apache.sling.discovery.base.connectors.ping.TopologyRequestValidator
Request Validator helper.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTopologyRequestValidator(BaseConfig config) Create a TopologyRequestValidator. -
Method Summary
Modifier and TypeMethodDescriptiondecodeMessage(String uri, org.apache.http.HttpResponse response) Decode a response from the server.decodeMessage(javax.servlet.http.HttpServletRequest request) Decode a message sent from the client.encodeMessage(String body) Encodes a request returning the encoded bodybooleanisTrusted(javax.servlet.http.HttpServletRequest request) Is the request from the client trusted, based on the signature headers.booleanisTrusted(org.apache.http.HttpResponse response) Is the response from the server to be trusted by the client.voidtrustMessage(javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, String body) Trust a response message sent from the server to the client.voidtrustMessage(org.apache.http.client.methods.HttpUriRequest method, String body) Trust a message on the client before sending, only if trust is enabled.
-
Field Details
-
SIG_HEADER
- See Also:
-
HASH_HEADER
- See Also:
-
-
Constructor Details
-
TopologyRequestValidator
Create a TopologyRequestValidator.- Parameters:
config- the configuation object
-
-
Method Details
-
encodeMessage
Encodes a request returning the encoded body- Parameters:
body-- Returns:
- the encoded body.
- Throws:
IOException
-
decodeMessage
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
Decode a response from the server.- Parameters:
response- 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.http.HttpResponse response) Is the response from the server to be trusted by the client.- Parameters:
response- the response- Returns:
- true if trusted, or true if this component is disabled.
-
trustMessage
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.
-