|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectesmska.transfer.GatewayConnector
public class GatewayConnector
Class for connecting to HTTP resources and sending GET and POST requests. For each SMS there should be a separate instance.
Constructor Summary | |
---|---|
GatewayConnector()
Constructor for GatewayConnector. |
Method Summary | |
---|---|
boolean |
connect()
Perform a connection (GET or POST, depending on configuration). |
void |
forgetCookie(java.lang.String name,
java.lang.String domain,
java.lang.String path)
Remove specified cookie from the cookie cache. |
byte[] |
getBinaryContent()
Get binary response |
java.lang.String |
getTextContent()
Get text response |
boolean |
isTextContent()
True if received response is textual, false if binary |
void |
setConnection(java.lang.String url,
java.lang.String[] params,
boolean doPost,
java.lang.String[] postData)
Prepare connector for a new connection. |
void |
setLanguage(java.lang.String languageCode)
Sets preferred language to retrieve web content. |
void |
setReferer(java.lang.String referer)
Set referer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GatewayConnector()
Method Detail |
---|
public boolean isTextContent()
public java.lang.String getTextContent()
public byte[] getBinaryContent()
public void setReferer(java.lang.String referer)
public void setLanguage(java.lang.String languageCode)
languageCode
- two-letter language code as defined in ISO 639-1public void forgetCookie(java.lang.String name, java.lang.String domain, java.lang.String path)
name
- name of the cookie; may be nulldomain
- domain of the cookie; may be nullpath
- path of the cookie; may be nullpublic void setConnection(java.lang.String url, java.lang.String[] params, boolean doPost, java.lang.String[] postData) throws java.io.IOException
url
- URL where to connect. If you specify params, this must not
contain '?'.params
- Additional parameters to the URL (aka query string).
The array is in the form [key1,value1,key2,value2,...]. Use null or
empty array for no parameters.doPost
- true if this should be POST request; false if this should
bet GET requestpostData
- Data to be sent in the POST request. The array is in the
form [key1,value1,key2,value2,...]. Use null or empty array for no data.
java.lang.IllegalArgumentException
- When url is null.
java.io.IOException
- When the url and params together does not
create a correct URL.public boolean connect() throws java.io.IOException
java.io.IOException
- when there is a problem with connection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |