org.resthub.web.springmvc.view.velocity
Class RouteDirective
java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.resthub.web.springmvc.view.velocity.RouteDirective
- All Implemented Interfaces:
- Cloneable, org.apache.velocity.runtime.directive.DirectiveConstants
public class RouteDirective
- extends org.apache.velocity.runtime.directive.Directive
#route directive for the Velocity engine.
Computes an URL given a Controller.action(argName:'argValue',...) argument.
Examples:
- #route("helloWorldController.sayHelloName(name:'yourname')")
will resolve '/hello/yourname' because the route configured is "GET /hello/{name} helloWorldController.sayHelloName"
- #route("helloWorldController.sayHello")
will resolve '/hello' because the route configured is "GET /hello helloWorldController.sayHello"
- Author:
- Brian Clozel
- See Also:
Router
| Fields inherited from class org.apache.velocity.runtime.directive.Directive |
rsvc |
| Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
BLOCK, LINE |
|
Method Summary |
String |
getName()
Name of the Velocity directive to be called from the .vm views
#route |
int |
getType()
This directive is a "LINE directive", meaning it has to be
written on a single line. |
boolean |
render(org.apache.velocity.context.InternalContextAdapter context,
Writer writer,
org.apache.velocity.runtime.parser.node.Node node)
Renders the directive |
| Methods inherited from class org.apache.velocity.runtime.directive.Directive |
getColumn, getLine, getScopeName, getTemplateName, init, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocation |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RouteDirective
public RouteDirective()
getName
public String getName()
- Name of the Velocity directive to be called from the .vm views
#route
- Specified by:
getName in class org.apache.velocity.runtime.directive.Directive
getType
public int getType()
- This directive is a "LINE directive", meaning it has to be
written on a single line.
- Specified by:
getType in class org.apache.velocity.runtime.directive.Directive
- Returns:
- org.apache.velocity.runtime.directive.DirectiveConstants.LINE
render
public boolean render(org.apache.velocity.context.InternalContextAdapter context,
Writer writer,
org.apache.velocity.runtime.parser.node.Node node)
throws IOException,
org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
org.apache.velocity.exception.MethodInvocationException
- Renders the directive
- Specified by:
render in class org.apache.velocity.runtime.directive.Directive
- Parameters:
context - velocity contextwriter - used for writing directive result in the viewnode - body of the directive (params, content)
- Returns:
- true if the directive rendered ok.
- Throws:
IOException
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
Copyright © 2010-2012. All Rights Reserved.