com.ibm.portal.portlet.service.contentaccess
Interface ContentAccessService

All Superinterfaces:
PortletService

public interface ContentAccessService
extends PortletService

Service to access external and internal resources. This on-demand proxy allows the creation of a URL or Stream which can then be passed to other classes without knowing about the proxy support to enable seemless adaption to proxied environments. The proxying will be provided to the URL object by means of a StreamHandler.

Since:
5.1

Method Summary
 java.io.InputStream getInputStream(java.lang.String urlString, javax.portlet.PortletRequest req, javax.portlet.PortletResponse resp)
          Returns an input stream that reads from the passed url.
 java.lang.String getMarkup(java.lang.String urlString, javax.portlet.PortletRequest req, javax.portlet.RenderResponse resp)
          Returns the markup of the input stream read from the passed url.
 java.net.URL getURL(java.lang.String urlString, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
          Returns an URL object after following redirects using a proxy if necessary
 void include(java.lang.String urlString, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, javax.portlet.PortletContext context)
          Writes the content of the given url to the output stream of the portlet following redirects and using a proxy if necessary.
 

Method Detail

getURL

java.net.URL getURL(java.lang.String urlString,
                    javax.portlet.PortletRequest request,
                    javax.portlet.PortletResponse response)
                    throws java.io.IOException
Returns an URL object after following redirects using a proxy if necessary

Parameters:
urlString - a string representing the start url
request - the portlet request
response - the portlet response
Returns:
URL object based on the given url string and the proxy configuration
Throws:
java.net.MalformedURLException - if the given urlString is a malformed URL.
java.io.IOException - if a required credential could not be retrieved or the expected URL could not been created.

getInputStream

java.io.InputStream getInputStream(java.lang.String urlString,
                                   javax.portlet.PortletRequest req,
                                   javax.portlet.PortletResponse resp)
                                   throws java.io.IOException
Returns an input stream that reads from the passed url.

Parameters:
urlString - a string representing the start url
req -
resp -
Returns:
InputStream from the proxied connection
Throws:
java.net.MalformedURLException - thrown if the URL is invalid
java.io.IOException - thrown if the portlet service fails

getMarkup

java.lang.String getMarkup(java.lang.String urlString,
                           javax.portlet.PortletRequest req,
                           javax.portlet.RenderResponse resp)
                           throws java.io.IOException
Returns the markup of the input stream read from the passed url.

Parameters:
urlString - a string representing the start url
req -
resp -
Returns:
String representing the markup of the proxied connection
Throws:
java.net.MalformedURLException - thrown if the URL is invalid.
java.io.IOException - thrown if the portlet service fails.

include

void include(java.lang.String urlString,
             javax.portlet.RenderRequest request,
             javax.portlet.RenderResponse response,
             javax.portlet.PortletContext context)
             throws java.io.IOException
Writes the content of the given url to the output stream of the portlet following redirects and using a proxy if necessary. If the URL is relative and a request dispatcher is given, the service first attempts to include it using the request dispatcher, to handle local servlets or JSPs

Parameters:
urlString - a string representing the url
request - the portlet request
response - the portlet response
context - the context for including relative URLs, may be null
Throws:
java.net.MalformedURLException - thrown if the URL is invalid.
java.io.IOException - thrown if the portlet service fails.