org.kohsuke.stapler.jelly
Class JellyFacet

java.lang.Object
  extended by org.kohsuke.stapler.Facet
      extended by org.kohsuke.stapler.jelly.JellyFacet
All Implemented Interfaces:
JellyCompatibleFacet

@MetaInfServices(value=Facet.class)
public class JellyFacet
extends Facet
implements JellyCompatibleFacet

Facet that adds Jelly as the view.

Author:
Kohsuke Kawaguchi

Field Summary
 ResourceBundleFactory resourceBundleFactory
          Used to load ResourceBundles.
 ScriptInvoker scriptInvoker
          Used to invoke Jelly script.
static boolean TRACE
          This flag will activate the Jelly evaluation trace.
 
Fields inherited from class org.kohsuke.stapler.Facet
LOGGER
 
Constructor Summary
JellyFacet()
           
 
Method Summary
 void buildViewDispatchers(MetaClass owner, java.util.List<Dispatcher> dispatchers)
          Adds Dispatchers that look at one token and binds that to the views associated with the 'it' object.
 javax.servlet.RequestDispatcher createRequestDispatcher(RequestImpl request, java.lang.Class type, java.lang.Object it, java.lang.String viewName)
          Creates a RequestDispatcher that handles the given view, or return null if no such view was found.
 java.util.Collection<java.lang.Class<JellyClassTearOff>> getClassTearOffTypes()
           
 java.util.Collection<java.lang.String> getScriptExtensions()
          Gets the list of view script extensions, such as ".jelly".
 boolean handleIndexRequest(RequestImpl req, ResponseImpl rsp, java.lang.Object node, MetaClass nodeMetaClass)
          Attempts to route the HTTP request to the 'index' page of the 'it' object.
static void setExpressionFactory(javax.servlet.ServletContextEvent event, org.apache.commons.jelly.expression.ExpressionFactory factory)
          Sets the Jelly ExpressionFactory to be used to parse views.
 
Methods inherited from class org.kohsuke.stapler.Facet
buildFallbackDispatchers, discover, discoverExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scriptInvoker

public volatile ScriptInvoker scriptInvoker
Used to invoke Jelly script. Can be replaced to the custom object.


resourceBundleFactory

public volatile ResourceBundleFactory resourceBundleFactory
Used to load ResourceBundles.


TRACE

public static boolean TRACE
This flag will activate the Jelly evaluation trace. It generates extra comments into HTML, indicating where the fragment was rendered.

Constructor Detail

JellyFacet

public JellyFacet()
Method Detail

buildViewDispatchers

public void buildViewDispatchers(MetaClass owner,
                                 java.util.List<Dispatcher> dispatchers)
Description copied from class: Facet
Adds Dispatchers that look at one token and binds that to the views associated with the 'it' object.

Specified by:
buildViewDispatchers in class Facet

getClassTearOffTypes

public java.util.Collection<java.lang.Class<JellyClassTearOff>> getClassTearOffTypes()
Specified by:
getClassTearOffTypes in interface JellyCompatibleFacet

getScriptExtensions

public java.util.Collection<java.lang.String> getScriptExtensions()
Description copied from interface: JellyCompatibleFacet
Gets the list of view script extensions, such as ".jelly".

Specified by:
getScriptExtensions in interface JellyCompatibleFacet

createRequestDispatcher

public javax.servlet.RequestDispatcher createRequestDispatcher(RequestImpl request,
                                                               java.lang.Class type,
                                                               java.lang.Object it,
                                                               java.lang.String viewName)
                                                        throws java.io.IOException
Description copied from class: Facet
Creates a RequestDispatcher that handles the given view, or return null if no such view was found.

Specified by:
createRequestDispatcher in class Facet
type - If "it" is non-null, it.getClass(). Otherwise the class from which the view is searched.
Throws:
java.io.IOException

handleIndexRequest

public boolean handleIndexRequest(RequestImpl req,
                                  ResponseImpl rsp,
                                  java.lang.Object node,
                                  MetaClass nodeMetaClass)
                           throws java.io.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 class Facet
Returns:
true if the processing succeeds. Otherwise false.
Throws:
java.io.IOException
javax.servlet.ServletException

setExpressionFactory

public static void setExpressionFactory(javax.servlet.ServletContextEvent event,
                                        org.apache.commons.jelly.expression.ExpressionFactory factory)
Sets the Jelly ExpressionFactory to be used to parse views.

This method should be invoked from your implementation of ServletContextListener.contextInitialized(ServletContextEvent).

Once views are parsed, they won't be re-parsed just because you called this method to override the expression factory.

The primary use case of this feature is to customize the behavior of JEXL evaluation.



Copyright © 2012. All Rights Reserved.