org.apache.synapse.mediators.transform.url
Class URIFragments

java.lang.Object
  extended by org.apache.synapse.mediators.transform.url.URIFragments

public class URIFragments
extends Object

This class represents a URI, fragmented into 7 major components. These components are namely scheme, user info, host, port, path, query and ref. Out of these seven components, port is an integer whereas all other components are strings. These fragments can be combined to form a valid URI according to RFC-2396. This collection strictly deals with URI fragments and not URL fragments. Therefore this abstraction can be used to represent any URI, URL or URN thus allowing room for a wider range of usecases.


Field Summary
static int FULL_URI
           
static int HOST
           
static int PATH
           
static int PORT
           
static int PROTOCOL
           
static int QUERY
           
static int REF
           
static int USER_INFO
           
 
Constructor Summary
URIFragments()
           
URIFragments(URI uri)
           
 
Method Summary
 int getPort()
           
 String getStringFragment(int index)
           
 void setFragments(URI uri)
          Break down the given URI into fragments and reinitialize the current fragments set
 void setPort(int port)
           
 void setStringFragment(int index, String value)
           
 URI toURI()
          Construct a valid URI by combining the current fragment values
 String toURIString()
          Construct a valid URI string by combining the current fragment values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL_URI

public static final int FULL_URI
See Also:
Constant Field Values

PORT

public static final int PORT
See Also:
Constant Field Values

PROTOCOL

public static final int PROTOCOL
See Also:
Constant Field Values

USER_INFO

public static final int USER_INFO
See Also:
Constant Field Values

HOST

public static final int HOST
See Also:
Constant Field Values

PATH

public static final int PATH
See Also:
Constant Field Values

QUERY

public static final int QUERY
See Also:
Constant Field Values

REF

public static final int REF
See Also:
Constant Field Values
Constructor Detail

URIFragments

public URIFragments()

URIFragments

public URIFragments(URI uri)
Method Detail

setFragments

public void setFragments(URI uri)
Break down the given URI into fragments and reinitialize the current fragments set

Parameters:
uri - the URI to be assigned to the fragments

setPort

public void setPort(int port)

getPort

public int getPort()

setStringFragment

public void setStringFragment(int index,
                              String value)

getStringFragment

public String getStringFragment(int index)

toURI

public URI toURI()
          throws URISyntaxException
Construct a valid URI by combining the current fragment values

Returns:
a valid URI instance
Throws:
URISyntaxException - if the fragments form a malformed URI

toURIString

public String toURIString()
                   throws URISyntaxException
Construct a valid URI string by combining the current fragment values

Returns:
a string representation of a valid URI
Throws:
URISyntaxException - if the fragments form a malformed URI


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.