|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.InputBase
org.apache.velocity.runtime.directive.Include
Pluggable directive that handles the #include() statement in VTL. This #include() can take multiple arguments of either StringLiteral or Reference. Notes: ----- 1) The included source material can only come from somewhere in the TemplateRoot tree for security reasons. There is no way around this. If you want to include content from elsewhere on your disk, use a link from somwhere under Template Root to that content. 2) By default, there is no output to the render stream in the event of a problem. You can override this behavior with two property values : include.output.errormsg.start include.output.errormsg.end If both are defined in velocity.properties, they will be used to in the render output to bracket the arg string that caused the problem. Ex. : if you are working in html then include.output.errormsg.start= might be an excellent way to start... 3) As noted above, #include() can take multiple arguments. Ex : #include( "foo.vm" "bar.vm" $foo ) will simply include all three if valid to output w/o any special separator.
Field Summary | |
---|---|
private java.lang.String |
outputMsgEnd
|
private java.lang.String |
outputMsgStart
|
Fields inherited from class org.apache.velocity.runtime.directive.Directive |
---|
rsvc |
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
---|
BLOCK, LINE |
Constructor Summary | |
---|---|
Include()
|
Method Summary | |
---|---|
java.lang.String |
getName()
Return name of this directive. |
int |
getType()
Return type of this directive. |
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
simple init - init the tree and get the elementKey from the AST |
private void |
outputErrorToStream(java.io.Writer writer,
java.lang.String msg)
Puts a message to the render output stream if ERRORMSG_START / END are valid property strings. |
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node)
iterates through the argument list and renders every argument that is appropriate. |
private boolean |
renderOutput(Node node,
InternalContextAdapter context,
java.io.Writer writer)
does the actual rendering of the included file |
Methods inherited from class org.apache.velocity.runtime.directive.InputBase |
---|
getInputEncoding |
Methods inherited from class org.apache.velocity.runtime.directive.Directive |
---|
getColumn, getLine, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String outputMsgStart
private java.lang.String outputMsgEnd
Constructor Detail |
public Include()
Method Detail |
public java.lang.String getName()
getName
in class Directive
public int getType()
getType
in class Directive
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws java.lang.Exception
init
in class Directive
java.lang.Exception
public boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException, MethodInvocationException, ResourceNotFoundException
render
in class Directive
java.io.IOException
MethodInvocationException
ResourceNotFoundException
private boolean renderOutput(Node node, InternalContextAdapter context, java.io.Writer writer) throws java.io.IOException, MethodInvocationException, ResourceNotFoundException
node
- AST argument of type StringLiteral or Referencecontext
- valid context so we can render Referenceswriter
- output Writer
java.io.IOException
MethodInvocationException
ResourceNotFoundException
private void outputErrorToStream(java.io.Writer writer, java.lang.String msg) throws java.io.IOException
java.io.IOException
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |