Package org.kohsuke.stapler
Class StaticViewFacet
- java.lang.Object
-
- org.kohsuke.stapler.Facet
-
- org.kohsuke.stapler.StaticViewFacet
-
public class StaticViewFacet extends Facet
- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from class org.kohsuke.stapler.Facet
ALLOW_VIEW_NAME_PATH_TRAVERSAL, LOGGER
-
-
Constructor Summary
Constructors Constructor Description StaticViewFacet(String... allowedExtensions)
StaticViewFacet(Collection<String> allowedExtensions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtension(String ext)
void
buildIndexDispatchers(MetaClass owner, List<Dispatcher> dispatchers)
AddsDispatcher
s that serves the likes ofindex.EXT
The default implementation invokesFacet.handleIndexRequest(RequestImpl, ResponseImpl, Object, MetaClass)
but facet implementations can improve runtime dispatch performance by testing the presence of index view page upfront.void
buildViewDispatchers(MetaClass owner, List<Dispatcher> dispatchers)
AddsDispatcher
s that look at one token and binds that to the views associated with the 'it' object.javax.servlet.RequestDispatcher
createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName)
Creates aRequestDispatcher
that handles the given view, or return null if no such view was found.protected URL
findResource(Klass c, String fileName)
Determines if this resource can be servedboolean
handleIndexRequest(RequestImpl req, ResponseImpl rsp, Object node, MetaClass nodeMetaClass)
Attempts to route the HTTP request to the 'index' page of the 'it' object.-
Methods inherited from class org.kohsuke.stapler.Facet
buildFallbackDispatchers, createRequestDispatcher, createRequestDispatcher, createValidatingDispatcher, discover, discoverExtensions, getExtensionSuffix, getKlass, handleIndexRequest, isBasename
-
-
-
-
Constructor Detail
-
StaticViewFacet
public StaticViewFacet(String... allowedExtensions)
-
StaticViewFacet
public StaticViewFacet(Collection<String> allowedExtensions)
-
-
Method Detail
-
addExtension
public void addExtension(String ext)
-
buildViewDispatchers
public void buildViewDispatchers(MetaClass owner, List<Dispatcher> dispatchers)
Description copied from class:Facet
AddsDispatcher
s that look at one token and binds that to the views associated with the 'it' object.- Specified by:
buildViewDispatchers
in classFacet
- See Also:
Facet.createValidatingDispatcher(AbstractTearOff, ScriptExecutor)
-
findResource
protected URL findResource(Klass c, String fileName)
Determines if this resource can be served
-
createRequestDispatcher
public javax.servlet.RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException
Description copied from class:Facet
Creates aRequestDispatcher
that handles the given view, or return null if no such view was found.- Overrides:
createRequestDispatcher
in classFacet
type
- If "it" is non-null,it.getClass()
. Otherwise the class from which the view is searched.- Throws:
IOException
- See Also:
Facet.createRequestDispatcher(AbstractTearOff, ScriptExecutor, Object, String)
-
buildIndexDispatchers
public void buildIndexDispatchers(MetaClass owner, List<Dispatcher> dispatchers)
Description copied from class:Facet
AddsDispatcher
s that serves the likes ofindex.EXT
The default implementation invokesFacet.handleIndexRequest(RequestImpl, ResponseImpl, Object, MetaClass)
but facet implementations can improve runtime dispatch performance by testing the presence of index view page upfront.- Overrides:
buildIndexDispatchers
in classFacet
-
handleIndexRequest
public boolean handleIndexRequest(RequestImpl req, ResponseImpl rsp, Object node, MetaClass nodeMetaClass) throws IOException, javax.servlet.ServletException
Description copied from class:Facet
Attempts to route the HTTP request to the 'index' page of the 'it' object.- Specified by:
handleIndexRequest
in classFacet
- Returns:
- true if the processing succeeds. Otherwise false.
- Throws:
IOException
javax.servlet.ServletException
- See Also:
Facet.handleIndexRequest(AbstractTearOff, ScriptExecutor, RequestImpl, ResponseImpl, Object)
-
-