lapisx.net
Class FormURL

java.lang.Object
  extended bylapisx.net.FormURL
Direct Known Subclasses:
LocalFormURL

public class FormURL
extends Object


Constructor Summary
FormURL(String method, URL url, String query)
          Open a URL using a given method (get or post) and query data.
FormURL(String method, URL url, Vector query)
          Create a query using a given method (get or post) and query data.
 
Method Summary
static String encodeQuery(Vector query)
          URL-encode a sequence of name-value pairs.
 URL getAction()
           
 String getMethod()
           
 String getQueryString()
           
 Vector getQueryVector()
           
 URL getURL()
           
 URLConnection openConnection()
          Open a connection ready to submit query and retrieve its results.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormURL

public FormURL(String method,
               URL url,
               Vector query)
Create a query using a given method (get or post) and query data.

Parameters:
method - "get" or "post" (case-insensitive).
url - URL to send query to. Must be http:
query - Name/value pairs to simulate submitting a form. Names and values may be arbitrary objects; this method uses toString() to convert them to strings, then URL-encodes them before sending to the web server. Pass null if no form data is desired.

FormURL

public FormURL(String method,
               URL url,
               String query)
Open a URL using a given method (get or post) and query data.

Parameters:
method - "get" or "post" (case-insensitive).
url - URL to open. Must be http:
query - URL-encoded name/value pairs, or null if no query desired
Method Detail

getMethod

public String getMethod()

getAction

public URL getAction()

getURL

public URL getURL()

getQueryString

public String getQueryString()

getQueryVector

public Vector getQueryVector()

toString

public String toString()

openConnection

public URLConnection openConnection()
                             throws IOException
Open a connection ready to submit query and retrieve its results.

Returns:
URLConnection (set up for connection but not yet connected)
Throws:
IOException

encodeQuery

public static String encodeQuery(Vector query)
URL-encode a sequence of name-value pairs.

Parameters:
query - Name/value pairs to encode; even indexes are names, odd indexes are values
Returns:
String of URL-encoded name/value pairs