org.basex.query.util.http
Class HTTPPayload

java.lang.Object
  extended by org.basex.query.util.http.HTTPPayload

public final class HTTPPayload
extends java.lang.Object

HTTP payload helper functions.

Author:
BaseX Team 2005-13, BSD License, Christian Gruen

Constructor Summary
HTTPPayload(java.io.InputStream is, boolean st, InputInfo ii, Prop pr)
          Constructor.
 
Method Summary
static java.lang.String contentType(java.lang.String ctype)
          Extracts the content from a "Content-type" header.
 java.util.HashMap<java.lang.String,Value> multiForm(java.lang.String ext)
          Returns a map with multipart form data.
 FElem parse(boolean error, java.lang.String ctype, java.lang.String utype)
          Parses the HTTP payload and returns a result body element.
 Value payloads()
          Returns all payloads.
static Value value(IO in, Prop prop, java.lang.String ctype, java.lang.String ext)
          Returns an XQuery value for the specified content type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPPayload

public HTTPPayload(java.io.InputStream is,
                   boolean st,
                   InputInfo ii,
                   Prop pr)
Constructor.

Parameters:
is - input stream
st - only create status
ii - input info
pr - database properties
Method Detail

parse

public FElem parse(boolean error,
                   java.lang.String ctype,
                   java.lang.String utype)
            throws java.io.IOException,
                   QueryException
Parses the HTTP payload and returns a result body element.

Parameters:
error - error flag
ctype - content type defined in the connection
utype - content type specified by the user
Returns:
body element
Throws:
java.io.IOException - I/O exception
QueryException - query exception

payloads

public Value payloads()
Returns all payloads.

Returns:
payloads

multiForm

public java.util.HashMap<java.lang.String,Value> multiForm(java.lang.String ext)
                                                    throws java.io.IOException,
                                                           QueryException
Returns a map with multipart form data.

Parameters:
ext - content type extension (may be null)
Returns:
map, or null
Throws:
java.io.IOException - I/O exception
QueryException - query exception

value

public static Value value(IO in,
                          Prop prop,
                          java.lang.String ctype,
                          java.lang.String ext)
                   throws java.io.IOException,
                          QueryException
Returns an XQuery value for the specified content type.

Parameters:
in - input source
prop - database properties
ctype - content type
ext - content type extension (may be null)
Returns:
xml parser
Throws:
java.io.IOException - I/O exception
QueryException - query exception

contentType

public static java.lang.String contentType(java.lang.String ctype)
Extracts the content from a "Content-type" header.

Parameters:
ctype - value for "Content-type" header
Returns:
result