Package org.takes.rs
Class RsVelocity
- java.lang.Object
-
- org.takes.rs.RsWrap
-
- org.takes.rs.RsVelocity
-
public final class RsVelocity extends RsWrap
Response that converts Velocity template to text.This response implementation is rendering a page from Apache Velocity template. Here is how you can use it:
public final class TkHelp implements Take { @Override public Response act(final Request req) { return new RsHTML( new RsVelocity( this.getClass().getResource("help.html.vm"), new RsVelocity.Pair("name", "Jeffrey") ) ); } }
The class is immutable and thread-safe.
- Since:
- 0.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RsVelocity.Pair
Pair of values.
-
Constructor Summary
Constructors Constructor Description RsVelocity(InputStream template, Map<CharSequence,Object> params)
Ctor.RsVelocity(InputStream template, RsVelocity.Pair... params)
Ctor.RsVelocity(CharSequence template, RsVelocity.Pair... params)
Ctor.RsVelocity(String folder, InputStream template, Map<CharSequence,Object> params)
Ctor.RsVelocity(String folder, InputStream template, org.cactoos.Scalar<Map<String,Object>> params)
Ctor.RsVelocity(URL template, RsVelocity.Pair... params)
Ctor.
-
-
-
Constructor Detail
-
RsVelocity
public RsVelocity(CharSequence template, RsVelocity.Pair... params)
Ctor.- Parameters:
template
- Templateparams
- List of params- Since:
- 0.11
-
RsVelocity
public RsVelocity(URL template, RsVelocity.Pair... params) throws IOException
Ctor.- Parameters:
template
- Templateparams
- List of params- Throws:
IOException
- If fails- Since:
- 0.11
-
RsVelocity
public RsVelocity(InputStream template, RsVelocity.Pair... params)
Ctor.- Parameters:
template
- Templateparams
- Entries
-
RsVelocity
public RsVelocity(InputStream template, Map<CharSequence,Object> params)
Ctor.- Parameters:
template
- Templateparams
- Map of params
-
RsVelocity
public RsVelocity(String folder, InputStream template, Map<CharSequence,Object> params)
Ctor.- Parameters:
folder
- Template foldertemplate
- Templateparams
- Map of params
-
RsVelocity
public RsVelocity(String folder, InputStream template, org.cactoos.Scalar<Map<String,Object>> params)
Ctor.- Parameters:
folder
- Template foldertemplate
- Templateparams
- Map of params
-
-