Class QueryBuilder


  • class QueryBuilder
    extends java.lang.Object
    The QueryBuilder object is used to create the query. It is created using the request URI query and a form post body if sent. The application/x-www-form-urlencoded conent type identifies the body as contain form data. If there are duplicates then they both are available from the query that is built.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Header header
      This is the header that is used to acquire the data.
      private Request request
      This is the request that is used to acquire the data.
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryBuilder​(Request request, Entity entity)
      Constructor for the QueryBuilder object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Query build()
      This method is used to acquire the query part from the HTTP request URI target and a form post if it exists.
      private java.lang.String getContent()
      This method attempts to acquire the content of the request body.
      private Query getQuery​(Query query)
      This method is used to acquire the query part from the HTTP request URI target and a form post if it exists.
      private boolean isFormPost()
      This is used to determine if the content type is a form POST of type application/x-www-form-urlencoded.
      private boolean isFormPost​(ContentType type)
      This is used to determine if the content type is a form POST of type application/x-www-form-urlencoded.
      • Methods inherited from class java.lang.Object

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

      • request

        private final Request request
        This is the request that is used to acquire the data.
      • header

        private final Header header
        This is the header that is used to acquire the data.
    • Constructor Detail

      • QueryBuilder

        public QueryBuilder​(Request request,
                            Entity entity)
        Constructor for the QueryBuilder object. This will create an object that can be used to construct a single query from the multiple sources of data within the request entity.
        Parameters:
        request - this is the request to build a query for
        entity - this is the entity that contains the data
    • Method Detail

      • build

        public Query build()
        This method is used to acquire the query part from the HTTP request URI target and a form post if it exists. Both the query and the form post are merge together in a single query.
        Returns:
        the query associated with the HTTP target URI
      • getQuery

        private Query getQuery​(Query query)
        This method is used to acquire the query part from the HTTP request URI target and a form post if it exists. Both the query and the form post are merge together in a single query.
        Parameters:
        query - this is the URI query string to be used
        Returns:
        the query associated with the HTTP target URI
      • getContent

        private java.lang.String getContent()
        This method attempts to acquire the content of the request body. If there is an IOException acquiring the content of the body then this will simply return a null value without reporting the exception.
        Returns:
        the content of the body, or null on error
      • isFormPost

        private boolean isFormPost()
        This is used to determine if the content type is a form POST of type application/x-www-form-urlencoded. Such a type is used when a HTML form is used to post data to the server.
        Returns:
        this returns true if content type is a form post
      • isFormPost

        private boolean isFormPost​(ContentType type)
        This is used to determine if the content type is a form POST of type application/x-www-form-urlencoded. Such a type is used when a HTML form is used to post data to the server.
        Parameters:
        type - the type to determine if its a form post
        Returns:
        this returns true if content type is a form post