Where during a Page's life cycle do I have access to the WebResponse for the page being requested?

The application I've been developing stand-alone now has to run inside Plumtree Portal. The Plumtree-related code is not particularly intrusive. I have all my pages extending a common class whose constructor -- if I expect to be in Portlet mode -- grabs the HttpServletRequest and HttpServletResponse from the ServletWebRequest and WebResponse, and supplies them to Plumtree. (Code below. [1]) I don't know much about portals in general, but Plumtree rewrites all the src and href attributes to point to these locations through the portal.

I'm not creating a Portlet, by the way, just a normal web app. Plumtree is told the URL to use for this content, and it makes HTTP requests to get at it.

We've just gotten this working, and for pages constructed as BookmarkablePages this works fine. But when I use a PageLink, it falls apart. The page renders but is not sitting inside the portal. I think I understand why, but I'm not sure how to fix it. The trouble is that the page to be visited on the *next* HTTP request is created during *this* request, so the current HttpServletRequest is not relevant.

I thought that I could fix this by moving the Plumtree code out of the constructor and into somewhere else. I tried:

    onBeginRequest: ClassCastException in (WebResponse) getResponse()
    onEndRequest: ClassCastException in (WebResponse) getResponse()
    onRender: won't compile: Page.onRender() is final.

I'm at a loss to know where to do this. Where can I insert this Plumtree instrumentation using the HttpServletRequest/Response objects related to the current page?

Thanks for any insight you can offer,

  -- Scott


[1] Here is the Plumtree-related code:

        try {
            // Get the Portlet Context
IPortletContext pContext = com.plumtree.remote.portlet.PortletContextFactory.createPortletContext(request, response);
            IPortletResponse pResponse = pContext.getResponse();
            IPortletRequest pRequest  = pContext.getRequest();
            IPortletUser pUser     = pContext.getUser();
            // Set hosted display mode
            pResponse.setHostedDisplayMode(HostedDisplayMode.Hosted);
        } catch (Exception e) {
            System.out.println("Get Portlet Context Failed with -- " + e);
        }



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to