org.eclipse.jetty.server.handler
类 ResourceHandler

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.component.AggregateLifeCycle
          继承者 org.eclipse.jetty.server.handler.AbstractHandler
              继承者 org.eclipse.jetty.server.handler.AbstractHandlerContainer
                  继承者 org.eclipse.jetty.server.handler.HandlerWrapper
                      继承者 org.eclipse.jetty.server.handler.ResourceHandler
所有已实现的接口:
Handler, HandlerContainer, Destroyable, Dumpable, LifeCycle

public class ResourceHandler
extends HandlerWrapper

Resource Handler. This handle will serve static content and handle If-Modified-Since headers. No caching is done. Requests for resources that do not exist are let pass (Eg no 404's).


嵌套类摘要
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段
_handler
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
ResourceHandler()
           
 
方法摘要
protected  void doDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource)
           
protected  void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
          Set the response headers.
 void doStart()
          Start the managed lifecycle beans in the order they were added.
 Resource getBaseResource()
           
 String getCacheControl()
           
 MimeTypes getMimeTypes()
           
protected  Resource getResource(HttpServletRequest request)
           
 Resource getResource(String path)
           
 String getResourceBase()
           
 Resource getStylesheet()
           
protected  Resource getWelcome(Resource directory)
           
 String[] getWelcomeFiles()
           
 void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
          Handle a request.
 boolean isAliases()
           
 boolean isDirectoriesListed()
          Get the directory option.
 boolean isEtags()
           
 void setAliases(boolean aliases)
          Set if resource aliases (eg symlink, 8.3 names, case insensitivity) are allowed.
 void setBaseResource(Resource base)
           
 void setCacheControl(String cacheControl)
           
 void setDirectoriesListed(boolean directory)
          Set the directory.
 void setEtags(boolean etags)
           
 void setMimeTypes(MimeTypes mimeTypes)
           
 void setResourceBase(String resourceBase)
           
 void setStylesheet(String stylesheet)
           
 void setWelcomeFiles(String[] welcomeFiles)
           
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法
destroy, doStop, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler, setServer
 
从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法
dump, expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
 
从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法
dumpThis, getServer
 
从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

构造方法详细信息

ResourceHandler

public ResourceHandler()
方法详细信息

getMimeTypes

public MimeTypes getMimeTypes()

setMimeTypes

public void setMimeTypes(MimeTypes mimeTypes)

isAliases

public boolean isAliases()
返回:
True if resource aliases are allowed.

setAliases

public void setAliases(boolean aliases)
Set if resource aliases (eg symlink, 8.3 names, case insensitivity) are allowed. Allowing aliases can significantly increase security vulnerabilities. If this handler is deployed inside a ContextHandler, then the ContextHandler.isAliases() takes precedent.

参数:
aliases - True if aliases are supported.

isDirectoriesListed

public boolean isDirectoriesListed()
Get the directory option.

返回:
true if directories are listed.

setDirectoriesListed

public void setDirectoriesListed(boolean directory)
Set the directory.

参数:
directory - true if directories are listed.

isEtags

public boolean isEtags()
返回:
True if ETag processing is done

setEtags

public void setEtags(boolean etags)
参数:
etags - True if ETag processing is done

doStart

public void doStart()
             throws Exception
从类 AggregateLifeCycle 复制的描述
Start the managed lifecycle beans in the order they were added.

覆盖:
HandlerWrapper 中的 doStart
抛出:
Exception
另请参见:
AbstractLifeCycle.doStart()

getBaseResource

public Resource getBaseResource()
返回:
Returns the resourceBase.

getResourceBase

public String getResourceBase()
返回:
Returns the base resource as a string.

setBaseResource

public void setBaseResource(Resource base)
参数:
base - The resourceBase to set.

setResourceBase

public void setResourceBase(String resourceBase)
参数:
resourceBase - The base resource as a string.

getStylesheet

public Resource getStylesheet()
返回:
Returns the stylesheet as a Resource.

setStylesheet

public void setStylesheet(String stylesheet)
参数:
stylesheet - The location of the stylesheet to be used as a String.

getCacheControl

public String getCacheControl()
返回:
the cacheControl header to set on all static content.

setCacheControl

public void setCacheControl(String cacheControl)
参数:
cacheControl - the cacheControl header to set on all static content.

getResource

public Resource getResource(String path)
                     throws MalformedURLException
抛出:
MalformedURLException

getResource

protected Resource getResource(HttpServletRequest request)
                        throws MalformedURLException
抛出:
MalformedURLException

getWelcomeFiles

public String[] getWelcomeFiles()

setWelcomeFiles

public void setWelcomeFiles(String[] welcomeFiles)

getWelcome

protected Resource getWelcome(Resource directory)
                       throws MalformedURLException,
                              IOException
抛出:
MalformedURLException
IOException

handle

public void handle(String target,
                   Request baseRequest,
                   HttpServletRequest request,
                   HttpServletResponse response)
            throws IOException,
                   ServletException
从接口 Handler 复制的描述
Handle a request.

指定者:
接口 Handler 中的 handle
覆盖:
HandlerWrapper 中的 handle
参数:
target - The target of the request - either a URI or a name.
baseRequest - The original unwrapped request object.
request - The request either as the Request object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection() method can be used access the Request object if required.
response - The response as the Response object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection() method can be used access the Response object if required.
抛出:
IOException
ServletException

doDirectory

protected void doDirectory(HttpServletRequest request,
                           HttpServletResponse response,
                           Resource resource)
                    throws IOException
抛出:
IOException

doResponseHeaders

protected void doResponseHeaders(HttpServletResponse response,
                                 Resource resource,
                                 String mimeType)
Set the response headers. This method is called to set the response headers such as content type and content length. May be extended to add additional headers.

参数:
response -
resource -
mimeType -


Copyright © 2013. All Rights Reserved.