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, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
@ManagedObject
public class VirtualHttpContentFactory
extends 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 AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendableNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVirtualHttpContentFactory(HttpContent.Factory factory, Resource resource, String contentType, ByteBufferPool.Sized sizedBufferPool) -
Method Summary
Modifier and TypeMethodDescriptiongetContent(String path) Get theHttpContentinstance of a path.protected booleanmatchResource(String path) toString()Methods inherited from class 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, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
VirtualHttpContentFactory
public VirtualHttpContentFactory(HttpContent.Factory factory, Resource resource, String contentType, ByteBufferPool.Sized sizedBufferPool)
-
-
Method Details
-
getResource
@ManagedAttribute(value="Resource served when the requested path matches the virtual resource name", readonly=true) public 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
Description copied from interface:HttpContent.FactoryGet theHttpContentinstance of a path.- Specified by:
getContentin interfaceHttpContent.Factory- Parameters:
path- The path.- Returns:
- A
HttpContentinstance. - Throws:
IOException- if unable to get content
-
matchResource
-
toString
- Overrides:
toStringin classAbstractLifeCycle
-