Package org.simpleframework.http.core
Class QueryBuilder
- java.lang.Object
-
- org.simpleframework.http.core.QueryBuilder
-
class QueryBuilder extends java.lang.Object
TheQueryBuilder
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.
-
-
Constructor Summary
Constructors Constructor Description QueryBuilder(Request request, Entity entity)
Constructor for theQueryBuilder
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.
-
-
-
Constructor Detail
-
QueryBuilder
public QueryBuilder(Request request, Entity entity)
Constructor for theQueryBuilder
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 forentity
- 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 anIOException
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
-
-