Package com.groiss.gui
Class VelocityPage
java.lang.Object
com.groiss.gui.VelocityPage
- All Implemented Interfaces:
Page
,StreamablePage
Page
implementation which can handle Velocity-templates
following objects may be used in the context by default and may not be used in
set(String, Object)
- $Formatter - a
Formatter
instance - $user -
ThreadContext.getThreadPrincipal()
- $request -
ThreadContext.getThreadRequest()
- $Configuration -
Configuration.get()
- See Also:
-
Constructor Summary
ConstructorDescriptionif you use this constructor, you have to callsetTemplate(String)
VelocityPage
(String resource) loads the giventemplate
. theResource
to use will be determined automatically -
Method Summary
Modifier and TypeMethodDescriptionvoid
Set a header field in the response before writing the page.void
Set a header field in the response before writing the page.void
Set a header field in the response before writing the page.Returns the content type of the page, for example "text/html".Returns the list of http-response-headers to be set on theHttpServletResponse
void
void
adds the given object to theVelocityContext
void
setContentType
(String contentType) set the contenttypevoid
setTemplate
(String template) set the velocity-templateshow()
Called from the Dispatcher.
-
Constructor Details
-
VelocityPage
public VelocityPage()if you use this constructor, you have to callsetTemplate(String)
-
VelocityPage
loads the giventemplate
. theResource
to use will be determined automatically- Parameters:
resource
- the velocity template
-
-
Method Details
-
set
adds the given object to theVelocityContext
- Parameters:
name
- variable nameobj
- object
-
show
Description copied from interface:Page
Called from the Dispatcher. Returns a String representation suitable for viewing in the browser (HTML, XHTML, plain text, etc.) -
output
- Specified by:
output
in interfaceStreamablePage
-
getContentType
Description copied from interface:Page
Returns the content type of the page, for example "text/html".- Specified by:
getContentType
in interfacePage
- Returns:
- the contents mime type as String
-
setTemplate
set the velocity-template- Parameters:
template
- a string containing velocity-syntax
-
setContentType
set the contenttype- Parameters:
contentType
- the contenttype
-
getHeaders
Description copied from interface:Page
Returns the list of http-response-headers to be set on theHttpServletResponse
- Specified by:
getHeaders
in interfacePage
- Returns:
- the http-headers (the value may be one of
String
,Date
orInteger
-
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setHeader(String, String)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setDateHeader(String,long)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setIntHeader(String,int)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-