public class VelocityPage extends Object implements StreamablePage
Page
implementation which can handle Velocity-templates
set(String, Object)
Formatter
instanceThreadContext.getThreadPrincipal()
ThreadContext.getThreadRequest()
Configuration.get()
Constructor and Description |
---|
VelocityPage()
if you use this constructor, you have to call
setTemplate(String) |
VelocityPage(String resource)
loads the given
template . the Resource to use will be determined automatically |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String header,
Date value)
Set a header field in the response before writing the page.
|
void |
addHeader(String header,
int value)
Set a header field in the response before writing the page.
|
void |
addHeader(String header,
String value)
Set a header field in the response before writing the page.
|
String |
getContentType()
Returns the content type of the page, for example "text/html".
|
List<Pair<String,Object>> |
getHeaders()
Returns the list of http-response-headers to be set on the
HttpServletResponse |
void |
output(Writer w) |
void |
set(String name,
Object obj)
adds the given object to the
VelocityContext |
void |
setContentType(String contentType)
set the contenttype
|
void |
setTemplate(String template)
set the velocity-template
|
String |
show()
Called from the Dispatcher.
|
public VelocityPage()
setTemplate(String)
public void set(String name, Object obj)
VelocityContext
name
- variable nameobj
- objectpublic String show()
Page
public void output(Writer w)
output
in interface StreamablePage
public String getContentType()
Page
getContentType
in interface Page
public void setTemplate(String template)
template
- a string containing velocity-syntaxpublic void setContentType(String contentType)
contentType
- the contenttypepublic List<Pair<String,Object>> getHeaders()
Page
HttpServletResponse
getHeaders
in interface Page
String
, Date
or Integer
public void addHeader(String header, String value)
HttpServletResponse.setHeader(String, String)
will be used to set to the new value.header
- the name of the headervalue
- the header valuepublic void addHeader(String header, Date value)
HttpServletResponse.setDateHeader(String,long)
will be used to set to the new value.header
- the name of the headervalue
- the header valuepublic void addHeader(String header, int value)
HttpServletResponse.setIntHeader(String,int)
will be used to set to the new value.header
- the name of the headervalue
- the header value@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.