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 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:
- PocServiceHome,
PocService,
PocURLFactory
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