Class URIFragments
- java.lang.Object
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description URIFragments()
URIFragments(URI uri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPort()
String
getStringFragment(int index)
void
setFragments(URI uri)
Break down the given URI into fragments and reinitialize the current fragments setvoid
setPort(int port)
void
setStringFragment(int index, String value)
URI
toURI()
Construct a valid URI by combining the current fragment valuesString
toURIString()
Construct a valid URI string by combining the current fragment values
-
-
-
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
-
-