You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2004/03/05 00:09:32 UTC

ConfigHelper.getActionMapping

I'm creating an ActionForm for my request under certain circumstances in 
a filter, because if I do a redirect in the filter, I want to save the 
original request parameters in the correct actionform and stick it in 
the session for later.

But I just upgraded from struts 1.1 to 1.2, and I'm getting null action 
mapping returned for my URLs when I call ConfigHelper.getActionMapping(url).

Is what I'm doing for some reason now not struts compatible?

I'm going to check out the source code, but if anyone knows immediately, 
you could save me some time.

Thanks
Adam

PS Here's the way I'm doing it in the filter:

HttpSession session = request.getSession();
ServletContext context = session.getServletContext();
ModuleUtils moduleUtils = ModuleUtils.getInstance();
ModuleConfig moduleConfig =
     moduleUtils.getModuleConfig(request, context);
ActionConfig actionConfig =
     moduleConfig.findActionConfig(requestedUrl);
ConfigHelper helper = new ConfigHelper(context, request, response);
int posFileExt = requestedUrl.lastIndexOf(".");
String strippedUrl = requestedUrl.substring(0, posFileExt);
ActionMapping actionMapping =
     helper.getActionMapping(strippedUrl);
ActionServlet actionServlet = (ActionServlet)
     context.getAttribute(Globals.ACTION_SERVLET_KEY);
logger.info("getting form for '" + strippedUrl + "', " +
             "actionMapping==" + actionMapping);
ActionForm form =
     RequestUtils.createActionForm(request, actionMapping,
                                   moduleConfig, actionServlet);


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ConfigHelper.getActionMapping

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 03/05/2004 12:09 AM Adam Hardy wrote:
> But I just upgraded from struts 1.1 to 1.2, and I'm getting null action 
> mapping returned for my URLs when I call 
> ConfigHelper.getActionMapping(url).

Hmm. Just looked at the source code. The method has only one line in it:

return null;


- which would explain why it returns null ;)

Just in case anyone was wondering. A bit of javadoc would have saved me 
a bit of time.


Adam
-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org