Re: NavigationHandler API faces.config
Take a peek in application scope at "org.apache.myfaces.config.RuntimeConfig" for a MyFaces specific solution. >-Original Message- >From: Dennis Byrne [mailto:[EMAIL PROTECTED] >Sent: Tuesday, January 10, 2006 12:35 AM >To: 'MyFaces Discussion' >Subject: Re: NavigationHandler API faces.config > >You can load it into an input stream w/ something like >this.getClass().getClassLoader().getResourceAsStream() . Then use DOM or SAX >API to parse it. > >Also, check out MyFaces source. I believe all of that information is stored >in a configuration based object model that is stored in an application >attribute at start up. > >>-Original Message- >>From: Dave [mailto:[EMAIL PROTECTED] >>Sent: Monday, January 9, 2006 10:46 PM >>To: users@myfaces.apache.org >>Subject: NavigationHandler API faces.config >> >>Is there any way to access faces.config? >> I need to know the to-view-id(JSP page) given from-view-id and >> from-outcome. The NavigationHanlder has only one method handle(..), Thanks. >> Dave >> >> >>- >>Yahoo! Photos >> Ring in the New Year with Photo Calendars. Add photos, events, holidays, >> whatever. > > >
Re: NavigationHandler API faces.config
You can load it into an input stream w/ something like this.getClass().getClassLoader().getResourceAsStream() . Then use DOM or SAX API to parse it. Also, check out MyFaces source. I believe all of that information is stored in a configuration based object model that is stored in an application attribute at start up. >-Original Message- >From: Dave [mailto:[EMAIL PROTECTED] >Sent: Monday, January 9, 2006 10:46 PM >To: users@myfaces.apache.org >Subject: NavigationHandler API faces.config > >Is there any way to access faces.config? > I need to know the to-view-id(JSP page) given from-view-id and from-outcome. > The NavigationHanlder has only one method handle(..), Thanks. > Dave > > >- >Yahoo! Photos > Ring in the New Year with Photo Calendars. Add photos, events, holidays, > whatever.
Re: NavigationHandler API faces.config
On 1/9/06, Andrew Robinson <[EMAIL PROTECTED]> wrote: I had wondered that myself for a time, as it would have made something I wrote easier. NavigationHandler really needs to change to make it more reusable (ability to get the settings from it instead of just that one method. As for the information, it will not be so easy as there is not necessarily one faces configuration file. You can have multiple. You may for example, have some to setup renders for example in a JSF controls bean. Therefore the question is how to get the file that has your navigation code. The best thing I can think of is just to have a setting in your web.config with the location of the configuration file you wish to use. Also be careful that if you are making a reusable component that you may want to stick to using the jsf resolution rules (supporting wildcards for example). If your intent is to have access to all of the configured navigation rules, you'd be best served to parse *exactly* the same configuration files that the JSF runtime does ... that way, you don't care which of the potentially many configuration file(s) has those definitions. The JSF spec covers the details of what's required in Section 10.3.2, but it boils down to processing (in order):* Any META-INF/faces-config.xml resources in the ServletContext resource paths for this application (typically packaged inside a JAR file in /WEB-INF/lib). * Any configuration resources configured on the context init parameter "javax.faces.CONFIG_FILES".* A resource named "/WEB-INF/faces-config.xml" (if it exists, and if it has not already been parsed). On the other hand, I would also be thinking hard about my motivations for wanting to do this kind of thing ... it seems like taking a very simple concept (outcome-driven navigation) and trying to make it something complicated. Customizing this will also make it harder for tools to give your users high quality support, because they are not going to understand what extra "stuff" you are providing. Craig
Re: NavigationHandler API faces.config
I had wondered that myself for a time, as it would have made something I wrote easier. NavigationHandler really needs to change to make it more reusable (ability to get the settings from it instead of just that one method. As for the information, it will not be so easy as there is not necessarily one faces configuration file. You can have multiple. You may for example, have some to setup renders for example in a JSF controls bean. Therefore the question is how to get the file that has your navigation code. The best thing I can think of is just to have a setting in your web.config with the location of the configuration file you wish to use. Also be careful that if you are making a reusable component that you may want to stick to using the jsf resolution rules (supporting wildcards for example). On 1/9/06, Dave <[EMAIL PROTECTED]> wrote: Is there any way to access faces.config? I need to know the to-view-id(JSP page) given from-view-id and from-outcome. The NavigationHanlder has only one method handle(..), Thanks. Dave Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
Re: NavigationHandler API faces.config
Dave wrote: Is there any way to access faces.config? I need to know the to-view-id(JSP page) given from-view-id and from-outcome. The NavigationHanlder has only one method handle(..), Thanks. Dave Unfortunately not, short of parsing faces-config yourself and re-implementing the algorithm the navigation handler uses. L.
NavigationHandler API faces.config
Is there any way to access faces.config? I need to know the to-view-id(JSP page) given from-view-id and from-outcome. The NavigationHanlder has only one method handle(..), Thanks. Dave Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.