Skip to content

Creating a view @Annotation Based

Alexander Söderberg edited this page Sep 28, 2017 · 3 revisions
// Scan the file for views
try
{
    StaticViewManager.generate( yourClassInstance );
} catch ( final Exception e )
{
    e.printStackTrace();
}


// Declare a view
@ViewMatcher( filter = "random/uuid/", cache = false, name = "randomUUID" )
public Response randomUUID(final Request request)
{
    return new Response().setContent( "<h1>" + UUID.randomUUID() + "</h1>" );
}

// OR
@ViewMatcher( filter = "random/uuid/", cache = false, name = "randomUUID" )
public void randomUUID(final Request request, final Response response)
{
    response.setContent( "<h1>" + UUID.randomUUID() + "</h1>" );
}

The filter string uses the format outlined in this wiki page. cache is a boolean that determines if the view response will be stored in the server cache. name is a unique name that will only be used internally.

Navigation

Templates

Configuration

Files can be found in .kvantum/config

Views

/commands

Development

Clone this wiki locally