-
Notifications
You must be signed in to change notification settings - Fork 7
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.
IntellectualServer
Files can be found in .kvantum/config
- Getting Started
- View Patterns
- File Patterns
- server.yml
views.yml- socketFilters.yml
- translations.yml
- SSL
- Getting Started
- Modules
- Hello World
- Plugins
- Events
- Account System
- Authorization
- Application System
- Sessions
- Create a view - OOP based
- Create a view - @Annotation based
- Middleware
- Extending Crush (Templating syntax)
- ViewReturn