SAP NetWeaver '04

Package com.sapportals.wcm.util.uri

Contains interfaces and classes to handle uniform resource identifiers (uri).

See:
          Description

Interface Summary
IHierarchicalUri A RFC2396 URI interface.
IRidIterator This interface defines an iterator for a IRidList Copyright (c) SAP AG 2001-2002
IRidList This interface defines a list of RID instances Copyright (c) SAP AG 2001-2002
IRidSet This interface defines a set of RID instances Copyright (c) SAP AG 2001-2002
IUri A RFC2396 URI interface.
IUriIterator This interface defines an iterator for a IUriList Copyright (c) SAP AG 2001-2002
IUriList This interface defines a list of URI instances Copyright (c) SAP AG 2001-2002
IUriReference A RFC2396 URI reference interface.
 

Class Summary
DataUri A RFC2397 IUri implementation.
GenericUri A RFC2396 IUri implementation.
HttpUrl An IHierarchicalUri implementation for HTTP/HTTPS URLs.
OpaqueLockTokenUri A RFC2518 IUri implementation.
ResourceUrl An IHierarchicalUri implementation for Resource (Repository Framework internal) URLs.
RID A RID is an identifier for a CM resource.
RidIterator An RID iterator implementation Copyright (c) SAP AG 2001-2002
RidList An URL list implementation Copyright (c) SAP AG 2001-2004
RidReference  
RidSet A set of RID instances.
URI Deprecated. as of EP 5.0 SP3, replaced by RID
URICodec Utility class for decoding/encoding URIs in HTTP requests.
UriFactory A factory producing IUris from various inputs.
UriIterator An URI iterator implementation Copyright (c) SAP AG 2001-2002
UriList An URL list implementation Copyright (c) SAP AG 2001-2002
UriQuery Manages query parameters for RFC 2396 URIs.
UriQuery.Parameter Keeps one query parameter.
UriReference A RFC2396 reference implementation.
URL DO NOT USE this class except to create instances of URL objects to be used for link creation.
 

Package com.sapportals.wcm.util.uri Description

Contains interfaces and classes to handle uniform resource identifiers (uri).

Package Specification

The uri package handles the two worlds of RFC 2396 uris and WCM uris and how they interact.

RFC 2396 Uris

Internet Uris are defined in RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax. This RFC defines the following terms which are explained here for quick reference:

WCM URIs (Resource IDs)

WCM URIs, a better name would be Resource ID (RID), are used to identify WCM resources on a single server. In contrast to internet uris they What they have in common with internet uris: Examples: '/documents/report.doc' or '/tmp/Währung-in-€.txt'.

Query Part in WCM URIs

The string representation of a query part in WCM URIs is the same as in RFC 2396 URIs. The reason for this is that a string representation always needs escaped characters (to represent '=' in values for example), so the RFC 2397 method of encoding a query is applied to WCM URIs as well. The WCM URI class has access methods to get/set a query and handle the correct en-/decoding of query parameters internally. See URI for details.

Mapping of WCM to/from Internet Uris

This package provides mapping functionality to convert WCM uris to Internet uris and vice versa.
When a HTTP server/servlet wants to expose WCM URIs (resource ids) as HTTP uris, it just needs to know where in the HTTP uri hierarchy the WCM resources should be made available.
Example: A servlet resides at 'http://sapportals.com/apps/service' and wants to map request uris to WCM resources. The request for '/apps/service/info/index.txt' should be mapped to the WCM resource '/info/index.html'.
The servlet would do the following when servicing a request:
      HttpUrl m_servletUrl = new HttpUrl(
          m_request.getScheme(), m_request.getServerName(), m_request.getServerPort(), 
          m_request.getContextPath() + m_request.getServletPath(), null);

      IUriReference ref = new UriReference(m_request.getRequestURI(), 
                                           m_request.getQueryString(), null);
      URI uri = m_servletUrl.mapToWcmPath(ref);
      if (uri == null {
        // request uri outside servlet uri? Should not happen
      }
  
First, the http url of the servlet itself is determined. Note that your servlet can be accessible unter many different host names and ports, with or without https. So it is wise to calculate the servlet url on every request. Next the request uri and possible query string are placed in a IUriReference object. As the last step, the uri reference is resolved, using the servlet's uri as base, to the WCM URI (resource id).

The reverse mapping would also use the servlet url. Given a WCM URI, the servlet would either generate a http url or a absolute uri reference to hand out to the client (for example as href in a HTML document):

      URI wcmpath = resource.getURI();
      IUri url = m_servletUrl.mapToAbsoluteUri(wcmpath);
      // or
      IUriReference ref = m_servletUrl.toAbsolutePath(wcmpath);
  
This code would convert the resource id '/info/index.html', given the servlet url 'http://sapportals.com/apps/service' to:

See IHierarchicalUri for further information.

Related Documentation


SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
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.