A simple implementation of a SourceCodeViewer would be to have a service for adding and listing the source code and a component to display it.
Continue reading
Category Archives: ComponentRequestFilter
Tapestry source code viewer
Tapestry: Using ComponentRequestFilter
This example is similar to Securing Tapestry pages with Annotations, Part 1. My use case is to redirect a user to the starting page of a multiple step wizard in case a request is directly made to an intermediate step and the session has not been properly setup. One way to solve this problem (the ugly way) is to add a condition to every entry point in the page
public class MyPage
{
@SessionState(create = false)
private ShoppingCart shoppingCart;
@OnEvent(EventConstants.ACTIVATE)
Object activate()
{
if(shoppingCart == null)
{
return Index.class;
}
return null;
}
@OnEvent(EventConstants.SUCCESS)
Object doSomething()
{
if(shoppingCart == null
{
return Index.class;
}
.....
}
The problem with this code is that you have to check this condition for all event-handlers(Form, EventLink etc). A more elegant solution would be to use annotation secured by a ComponentRequestFilter.
Continue reading

