You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shale.apache.org by Gary VanMatre <gv...@comcast.net> on 2007/03/06 17:15:43 UTC

Determining the flavor of the JSF runtime

I've been trying to determine a better strategy for detecting the supplier and version of the JSF runtime. This has to do with a open JIRA ticket [1]. I attempted to create a utility class to determine the implementor of the runtime and the JSF spec version [2]. This was a real hack but I didn't see a better way and I'm still not sure the best way to dynamically extract this version information. Besides knowing the JSF version (1.1, 1.2), we need the implementation version (myfaces 1.1, 1.3...). I was thinking about trying to read the manifest but haven't figured out a good method. This seems like it should be part of the JSF API?


Any ideas?

Gary


[1] https://issues.apache.org/struts/browse/SHALE-418
[2] https://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/JSFRuntimeTracker.java?view=markup

SV: Determining the flavor of the JSF runtime

Posted by Hermod Opstvedt <he...@opstvedt.com>.
Hi

This is exactly what I was talking about. Finding something in the code that
distinguishes the versions. However this is only step one. Next is to figure
out which implementation (MyFaces, RI). Here one only needs to try an do a
class.forName on a class in each and check for exceptions.

Hermod


-----Opprinnelig melding-----
Fra: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sendt: 6. mars 2007 21:58
Til: dev@shale.apache.org
Emne: Re: Determining the flavor of the JSF runtime

Facelets has code to distinguish between JSF 1.1 and JSF 1.2.

com.sun.facelets.util.FacesAPI.

https://facelets.dev.java.net/source/browse/facelets/src/java/com/sun/facele
ts/util/FacesAPI.java

As Kito mentioned, it also came up at one point that this should be
part of the JSF API.



---------- Forwarded message ----------
From: Jesse Alexander (KBSA 21) <al...@credit-suisse.com>
Date: Oct 28, 2005 9:15 AM
Subject: RE: How to find out which implementation is running
To: MyFaces Discussion <us...@myfaces.apache.org>, martin@marinschek.com


Well...

I see two alternatives:

1) We add one/two method to javax.faces.application.Application
    eg. getImplName() and getSpecVersion()
   But that would require a spec change...

2) We ask that at startup one of the implementation classes adds
   the information as a managedBean or a external-context variable
   This could be added also without a spec change, just need to
   agree with the RI-people on an identifier to use...

regards
Alexander


-----Original Message-----
From: Martin Marinschek [mailto:martin.marinschek@gmail.com]
Sent: Friday, October 28, 2005 4:07 PM
To: MyFaces Discussion
Subject: Re: How to find out which implementation is running

Good question.

If you devise something like this, there should also be a way to check
for the spec version of the jsf implementation running.

regards,

Martin

On 10/28/05, Jesse Alexander (KBSA 21)
<al...@credit-suisse.com> wrote:
> Hi
>
> When I want to write a component that must run under more than
> JSF-implementation,
> I often should know (runtime not development time) which
implementation
> is running, in
> order to use the correct base-classes.
>
> Has somebody devised a clever method to find out which JSF-runtime is
> active?
> Or should we add something to enable this?
>
> regards
> Alexander


On 3/6/07, Gary VanMatre <gv...@comcast.net> wrote:
>
> I've been trying to determine a better strategy for detecting the supplier
and version of the JSF runtime. This has to do with a open JIRA ticket [1].
I attempted to create a utility class to determine the implementor of the
runtime and the JSF spec version [2]. This was a real hack but I didn't see
a better way and I'm still not sure the best way to dynamically extract this
version information. Besides knowing the JSF version (1.1, 1.2), we need the
implementation version (myfaces 1.1, 1.3...). I was thinking about trying to
read the manifest but haven't figured out a good method. This seems like it
should be part of the JSF API?
>
>
> Any ideas?
>
> Gary
>
>
> [1] https://issues.apache.org/struts/browse/SHALE-418
> [2]
https://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java
/org/apache/shale/clay/utils/JSFRuntimeTracker.java?view=markup


Re: Determining the flavor of the JSF runtime

Posted by Mike Kienenberger <mk...@gmail.com>.
Facelets has code to distinguish between JSF 1.1 and JSF 1.2.

com.sun.facelets.util.FacesAPI.

https://facelets.dev.java.net/source/browse/facelets/src/java/com/sun/facelets/util/FacesAPI.java

As Kito mentioned, it also came up at one point that this should be
part of the JSF API.



---------- Forwarded message ----------
From: Jesse Alexander (KBSA 21) <al...@credit-suisse.com>
Date: Oct 28, 2005 9:15 AM
Subject: RE: How to find out which implementation is running
To: MyFaces Discussion <us...@myfaces.apache.org>, martin@marinschek.com


Well...

I see two alternatives:

1) We add one/two method to javax.faces.application.Application
    eg. getImplName() and getSpecVersion()
   But that would require a spec change...

2) We ask that at startup one of the implementation classes adds
   the information as a managedBean or a external-context variable
   This could be added also without a spec change, just need to
   agree with the RI-people on an identifier to use...

regards
Alexander


-----Original Message-----
From: Martin Marinschek [mailto:martin.marinschek@gmail.com]
Sent: Friday, October 28, 2005 4:07 PM
To: MyFaces Discussion
Subject: Re: How to find out which implementation is running

Good question.

If you devise something like this, there should also be a way to check
for the spec version of the jsf implementation running.

regards,

Martin

On 10/28/05, Jesse Alexander (KBSA 21)
<al...@credit-suisse.com> wrote:
> Hi
>
> When I want to write a component that must run under more than
> JSF-implementation,
> I often should know (runtime not development time) which
implementation
> is running, in
> order to use the correct base-classes.
>
> Has somebody devised a clever method to find out which JSF-runtime is
> active?
> Or should we add something to enable this?
>
> regards
> Alexander


On 3/6/07, Gary VanMatre <gv...@comcast.net> wrote:
>
> I've been trying to determine a better strategy for detecting the supplier and version of the JSF runtime. This has to do with a open JIRA ticket [1]. I attempted to create a utility class to determine the implementor of the runtime and the JSF spec version [2]. This was a real hack but I didn't see a better way and I'm still not sure the best way to dynamically extract this version information. Besides knowing the JSF version (1.1, 1.2), we need the implementation version (myfaces 1.1, 1.3...). I was thinking about trying to read the manifest but haven't figured out a good method. This seems like it should be part of the JSF API?
>
>
> Any ideas?
>
> Gary
>
>
> [1] https://issues.apache.org/struts/browse/SHALE-418
> [2] https://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/utils/JSFRuntimeTracker.java?view=markup

SV: Determining the flavor of the JSF runtime

Posted by Hermod Opstvedt <he...@opstvedt.com>.
Hi

Reading the manifest depends on who build it, so that may break quickly

I think a better approach is to create small utility that looks for the few
(two?) implementations of a given class that has distinct characteristics
for the different versions of the api.

Hermod


-----Opprinnelig melding-----
Fra: Gary VanMatre [mailto:gvanmatre@comcast.net] 
Sendt: 6. mars 2007 17:16
Til: dev@shale.apache.org
Emne: Determining the flavor of the JSF runtime


I've been trying to determine a better strategy for detecting the supplier
and version of the JSF runtime. This has to do with a open JIRA ticket [1].
I attempted to create a utility class to determine the implementor of the
runtime and the JSF spec version [2]. This was a real hack but I didn't see
a better way and I'm still not sure the best way to dynamically extract this
version information. Besides knowing the JSF version (1.1, 1.2), we need the
implementation version (myfaces 1.1, 1.3...). I was thinking about trying to
read the manifest but haven't figured out a good method. This seems like it
should be part of the JSF API?


Any ideas?

Gary


[1] https://issues.apache.org/struts/browse/SHALE-418
[2]
https://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java
/org/apache/shale/clay/utils/JSFRuntimeTracker.java?view=markup


RE: Determining the flavor of the JSF runtime

Posted by "Kito D. Mann" <km...@virtua.com>.
This definitely sounds like a good candidate for being part of the spec...
I'll push that one onto the agenda  whenever they officially start the EG...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

* Sign up for the JSF Central newsletter!
http://oi.vresp.com/?fid=ac048d0e17 *



 

> -----Original Message-----
> From: Gary VanMatre [mailto:gvanmatre@comcast.net] 
> Sent: Tuesday, March 06, 2007 11:16 AM
> To: dev@shale.apache.org
> Subject: Determining the flavor of the JSF runtime
> 
> 
> I've been trying to determine a better strategy for detecting 
> the supplier and version of the JSF runtime. This has to do 
> with a open JIRA ticket [1]. I attempted to create a utility 
> class to determine the implementor of the runtime and the JSF 
> spec version [2]. This was a real hack but I didn't see a 
> better way and I'm still not sure the best way to dynamically 
> extract this version information. Besides knowing the JSF 
> version (1.1, 1.2), we need the implementation version 
> (myfaces 1.1, 1.3...). I was thinking about trying to read 
> the manifest but haven't figured out a good method. This 
> seems like it should be part of the JSF API?
> 
> 
> Any ideas?
> 
> Gary
> 
> 
> [1] https://issues.apache.org/struts/browse/SHALE-418
> [2] 
> https://svn.apache.org/viewvc/shale/framework/trunk/shale-clay
/src/main/java/org/apache/shale/clay/utils/JSFRuntimeTracker.jav>
a?view=markup
>