[jboss-user] [JBoss Portal] - wsrp_rewrite usage

esmith1 do-not-reply at jboss.com
Wed Apr 9 11:04:04 EDT 2008


Using JBAS 4.2.2 and Portal 2.6.4.  I would like to use the WSRP_REWRITE functionality as described in the reference manual 24.6.1,
anonymous wrote : 
  | As a result of this, the token to use for rewrite is the WSRP specified "wsrp_rewrite_". If the portlet sets the following response property 
  | 
  | res.setProperty("WSRP_REWRITE","true");
  | all occurrences of the wsrp_rewrite_ token in the portlet fragment will be replaced with a unique token (the window id). If the portlet also specifies content to be injected into the header of the page, that content is also subject to this rewrite. 
  | 
  | res.setProperty("HEADER_CONTENT", "
  |                function wsrp_rewrite_OnFocus(){alert('hello button');}
  |                ");
  |             
  | 

But when I "view page source" of the portlet content after rendering I am still seeing the wsrp_rewrite_ tokens, not the window id replacement.  Am I missing something?


  |   protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
  |    {
  |       rResponse.setContentType("text/html");
  |       rResponse.setProperty("WSRP_REWRITE","true");
  |       rResponse.setProperty("HEADER_CONTENT", "<script>function wsrp_rewrite_OnFocus(){alert('hello button');}</script>");
  | 
  |       PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view.jsp");
  |       prd.include(rRequest, rResponse);
  |    }
  | 
and view.jsp

  | <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
  | 
  | <portlet:defineObjects/>
  | 
  | <script>
  | 	var wsrp_rewrite_mygrid='TEST REWRITE';
  | </script>
  | Hello Rewrite Test Portlet
  | 

source produced

  | ...
  | <link rel="icon" type="image/gif" href="/portal-core/themes/renaissance/images/animated_favicon1.gif" />
  | 
  |    <!-- insert header content that was possibly set by portlets on the page -->
  | <script>function wsrp_rewrite_OnFocus(){alert('hello button');}</script>
  | 
  | </head>
  | 
  | <body id="body">
  | 
  | ...
  | 
  | <script>
  | 	var wsrp_rewrite_mygrid='TEST REWRITE';
  | </script>
  | Hello Rewrite Test Portlet</div></div></td><td class="portlet-content-right"></td></tr><tr>
  | ...
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142791#4142791

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142791



More information about the jboss-user mailing list