Package javaforce
Class HTTP
java.lang.Object
javaforce.HTTP
- Direct Known Subclasses:
HTTPS
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classHTTP Parameters.static interfaceProgress Listener -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringRemoves user info from HTTP URL.voidClears all request headers.voidclose()Close connection.byte[]HTTP GET using url.booleanget(String url, OutputStream os) HTTP GET using url.intgetCode()Returns last status code.static String[]getContent(String[] msg) Get Content from a HTTP message.Returns reply header.Returns reply headers.static Stringstatic StringgetParameter(String[] params, String name) Returns HTTP style parameter from list of parameters.static String[]getParameters(String[] params, String name) Returns HTTP style parameter(s) from list of parameters.static intHTTP GET using url.static StringgetUserInfo(String urlstr) booleanReturns connection status.static voidTest HTTPbooleanbooleanbyte[]HTTP POST using url with post data encoding with mimeType.booleanpost(String url, byte[] data, String mimeType, OutputStream os) HTTP POST using url with post data encoding with mimeType.postString(String url, byte[] data, String mimeType) HTTP POST using url with post data encoding with mimeType.voidSet a request header.voidsetProgressListener(HTTP.Progress progress) Registers a download progress listener.static voidsetTimeout(int timeout) Set connect/read timeout in ms (default = 30000)
-
Field Details
-
s
-
os
-
is
-
host
-
port
protected int port -
debug
public static boolean debug -
formType
- See Also:
-
-
Constructor Details
-
HTTP
public HTTP()
-
-
Method Details
-
cleanURL
Removes user info from HTTP URL. -
getUserInfo
-
getHost
-
getPort
-
setTimeout
public static void setTimeout(int timeout) Set connect/read timeout in ms (default = 30000) -
open
-
open
-
close
public void close()Close connection. -
isConnected
public boolean isConnected()Returns connection status. -
setProgressListener
Registers a download progress listener. -
setHeader
Set a request header. -
clearHeaders
public void clearHeaders()Clears all request headers. -
getHeader
Returns reply header. -
getHeaders
Returns reply headers. -
getCode
public int getCode()Returns last status code. -
get
HTTP GET using url. Writes content to OutputStream. -
get
HTTP GET using url. Returns as a byte[] -
getString
HTTP GET using url. Returns as a String. -
post
HTTP POST using url with post data encoding with mimeType. Writes content to OutputStream. -
post
HTTP POST using url with post data encoding with mimeType. Returns content as byte[] -
postString
HTTP POST using url with post data encoding with mimeType. Returns content as String. -
main
Test HTTP -
getParameter
Returns HTTP style parameter from list of parameters.- Parameters:
params- = HTTP list of parametersname- = name of parameter to return- Returns:
- parameter
-
getParameters
Returns HTTP style parameter(s) from list of parameters.- Parameters:
params- = HTTP list of parametersname- = name of parameter to return- Returns:
- parameter(s)
-
getContent
Get Content from a HTTP message.
-