Package ch.software_atelier.simpleflex
Class Request
java.lang.Object
ch.software_atelier.simpleflex.Request
Holds a request with all contents sent by a WebBrowser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaddHeaderLine(String line) Adds a Header-Object to the Request-Object.voidapendJSON(BufferedInputStream bfis, String charset, long length) voidapendJSONArray(BufferedInputStream bfis, String charset, long length) voidapendMultipart(BufferedInputStream bis, long length) voidapendURLEncoded(BufferedInputStream bfis, long length) voidapendXML(BufferedInputStream bfis, String charset, long length) voidappendSinglePart(BufferedInputStream bis, long length) voidcleanup()getArgument(String key) Returns an InetAddress-Object that holds the IP-Address of the ClientgetHeaderValue(String key) getHost()org.json.JSONArrayorg.json.JSONObjectThis method returns GET or POSTintgetPort()Returns the version of the used protocol.byte[]getRecievedFile(String field) getRecievedText(String field) Returns the Request-String.xmlwise.XmlElementbooleanbooleanbooleanbooleanReturns true, if the connnection is secure.booleanbooleanisXMLReq()voidsetClient(InetAddress client) voidvoidsetProtocoll(String protocoll) voidsetRequestString(String requestString) voidsetSecure(boolean secure)
-
Field Details
-
CONTENT_TYPE_MULTIPART
-
CONTENT_TYPE_APPLICATION
-
CONTENT_TYPE_XML
-
CONTENT_TYPE_JSON
-
CONTENT_TYPE_JSON_PATCH
-
HTTPHEADER_CONTENT_LENGTH
- See Also:
-
HTTPHEADER_CONTENT_DISPOSITION
- See Also:
-
HTTPHEADER_ACCEPT_LANGUAGE
- See Also:
-
HTTPHEADER_ACCEPT_ENCODING
- See Also:
-
HTTPHEADER_ACCEPT_CHARSET
- See Also:
-
HTTPHEADER_ACCEPT
- See Also:
-
HTTPHEADER_USER_AGENT
- See Also:
-
HTTPHEADER_HOST
- See Also:
-
HTTPHEADER_REFERER
- See Also:
-
HTTPHEADER_CONTENT_TYPE
- See Also:
-
HTTPHEADER_CONNECTION
- See Also:
-
METHOD_POST
- See Also:
-
METHOD_GET
- See Also:
-
METHOD_OPTIONS
- See Also:
-
METHOD_PUT
- See Also:
-
METHOD_DELETE
- See Also:
-
METHOD_PATCH
- See Also:
-
-
Constructor Details
-
Request
public Request()
-
-
Method Details
-
addHeaderLine
Adds a Header-Object to the Request-Object.- Parameters:
line- The Headerline given by the Client- Returns:
- sucessfully added? yes/no
-
setSecure
public void setSecure(boolean secure) - Parameters:
secure-
-
setClient
- Parameters:
client-
-
setProtocoll
- Parameters:
protocoll-
-
setMethod
- Parameters:
method-
-
setRequestString
- Parameters:
requestString-
-
arguments
- Returns:
-
getArgument
- Parameters:
key-- Returns:
-
getProtocoll
Returns the version of the used protocol. Example: HTTP/1.0 -
getMethod
This method returns GET or POST- Returns:
-
getReqestString
Returns the Request-String. It is a Path to a File.- Returns:
- a path to a File like /index.htm or /something/abc.mpg
-
getLastRequestStringComponent
- Returns:
-
getHeaders
- Returns:
-
getHeaderValue
- Parameters:
key-- Returns:
-
isSecureConnection
public boolean isSecureConnection()Returns true, if the connnection is secure. (HTTPS)- Returns:
-
getHost
- Returns:
-
getPort
public int getPort()- Returns:
-
getClient
Returns an InetAddress-Object that holds the IP-Address of the Client- Returns:
-
appendSinglePart
- Throws:
IOException
-
apendMultipart
- Parameters:
bis-- Throws:
IOException
-
apendURLEncoded
- Parameters:
bfis-length-- Throws:
IOException
-
apendJSON
- Parameters:
bfis-charset-length-- Throws:
IOException
-
apendJSONArray
public void apendJSONArray(BufferedInputStream bfis, String charset, long length) throws IOException - Parameters:
bfis-charset-length-- Throws:
IOException
-
apendXML
- Parameters:
bfis-charset-length-- Throws:
IOException
-
getRecievedData
- Returns:
-
getRecievedText
- Parameters:
field-- Returns:
-
getRecievedFile
- Parameters:
field-- Returns:
-
isJSONReq
public boolean isJSONReq()- Returns:
-
getJSONReq
public org.json.JSONObject getJSONReq()- Returns:
-
isJSONArrReq
public boolean isJSONArrReq()- Returns:
-
getJSONArrReq
public org.json.JSONArray getJSONArrReq()- Returns:
-
isXMLReq
public boolean isXMLReq()- Returns:
-
getXMLReq
public xmlwise.XmlElement getXMLReq()- Returns:
-
isFormPostReq
public boolean isFormPostReq()- Returns:
-
isSinglePartReq
public boolean isSinglePartReq()- Returns:
-
getRawData
public byte[] getRawData()- Returns:
-
getSinglePartFilename
- Returns:
-
getSinglePartMimeType
- Returns:
-
getSinglePartFile
- Returns:
-
getBoundary
- Returns:
-
cleanup
public void cleanup()
-