com.sapportals.wcm.util.uri

Class UriReference

java.lang.Object
  extended bycom.sapportals.wcm.util.uri.UriReference
All Implemented Interfaces:
IUriReference

public class UriReference
extends Object
implements IUriReference

A RFC2396 reference implementation.

Copyright (c) SAP AG 2001-2005


Constructor Summary
UriReference(IUriReference reference, String fragmentIdentifier)
           
UriReference(IUri uri, String fragmentIdentifier)
          Construct new absolute uri reference.
UriReference(String path, String query, String fragment)
          Construct new relative uri reference without authority and scheme.
UriReference(String authority, String path, String query, String fragment)
          Construct new relative uri reference without scheme.
UriReference(String scheme, String authority, String path, String query, String fragment)
          Construct new relative uri reference with scheme.
 
Method Summary
 IUriReference appendPath(String path)
          Create a new uri reference by appending the given path to any existing path in the uri reference.
 boolean equals(IUriReference other)
           
 boolean equals(Object other)
           
 boolean equals(UriReference other)
           
 String getAuthority()
          Get the authority of the reference
 String getFragmentIdentifier()
          Get the fragment identifier (without '#') of the uri
 String getPath()
          Get the path of the reference
 String getQuery()
          Get the query of the reference
 String getScheme()
          Get the scheme of the reference
 IUri getUri()
          Get the uri if the reference is absolute
 int hashCode()
           
 boolean isAbsolute()
          Determine if the reference is absolute
 IUriReference resolveWith(IUri base)
          With base Uri, resolve this reference to an absolute reference.
 IUriReference setQuery(String query)
          Gets a new URI reference resulting from setting the query of this URI reference to the given query.
 String toExternalForm()
          Returns a string representation according to RFC 2396 of this uri reference.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UriReference

public UriReference(IUri uri,
                    String fragmentIdentifier)
Construct new absolute uri reference.

Parameters:
uri - the absolute uri
fragmentIdentifier - the fragment of the uri reference

UriReference

public UriReference(String path,
                    String query,
                    String fragment)
Construct new relative uri reference without authority and scheme.

Parameters:
path - the path of the reference or empty
fragment - used in reference or null

UriReference

public UriReference(String authority,
                    String path,
                    String query,
                    String fragment)
Construct new relative uri reference without scheme.

Parameters:
authority - of the relative uri reference
path - the path of the reference or empty
fragment - used in reference or null

UriReference

public UriReference(String scheme,
                    String authority,
                    String path,
                    String query,
                    String fragment)
             throws IllegalArgumentException
Construct new relative uri reference with scheme. This constructor is used for a degenerate case as described in RFC 2396, page 32. The construction of relative uri references with scheme is discouraged. Note that either scheme or authority must be null.

Parameters:
scheme - of the relative uri reference
authority - of the relative uri reference
path - the path of the reference or empty
fragment - used in reference or null
Throws:
IllegalArgumentException - if both scheme and authority are not null

UriReference

public UriReference(IUriReference reference,
                    String fragmentIdentifier)
Method Detail

appendPath

public IUriReference appendPath(String path)
Description copied from interface: IUriReference
Create a new uri reference by appending the given path to any existing path in the uri reference. The path must be uri encoded or the created reference will not be valid. The given path is appended by prefixing a slash character, if necessary.

Specified by:
appendPath in interface IUriReference
Parameters:
path - uri encoded path to be appended
Returns:
an uri reference with path appended

setQuery

public IUriReference setQuery(String query)
Description copied from interface: IUriReference
Gets a new URI reference resulting from setting the query of this URI reference to the given query. The query string must be in RFC 2396 encoded form. See UriQuery for manipulation of query strings.

Specified by:
setQuery in interface IUriReference
Parameters:
query - the encoded query string to be set (may be null )
Returns:
an uri reference with query set to given query

equals

public boolean equals(Object other)

equals

public boolean equals(IUriReference other)

equals

public boolean equals(UriReference other)

hashCode

public int hashCode()

toExternalForm

public String toExternalForm()
Description copied from interface: IUriReference
Returns a string representation according to RFC 2396 of this uri reference.

Specified by:
toExternalForm in interface IUriReference
Returns:
string in uri reference format

toString

public String toString()

getFragmentIdentifier

public String getFragmentIdentifier()
Get the fragment identifier (without '#') of the uri

Specified by:
getFragmentIdentifier in interface IUriReference
Returns:
fragment identifier or emtpy String

getScheme

public String getScheme()
Get the scheme of the reference

Specified by:
getScheme in interface IUriReference
Returns:
scheme of reference or null

getAuthority

public String getAuthority()
Get the authority of the reference

Specified by:
getAuthority in interface IUriReference
Returns:
authority of reference or null

getPath

public String getPath()
Get the path of the reference

Specified by:
getPath in interface IUriReference
Returns:
path of reference or empty string

getQuery

public String getQuery()
Get the query of the reference

Specified by:
getQuery in interface IUriReference
Returns:
query of reference or null

getUri

public IUri getUri()
Get the uri if the reference is absolute

Specified by:
getUri in interface IUriReference
Returns:
uri of reference or null

isAbsolute

public boolean isAbsolute()
Determine if the reference is absolute

Specified by:
isAbsolute in interface IUriReference
Returns:
if reference is absolute

resolveWith

public IUriReference resolveWith(IUri base)
With base Uri, resolve this reference to an absolute reference. If this reference is already absolute, this is the identity operation.

Specified by:
resolveWith in interface IUriReference
Parameters:
base - uri to resolve this reference with
Returns:
absolute uri reference


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.