DCT Lightfoot v3 API specification

com.dctl.j2me.io
Class ProtocolString

java.lang.Object
  |
  +--com.dctl.j2me.io.ProtocolString

public class ProtocolString
extends Object

Parse the protocol string


Field Summary
 java.lang.String address
          The address string
 java.lang.String location
          The location
 java.lang.String parameters
          The parameter strings
 int port
          The port number
 java.lang.String protocol
          The protocol string
 java.lang.String query
          The query string
 java.lang.String ref
          The reference string
 java.lang.String url
          The complete url
 
Constructor Summary
ProtocolString()
          Create a protocol string with blank entries
ProtocolString(java.lang.String url)
          Create a protocol string from the URL and set the protocol, address, port, location and parameter values
 
Method Summary
 java.lang.String getQueryParam(java.lang.String p)
          Gets the value of a url query parameter as a string, e.g.
if a query part of a url were &size=10 the method would return 10 when passed the argument size.
 void parseURL(java.lang.String url)
          Parse the URL and set the protocol, address, port, location and parameter values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

public java.lang.String url
The complete url


protocol

public java.lang.String protocol
The protocol string


address

public java.lang.String address
The address string


port

public int port
The port number


location

public java.lang.String location
The location


parameters

public java.lang.String parameters
The parameter strings


ref

public java.lang.String ref
The reference string


query

public java.lang.String query
The query string

Constructor Detail

ProtocolString

public ProtocolString()
Create a protocol string with blank entries


ProtocolString

public ProtocolString(java.lang.String url)
Create a protocol string from the URL and set the protocol, address, port, location and parameter values

Parameters:
url - The URL in the format :[//
[:][] [;][?][#]
Throws:
IllegalArgumentException - if the url cannot be decoded
Method Detail

parseURL

public void parseURL(java.lang.String url)
Parse the URL and set the protocol, address, port, location and parameter values

Parameters:
url - The URL in the format :[//
[:][][;]]
Throws:
IllegalArgumentException - if the url cannot be decoded

getQueryParam

public final java.lang.String getQueryParam(java.lang.String p)
Gets the value of a url query parameter as a string, e.g.
if a query part of a url were &size=10 the method would return 10 when passed the argument size. The method is case sensitive and passing in a non-matching string will return null. The method also assumes that the query is the last part of a url. The first query in a url is preceeded with a ? as opposed to a &.

Parameters:
p - the parameter string - the convention is for this always to be lower-case
Returns:
the value of the query parameter or null if no match was found or the parameter passed in was null.

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification