[Logo] Mentawai Forum - Mentawai Web Framework
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 

Forum Read-Only! Check the new site and forum here!

I want XML ;-)  XML
Forum Index -> General Comments
Author Message
nioto



Joined: 01/08/2005 06:03:23
Messages: 3
Offline

Hi,

I just read all documentation about your framework, and it is very interesting.
I understand you don't want xml configuration files, but you have to undestand that some guys ( me included ) think xml is better.

A solution to allow xml configuration files, is to allow people who want it, to extend class org.mentawai.core.Controller, and rewrite the method initApplicationManager, which is not possible in v.1.1 because of private access to field appManager.

Could you consider this for the next release, please



nioTo

saoj



Joined: 01/07/2005 09:59:17
Messages: 2846
Location: Rio de Janeiro, RJ
Offline

Hi nioto,

I don't mind if someone extends Mentawai to suport XML configuration files. We just do not plan to offer this feature inside the framework. We have to stick to our no-xml roots.

Ok, talking about how to do it, I don't think you have to extend the Controller class.

You should extend the ApplicationManager class to create a XMLApplicationManager. Then you would override the loadActions() method to load a XML file and configure some ActionConfigs based on the XML data.

Agree or disagree ??? I may be wrong, but I think the initApplicationManager method has nothing to do with it.


Sergio Oliveira

nioto



Joined: 01/08/2005 06:03:23
Messages: 3
Offline

Hi saoj,


well I 've not seen the line in Controller where the ApplicationManager is init'ed
Code:
 56:  appManager.init(new ApplicationContext(sc)); 
 


That's why I proposed to override the Controller class (to have access to the ServletConfig) , but your idea will work perfectly.

Thanks.
nioTo

saoj



Joined: 01/07/2005 09:59:17
Messages: 2846
Location: Rio de Janeiro, RJ
Offline

Do you want to place your configuration inside the web.xml or do you want to create a new XML file ???

If what you want is web.xml, you can get the ServletContext inside your ApplicationManager through the following code:

Code:
 
 public void init(Context application) {
 
     ServletContext sc = null;
     if (application instanceof ApplicationContext) {
         ApplicationContext ac = (ApplicationContext) application;
         sc = ac.getServletContext();
     }
 
     // ... do what you need with servletcontext
     // ... call getInitParameter for example
 }
 
 



Sergio Oliveira

nioto



Joined: 01/08/2005 06:03:23
Messages: 3
Offline

I think in most cases, only the location of the configuration file will be put in web.xml .

saoj



Joined: 01/07/2005 09:59:17
Messages: 2846
Location: Rio de Janeiro, RJ
Offline

Ok, so you will get the name of the XML from the web.xml and load this XML file to get all the configuration information, right ???

If you can, post your solution here so other XML lovers can benefit from it.

Note that we are working on a global filter for development time (not production) that will check for modifications in the ApplicationManager.java and recompile it on the fly.

What do you think ?

Sergio Oliveira

 
Forum Index -> General Comments
Go to:   
Powered by JForum 2.1.6 © JForum Team