Foren

Struts Actions: Forward Path in BaseStrutsPortletAction?

Jana Volkmer, geändert vor 12 Jahren.

Struts Actions: Forward Path in BaseStrutsPortletAction?

New Member Beiträge: 6 Beitrittsdatum: 04.10.10 Neueste Beiträge
Hi there,

I am developing a hook that has to extend the configuration of every portlet (not just one specific portlet, but all portlets in my portal).

I started with this blog with some changes (on LR 6.1CE beta 4, Tomcat 7).

I added my custom tab to the /html/portlet/portlet_configuration/tabs1.jsp:


PortletURL test = renderResponse.createRenderURL();

test.setParameter("struts_action", "/portlet_configuration/test");
test.setParameter("redirect", redirect);
test.setParameter("returnToFullPageURL", returnToFullPageURL);
test.setParameter("portletResource", portletResource);

...

tabs1Names += ",test";
request.setAttribute("liferay-ui:tabs:url" + pos++, test.toString());



This renders an additional tab in the configuration menu.

Then I created the corresponding action class


public class TestAction extends [color=#ff0000]BaseStrutsPortletAction [/color] {

public void processAction(
			StrutsPortletAction originalStrutsPortletAction,
			PortletConfig portletConfig, ActionRequest actionRequest,
			ActionResponse actionResponse)
		throws Exception {
		originalStrutsPortletAction.processAction(
			originalStrutsPortletAction, portletConfig, actionRequest,
			actionResponse);
	}

	public String render(
			StrutsPortletAction originalStrutsPortletAction,
			PortletConfig portletConfig, RenderRequest renderRequest,
			RenderResponse renderResponse)
		throws Exception {

		System.out.println("Wrapped render");

		return originalStrutsPortletAction.render(
			null, portletConfig, renderRequest, renderResponse);
	}

	public void serveResource(
			StrutsPortletAction originalStrutsPortletAction,
			PortletConfig portletConfig, ResourceRequest resourceRequest,
			ResourceResponse resourceResponse)
		throws Exception {

		originalStrutsPortletAction.serveResource(
			originalStrutsPortletAction, portletConfig, resourceRequest,
			resourceResponse);
	}



Plus:
  • portal.properties: auth.public.paths=/portlet_configuration/test
  • jsp-Page: /html/portal/test.jsp


... and the action in liferay-hook.xml


	<portal-properties>portal.properties</portal-properties>
	<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
	<struts-action>
		<struts-action-path>/portlet_configuration/test</struts-action-path>
		<struts-action-impl>[...]TestAction</struts-action-impl>
	</struts-action>



It works fine so far except one exception:

2011-12-12 16:04:00 ERROR [PortletRequestProcessor:377] Forward does not exist


The hook-configuration for struts hooks does not offer anything but struts-action-path and struts-action-impl and all I found is a similar entry in this forum : http://www.liferay.com/de/community/forums/-/message_boards/message/507595 which has no helpful answers yet.


Has anyone got an idea how to get rid of this?