Class TopologyRequestValidator

java.lang.Object
org.apache.sling.discovery.base.connectors.ping.TopologyRequestValidator

public class TopologyRequestValidator extends Object
Request Validator helper.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a TopologyRequestValidator.
  • Method Summary

    Modifier and Type
    Method
    Description
    decodeMessage(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.
    Encodes a request returning the encoded body
    boolean
    isTrusted(javax.servlet.http.HttpServletRequest request)
    Is the request from the client trusted, based on the signature headers.
    boolean
    isTrusted(org.apache.http.HttpResponse response)
    Is the response from the server to be trusted by the client.
    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.
    void
    trustMessage(org.apache.http.client.methods.HttpUriRequest method, String body)
    Trust a message on the client before sending, only if trust is enabled.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • TopologyRequestValidator

      public TopologyRequestValidator(BaseConfig config)
      Create a TopologyRequestValidator.
      Parameters:
      config - the configuation object
  • Method Details

    • 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(String uri, org.apache.http.HttpResponse response) throws IOException
      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

      public void trustMessage(org.apache.http.client.methods.HttpUriRequest 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.