|
| Re: WSRP | Portlet Caching |
 |
Wed, 14 May 2008 08:09:24 -070 |
Hi,
this is problem is related to navigational state. since the navigation state is
set to true and the same markup will be sent back when the remote portlet sent
for markup request.
What you can do:
Create a Interceptor and clear the navigational state in precise
follow this steps.
1) create the navigational state interceptor
2) configure this interceptor in . go to merged view and copy the following file
in your web app
wsrp-consumer-handler-config.xml
NavigationalStateInterceptor.java
[pre]
package com.portal.consumer.interceptor;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;
import com.bea.wsrp.consumer.interceptor.IBlockingInteractionInterceptor;
import com.bea.wsrp.consumer.interceptor.IGetMarkupInterceptor;
import com.bea.wsrp.consumer.interceptor.Status;
import com.bea.wsrp.consumer.interceptor.Status.OnFault;
import com.bea.wsrp.consumer.interceptor.Status.OnIOFailure;
import com.bea.wsrp.consumer.interceptor.Status.PostInvoke;
import com.bea.wsrp.consumer.interceptor.Status.PreInvoke;
import com.bea.wsrp.model.markup.IBlockingInteractionRequestContext;
import com.bea.wsrp.model.markup.IBlockingInteractionResponseContext;
import com.bea.wsrp.model.markup.IGetMarkupBaseResponseContext;
import com.bea.wsrp.model.markup.IGetMarkupRequestContext;
import com.bea.wsrp.model.markup.IGetMarkupResponseContext;
/**
* Replace text in the response's markup This could be used to rebrand a
* portlet.
*
*/
public class NavigationalStateInterceptor implements IGetMarkupInterceptor,
IBlockingInteractionInterceptor {
/**
* Called before a getMarkup request is sent to the producer Do Nothing
* Continue
*
* @return CONTINUE_CHAIN
*/
public PreInvoke preInvoke(IGetMarkupRequestContext requestCtx) {
String navState = (String)
requestCtx.getHttpServletRequest().getParameter("navState");
if (navState != null || "false".equals(navState)) {
requestCtx.setNavigationalState("");
}
return Status.PreInvoke.CONTINUE_CHAIN;
}
/**
* Replace the text and continue
*
* @return CONTINUE_CHAIN
*/
public PostInvoke postInvoke(IGetMarkupRequestContext requestCtx,
IGetMarkupResponseContext responseCtx) {
return Status.PostInvoke.CONTINUE_CHAIN;
}
/**
* Called when a fault occurs during getMarkup Do Nothing Continue, let the
* framework handle the fault
*
* @return CONTINUE_CHAIN
*/
public OnFault onFault(IGetMarkupRequestContext requestCtx,
IGetMarkupResponseContext responseCtx,
Throwable exception) {
return Status.OnFault.CONTINUE_CHAIN;
}
/**
* Called when an IO failure occurs during getMarkup Do Nothing Continue,
* let the framework handle the fault
*
* @return CONTINUE_CHAIN
*/
public OnIOFailure onIOFailure(IGetMarkupRequestContext requestCtx,
IGetMarkupResponseContext responseCtx,
Throwable exception) {
return Status.OnIOFailure.CONTINUE_CHAIN;
}
/**
* Called before a getMarkup request is sent to the producer Do Nothing
* Continue
*
* @return CONTINUE_CHAIN
*/
public PreInvoke preInvoke(IBlockingInteractionRequestContext requestCtx) {
return Status.PreInvoke.CONTINUE_CHAIN;
}
/**
* Replace the text and continue
*
* @return CONTINUE_CHAIN
*/
public PostInvoke postInvoke(IBlockingInteractionRequestContext requestCtx,
IBlockingInteractionResponseContext responseCtx) {
return Status.PostInvoke.CONTINUE_CHAIN;
}
/**
* Called when a fault occurs during getMarkup Do Nothing Continue, let the
* framework handle the fault
*
* @return CONTINUE_CHAIN
*/
public OnFault onFault(IBlockingInteractionRequestContext requestCtx,
IBlockingInteractionResponseContext responseCtx, Throwable exception) {
return Status.OnFault.CONTINUE_CHAIN;
}
/**
* Called when an IO failure occurs during getMarkup Do Nothing Continue,
* let the framework handle the fault
*
* @return CONTINUE_CHAIN
*/
public OnIOFailure onIOFailure(IBlockingInteractionRequestContext requestCtx,
IBlockingInteractionResponseContext responseCtx, Throwable exception) {
return Status.OnIOFailure.CONTINUE_CHAIN;
}
}[/pre]
wsrp-consumer-handler-config.xml
[pre]
<?xml version="1.0" encoding="UTF-8"?>
<wsrp-consumer-handler-config
xmlns="http://www.bea.com/ns/portal/90/wsrp-consumer-handler-config"&g
t;
<interceptor>
<name>NavigationalStateInterceptor</name>
<class-name>
com.portal.consumer.interceptor.NavigationalStateInterceptor</class-name>
</interceptor>
<interceptor-group>
<name>myGroupName</name>
<interceptor-name>NavigationalStateInterceptor</interceptor-name>
</interceptor-group>
</wsrp-consumer-handler-config>[/pre]
Regards
|
| Post Reply
|
|
|
|
|
|
|
|
|
|