You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jeff Tassin <jt...@questia.com> on 2006/02/14 18:48:01 UTC

Custom service and page activation

Hello, 
I'm porting an application that has many, many pages with bookmarked URLs.  I've
researched various approaches for handling this with Tapestry.  I've ruled out
IExternalPage simply because the form of the URL can vary quite a bit for the
same page (due to legacy issues).  My approach was to create a custom bookmark
service and have it delegate the call to a handler which knows how to load,
initialize and activate a page using parameters extracted from the URL (handlers
are configured with Hivemind).  A servlet filter is used to forward the call to
the bookmark service for all known bookmarked URLs.  Now this works (or appears
to work correctly), but the problem is if there is an error in the page, a stack
trace is printed in the console, but Tapestry does not render the error
information in the browser.  I'm wondering if there is a way to render errors in
the browser with this approarch, or am I misusing the API?

Here is a snippet of my bookmark service:

public class BookmarkServiceImpl implements BookmarkService {
   private ResponseRenderer _responseRenderer;

   public void service(IRequestCycle cycle) throws IOException {
      
       // custom handler code would look something like
       String pageKey = getRequestParameter( "pageKey");  // BookmarkServiceImpl
has access to HttpServletRequest object 
       TopicPage topicPage = TopicPage)cycle.getPage("landing/topic/topicPage");
       topicPage.setPageKey( pageKey );
       cycle.activate( topicPage );
       _responseRenderer.renderResponse(cycle);
   }

   public String getName() {
      return "bookmark.service";
   }
   public void setResponseRenderer(ResponseRenderer responseRenderer)
   {
       _responseRenderer = responseRenderer;
   }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org