Class VirtualHttpContentFactory

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.http.content.VirtualHttpContentFactory
All Implemented Interfaces:
HttpContent.Factory, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

@ManagedObject public class VirtualHttpContentFactory extends org.eclipse.jetty.util.component.ContainerLifeCycle implements HttpContent.Factory
An HttpContent.Factory implementation which takes a Resource and fakes this resource as an entry in every directory. If any request is made for this resources file name, and it is not already present in that directory then the resource contained in this factory will be served instead.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

    org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

    org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendable

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    LEGEND
  • Constructor Summary

    Constructors
    Constructor
    Description
    VirtualHttpContentFactory(HttpContent.Factory factory, org.eclipse.jetty.util.resource.Resource resource, String contentType, org.eclipse.jetty.io.ByteBufferPool.Sized sizedBufferPool)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the HttpContent instance of a path.
     
    org.eclipse.jetty.util.resource.Resource
     
    protected boolean
     
     

    Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

    addBean, addBean, addEventListener, addManaged, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.util.component.Container

    getCachedBeans, getEventListeners

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

    dumpSelf

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    isDumpable
  • Constructor Details

    • VirtualHttpContentFactory

      public VirtualHttpContentFactory(HttpContent.Factory factory, org.eclipse.jetty.util.resource.Resource resource, String contentType, org.eclipse.jetty.io.ByteBufferPool.Sized sizedBufferPool)
  • Method Details

    • getResource

      @ManagedAttribute(value="Resource served when the requested path matches the virtual resource name", readonly=true) public org.eclipse.jetty.util.resource.Resource getResource()
      Returns:
      Returns the stylesheet as a Resource.
    • getContentType

      @ManagedAttribute(value="Content-Type used for the virtual resource", readonly=true) public String getContentType()
    • getContent

      public HttpContent getContent(String path) throws IOException
      Description copied from interface: HttpContent.Factory
      Get the HttpContent instance of a path.
      Specified by:
      getContent in interface HttpContent.Factory
      Parameters:
      path - The path.
      Returns:
      A HttpContent instance.
      Throws:
      IOException - if unable to get content
    • matchResource

      protected boolean matchResource(String path)
    • toString

      public String toString()
      Overrides:
      toString in class org.eclipse.jetty.util.component.AbstractLifeCycle