You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Volker Karlmeier <vo...@magiccode.eu> on 2008/05/02 14:53:15 UTC

Re: Retrieving action names configured in struts.xml

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I thought about that but I'd have to parse multiple xml-files. Besides this,
I'd have to change my code every time the format of struts.xml changes.

I'd prefer getting the parsed actions from struts :)

Volker

Mead Lai schrieb:
| read the struts.xml files, and phrase it
|
| On Wed, Apr 30, 2008 at 5:50 AM, Volker Karlmeier 
<vo...@magiccode.eu> wrote:
|> -----BEGIN PGP SIGNED MESSAGE-----
|>  Hash: SHA1
|>
|>  Hello struts freaks,
|>
|>  i would like to implement a rights management for my application. 
Therefore
|> I need to retrieve a list of actions configured in struts.xml.
|>  Does anyone of you have an idea how to get this information ?
|>  I can get a list of action classes using
|>
|>  ~        List<String> actions = new ArrayList<String>();
|>  ~        Dispatcher disp = Dispatcher.getInstance ();
|>  ~        PackageConfig actionMap =
|> 
((PackageConfig)disp.getConfigurationManager().getConfiguration().getPackageConfigs().get("<package
|> name of actions package>"));
|>  ~        Map<String,ActionConfig> actionConfigs =
|> actionMap.getAllActionConfigs();
|>  ~        Iterator actionIterator = actionConfigs.keySet().iterator();
|>  ~        while (actionIterator.hasNext()) {
|>  ~            String key   = (String) actionIterator.next();
|>  ~            ActionConfig config = actionConfigs.get(key);
|>  ~            String value=
|> 
config.getClassName().substring(config.getClassName().lastIndexOf(".")+1);
|>  ~            actions.add((String)value);
|>  ~        }
|>  ~        return actions;
|>
|>  But this is not exactly what i want. What i need is the names of the
|> actions.
|>  Any ideas ?
|>
|>  thanks in advance
|>
|>  ~  Volker
|>
|>
|>  - --
|>  - -------------------------------
|>
|>  Volker Karlmeier
|>  Friedrich-Freye-Str. 61
|>  45481 Mülheim/Ruhr
|>
|>  Tel. :  (+49) 208-7785675
|>  Mobil:  (+49) 176-21056587
|>  Mail :  Volker@magiccode.eu
|>
|>  -----BEGIN PGP SIGNATURE-----
|>  Version: GnuPG v1.4.7 (GNU/Linux)
|>
|>  iD8DBQFIF5guaEMQXBIqssERAqKuAJsHTPohbwctJd7crzUETpX7GNAcewCfcPvN
|>  ORF3KDd2juDK2i5B40gpA9w=
|>  =WJ/y
|>  -----END PGP SIGNATURE-----
|>
|>
|>  ---------------------------------------------------------------------
|>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
|>  For additional commands, e-mail: user-help@struts.apache.org
|>
|>
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
| For additional commands, e-mail: user-help@struts.apache.org
|


- --
- -------------------------------

Volker Karlmeier
Friedrich-Freye-Str. 61
45481 Mülheim/Ruhr

Tel. :  (+49) 208-7785675
Mobil:  (+49) 176-21056587
Mail :  Volker@magiccode.eu

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFIGw67aEMQXBIqssERAtx1AJ4uMe3lUp1pLH1Injwfq0TY3LhRAACgi71q
Z2AD5OKKnpeuAUozKgUtzbo=
=gT9X
-----END PGP SIGNATURE-----


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