|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sourceforge.jwap.WAPClient
This class represents a WSP "User-Agent" which can be used for executing
WSP GET and POST methods.
WAPClient client = new WAPClient("localhost", 9201);
Request request = new GetRequest("http://localhost/");
client.connect();
Response response = client.execute(request);
client.disconnect();
| Field Summary | |
static long |
DEFAULT_CONNECT_TIMEOUT
Default connect/disconnect timeout in milliseconds: 30000 |
static long |
DEFAULT_EXEC_TIMEOUT
Default execute timeout in milliseconds: 180000 |
| Constructor Summary | |
WAPClient(java.net.InetAddress wapGateway,
int port)
Construct a new WAP Client |
|
WAPClient(java.net.InetAddress wapGateway,
int wapPort,
java.net.InetAddress localAddress,
int localPort)
Construct a new WAP Client |
|
WAPClient(java.lang.String wapGateway,
int port)
Construct a new WAP Client |
|
| Method Summary | |
void |
connect()
Connect to the WAP gateway. |
void |
connect(CWSPHeaders headers,
long timeout)
Connect to the WAP gateway. |
void |
connect(long timeout)
Connect to the WAP gateway. |
void |
disconnect()
Disconnect from the WAP gateway. |
Response |
execute(Request request)
Execute a request. |
Response |
execute(Request request,
long timeout)
Execute a request. |
boolean |
isConnected()
Check if the client is currently connected to the WAP gateway |
static void |
main(java.lang.String[] args)
Execute a WSP GET request. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final long DEFAULT_CONNECT_TIMEOUT
public static final long DEFAULT_EXEC_TIMEOUT
| Constructor Detail |
public WAPClient(java.lang.String wapGateway,
int port)
throws java.net.UnknownHostException
wapGateway - hostname of the WAP gateway to useport - port-numberjava.net.UnknownHostException - if the hostname cannot be resolved
public WAPClient(java.net.InetAddress wapGateway,
int port)
wapGateway - the address of the WAP gateway to useport - the WAP gateway port number
public WAPClient(java.net.InetAddress wapGateway,
int wapPort,
java.net.InetAddress localAddress,
int localPort)
wapGateway - the addresss of the WAP gateway to usewapPort - the WAP gateway port numberlocalAddress - the local address to bind tolocalPort - the local port to bind to (0 to let the OS pick a free port)| Method Detail |
public Response execute(Request request)
throws java.net.SocketException,
java.lang.IllegalStateException
request - the request to executejava.net.SocketException - if a timeout occurredjava.lang.IllegalStateException - if the client is not connected
public Response execute(Request request,
long timeout)
throws java.net.SocketException,
java.lang.IllegalStateException
request - the request to executetimeout - timeout in millisecondsjava.net.SocketException - if a timeout occurredjava.lang.IllegalStateException - if the client is not connected
public void connect()
throws java.net.SocketException,
java.lang.IllegalStateException
java.net.SocketException - if the connection could not be establishedjava.lang.IllegalStateException - if the client is already connected
public void connect(long timeout)
throws java.net.SocketException,
java.lang.IllegalStateException
timeout - timeout in millisecondsjava.net.SocketException - if the connection could not be establishedjava.lang.IllegalStateException - if the client is already connected
public void connect(CWSPHeaders headers,
long timeout)
throws java.net.SocketException,
java.lang.IllegalStateException
timeout - timeout in millisecondsheaders - WSP headers used for connect or null
objects. The headers will be encoded using the default WAP codepage.java.net.SocketException - if the connection could not be establishedjava.lang.IllegalStateException - if the client is already connectedpublic void disconnect()
public boolean isConnected()
public static void main(java.lang.String[] args)
throws java.io.IOException
Usage: WAPClient <WAP-Gateway-address[:port]> [GET/POST] [options] <URL> if method (GET/POST) is unspecified, GET is assumed Common options: -uThe User-Agent (defaults to jWAP/1.x) -o write response to file -v show response-headers POST options: -c The content-type of the response body -p A file containing the post data, use '-' to read the post data from standard input
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||