com.noelios.restlet.ext.servlet
Class ServletWarClientHelper

java.lang.Object
  extended by org.restlet.util.Helper<T>
      extended by com.noelios.restlet.ConnectorHelper<Client>
          extended by com.noelios.restlet.ClientHelper
              extended by com.noelios.restlet.local.LocalClientHelper
                  extended by com.noelios.restlet.local.EntityClientHelper
                      extended by com.noelios.restlet.ext.servlet.ServletWarClientHelper
Direct Known Subclasses:
XdbServletWarClientHelper

public class ServletWarClientHelper
extends EntityClientHelper

Client connector based on a Servlet context (JEE Web application context). Here is a sample resource URI:

 war:///path/to/my/resource/entry.txt
 

You can note that there is no authority which is denoted by the sequence of three "/" characters. This connector is designed to be used inside a context (e.g. inside a servlet based application) and subconsequently does not require the use of a authority. Such URI are "relative" to the root of the servlet context.
Here is a sample code excerpt that illustrates the way to use this connector: Response response = getContext().getClientDispatcher().get("war:///myDir/test.txt"); if (response.isEntityAvailable()) { //Do what you want to do. }

Author:
Jerome Louvel

Constructor Summary
ServletWarClientHelper(Client client, ServletContext servletContext)
          Constructor.
 
Method Summary
 Entity getEntity(java.lang.String decodedPath)
           
 ServletContext getServletContext()
          Returns the Servlet context.
 void handle(Request request, Response response)
           
 
Methods inherited from class com.noelios.restlet.local.EntityClientHelper
createReference, getReencodedVariantEntityName, handleEntity, handleEntityGet
 
Methods inherited from class com.noelios.restlet.local.LocalClientHelper
getDefaultLanguage, getMetadataService, getTimeToLive, updateMetadata
 
Methods inherited from class com.noelios.restlet.ClientHelper
getConnectTimeout
 
Methods inherited from class com.noelios.restlet.ConnectorHelper
getProtocols, start, stop, update
 
Methods inherited from class org.restlet.util.Helper
getAttributes, getContext, getHelped, getHelpedParameters, getLogger, setHelped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletWarClientHelper

public ServletWarClientHelper(Client client,
                              ServletContext servletContext)
Constructor.

Parameters:
client - The client to help.
servletContext - The Servlet context.
Method Detail

getEntity

public Entity getEntity(java.lang.String decodedPath)
Specified by:
getEntity in class EntityClientHelper

getServletContext

public ServletContext getServletContext()
Returns the Servlet context.

Returns:
The Servlet context.

handle

public void handle(Request request,
                   Response response)
Overrides:
handle in class EntityClientHelper


Copyright © 2005-2008 Noelios Technologies.