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.
IRidSet This interface defines a set of RID instances.
IUri A RFC2396 URI interface.
IUriIterator Deprecated. As of EP5 SP6, replaced by java.util.List.
IUriList Deprecated. As of EP5 SP6, replaced by java.util.List.
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.
ReadonlyRidList A read-only RID list 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.
RidList An RID list implementation.
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 Deprecated. As of EP5 SP6, replaced by java.util.Iterator.
UriList Deprecated. As of EP5 SP6, replaced by java.util.List.
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.
UserRidCodec Utility class for decoding/encoding item names to fit for the cm store.
 

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



Copyright 2014 SAP AG Complete Copyright Notice