dbames
Jun 13th, 2008, 04:40 AM
We have a portlet application using Spring 2.0.8 and running on Oracle Application Server.
We are trying to use the ActionResponse.sendRedirect method in the processFormSubmission method of the controller in order to redirect users out of the portlet altogether if a specific condition is met:
However, whenever the sendRedirect method is invoked, we receive the following error:
Method sendRedirect() cannot be called after method setPortletMode()
As can be seen from the controller snippet below, we are not setting the portlet mode anywhere in the processFormSubmission method of the controller:
protected void processFormSubmission(ActionRequest actionRequest, ActionResponse actionResponse, Object object, BindException bindException) throws SystemException {
try {
// Get the form that was posted
WelcomeForm welcomeForm = (WelcomeForm) object;
//Check if the customer is out of scope of the application
if (welcomeForm.getAreYouOutOfScope().equalsIgnoreCas e("yes")) {
actionResponse.sendRedirect("http://www.google.com");
return;
}
} catch (SystemException se) {
throw se;
} catch (Exception e) {
throw new SystemException(ExceptionMessage.UNEXPECTED_EXCEPT ION, e);
}
}
I have looked throught the API documentation to try and see if there are any issues with the use of the sendRedirect method and came across a reference in the for the ParameterMappingInterceptor class that states that you cannot use sendRedirect if this interceptor is used, however, we are not using this interceptor.
I wondered whether use of the PortletModeParameterHandlerMapping would cause the portlet mode to be set and have amended the code to use the ParameterHandlerMapping class instead - however, the same problem still occurs. Example configuration below:
<bean id="portletParameterHandlerMapping" class="org.springframework.web.portlet.handler.ParameterH andlerMapping">
<property name="parameterName" value="action"/>
<property name="parameterMap">
<map>
<entry key="welcome"><ref bean="welcomeController"/></entry>
</map>
</property>
</bean>
Can anyone advise as to why the sendRedirect method is resulting in an exception? Thanks in advance for any help.
We are trying to use the ActionResponse.sendRedirect method in the processFormSubmission method of the controller in order to redirect users out of the portlet altogether if a specific condition is met:
However, whenever the sendRedirect method is invoked, we receive the following error:
Method sendRedirect() cannot be called after method setPortletMode()
As can be seen from the controller snippet below, we are not setting the portlet mode anywhere in the processFormSubmission method of the controller:
protected void processFormSubmission(ActionRequest actionRequest, ActionResponse actionResponse, Object object, BindException bindException) throws SystemException {
try {
// Get the form that was posted
WelcomeForm welcomeForm = (WelcomeForm) object;
//Check if the customer is out of scope of the application
if (welcomeForm.getAreYouOutOfScope().equalsIgnoreCas e("yes")) {
actionResponse.sendRedirect("http://www.google.com");
return;
}
} catch (SystemException se) {
throw se;
} catch (Exception e) {
throw new SystemException(ExceptionMessage.UNEXPECTED_EXCEPT ION, e);
}
}
I have looked throught the API documentation to try and see if there are any issues with the use of the sendRedirect method and came across a reference in the for the ParameterMappingInterceptor class that states that you cannot use sendRedirect if this interceptor is used, however, we are not using this interceptor.
I wondered whether use of the PortletModeParameterHandlerMapping would cause the portlet mode to be set and have amended the code to use the ParameterHandlerMapping class instead - however, the same problem still occurs. Example configuration below:
<bean id="portletParameterHandlerMapping" class="org.springframework.web.portlet.handler.ParameterH andlerMapping">
<property name="parameterName" value="action"/>
<property name="parameterMap">
<map>
<entry key="welcome"><ref bean="welcomeController"/></entry>
</map>
</property>
</bean>
Can anyone advise as to why the sendRedirect method is resulting in an exception? Thanks in advance for any help.