com.ibm.workplace.wcm.api.identity
Interface RestURI


public interface RestURI

Represents a WCM ReST URI.

This represents the canonical form of the URI.
e.g. wcmrest:Content/1234-1234-1234-1234

If a URL is required, the conversion can be achieved using com.ibm.portal.resolver.accessors.url.PocURLFactory
A simple example of this follows. However, for more information consult the relevant javadoc.

 
    InitialContext ctx = null;
    PocURL pocUrl = null;
    PortalPocService pocService = null;
    try
    {
       ctx = new InitialContext(); 
       
       RestURI myRestUri = getRestURI(); 
       HttpServletRequest request = getRequest(); 
       HttpServletResponse response = getResponse(); 
       
       PortalPocServiceHome home = (PortalPocServiceHome) ctx.lookup(PortalPocServiceHome.JNDI_NAME); 
       pocService = home.getPortalPocService(request, response); 
       PocURLFactory factory = pocService.getURLFactory(); 
       
       pocUrl = factory.newURL(PocURLFactory.EARLY_BINDING); 
       pocUrl.setURI(myRestUri.getURI()); 
       StringWriter writer = new StringWriter(); 
       pocUrl.write(writer); 
       String url = writer.toString(); 
 
       // ... do something with the URL 
    } 
    finally 
    { 
       if (pocUrl != null) 
       { 
          pocUrl.dispose(); 
       } 
       if (pocService != null) 
       { 
          pocService.dispose(); 
       } 
       
       if(ctx != null) 
       { 
          try 
          { 
             ctx.close(); 
          } 
          catch (NamingException e) 
          { 
             e.printStackTrace(); 
          } 
       } 
    } 
 
 

Since:
8.5
See Also:
com.ibm.portal.resolver.service.PocServiceHome, com.ibm.portal.resolver.service.PocService, com.ibm.portal.resolver.accessors.url.PocURLFactory

Method Summary
 DocumentId<?> getDocumentId()
           
 java.net.URI getURI()
           
 

Method Detail

getURI

java.net.URI getURI()
Returns:
the java.net.URI representation of the ReST URI

getDocumentId

DocumentId<?> getDocumentId()
Returns:
the document id of the item this RestURI refers to