I wouldn't subclass ActionServlet just for this.  Try doing this in a
Struts plugin instead:

package edu.uga.itos;
public class HobbsPlugIn
        implements PlugIn {

    public void init(ActionServlet servlet, ModuleConfig config)
            throws ServletException {

        String actionList = "";
        ActionConfig[] actionConfigurations = config.findActionConfigs();

        for(int i = 0; i < actionConfigurations.length; i++) {
            actionList += actionConfigurations[i].getPath();
        }
        servlet.getServletContext().setAttribute("actionList", actionList);

    }

    public void destroy() {
        // does nothing
    }

}


and in your struts-config.xml:

    <plug-in className="edu.uga.itos.HobbsPlugIn">
        <set-property property="defnames" value="/WEB-INF/formdef.xml"/>
    </plug-in>


Hubert

On 3/24/06, Brantley Hobbs <[EMAIL PROTECTED]> wrote:
>
> This hint pointed me in the right direction.  In case anyone is
> interested, this is how I did it:
>
> - Subclass ActionServlet
> - Override process()
> - Inside process, add the following code:
>
> if(this.getServletContext().getAttribute("actionList") == null) {
>         String actionList = new String();
>         ModuleConfig theConfig = this.getModuleConfig(request);
>
>         ActionConfig[] actionConfigurations =
> theConfig.findActionConfigs();
>
>         for(int i = 0; i < actionConfigurations.length; i++) {
>                 ActionConfig thisAction = actionConfigurations[i];
>                 actionList += thisAction.getPath();
>         }
>         this.getServletContext().setAttribute("actionList", actionList);
> }
> super.process(request, response);
>
> What this does is create a new context parameter called "actionList".
> It's a "/" separated string of the action paths.  It's only called if
> the parameter doesn't exist, so if you're already using a parameter by
> that name it won't clobber it, and so that it is only called once (the
> first time any action is called).  Of course, you now have to update
> your application descriptor to use your new actionservlet instead of the
> struts one.
>
> This is a quick and dirty proof-of-concept, but it is functional.  If
> anyone has a better idea, please share.
>
> Cheers, and thanks Antonio!
> Brantley
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to