What about using Package interface?

     Class cls = Class.forName("wicket.Application");
     Package pkg = cls.getPackage();

     String name = pkg.getName();

     String specTitle   = pkg.getSpecificationTitle();
     String specVendor  = pkg.getSpecificationVendor();
     String specVersion = pkg.getSpecificationVersion();

     String implTitle   = pkg.getImplementationTitle();
     String implVendor  = pkg.getImplementationVendor();
     String implVersion = pkg.getImplementationVersion();

implVersion holds the wicket version, e.g., 1.2-SNAPSHOT


> Finally this works for me:
>  
>   URL url = 
> WicketServlet.class.getProtectionDomain().getCodeSource().getLocation();
>   url  = new URL("jar", "", url.toString() + "!/META-INF/MANIFEST.MF");
>  
>   Manifest manifest = new  Manifest(url.openStream());

> Jan
  
> "Martijn Dashorst" <[EMAIL PROTECTED]>    wrote in
> message
> news:[EMAIL PROTECTED]
> we    could check the manifest ourselves in wicket servlet or    application.

> Martijn


  
> On 3/7/06, Eelco    Hillenius < [EMAIL PROTECTED]> wrote:  
> Yeah,      it wouldn't hurt to have version info available *easy* some way :)

> Eelco


> On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED]>      wrote:
>> heh, easier to let maven filter it into some static variable    in some 
>> class i
>> think :)
>>
>>      -Igor
>>
>>
>>
>> On 3/7/06, jan_bar < [EMAIL PROTECTED]> wrote:
>>      >
>> >
>> > Hi,
>> >
>> > for me      that
>>     
>> WicketServlet.class.getResourceAsStream("/META-INF/MANIFEST.MF")
>>      returns MANIFEST.MF from the JRE. How can I get Wicket manifest?
>>      >
>> > Is this method safe even if the Wicket.jar is part of      WAR/EAR?
>> >
>> > Jan
>> >
>> > "Martijn      Dashorst" <[EMAIL PROTECTED]>      wrote in message
>> news:[EMAIL PROTECTED]
>>      ...
>> > Basically the way Johan said is the way we retrieve the      version of 
>> > our own
>> application.
>> >
>> > Our own      application tries to retrieve the version number of the war
>> archive,      so that is a different usecase.
>> >
>> > Martijn
>>      >
>> > 
>> >
>> > On 3/7/06, Maurice Marrink      <[EMAIL PROTECTED]>      wrote:
>> > > Codesource should never be null, if you class is in      a jar file,
>> > > codesource points to the jar. 
>> >      > else it might point to a directory where your class files can be    
>> >   found
>> > > (or in subdirs thereof). if none of the above is      available it will
>> > > point to the classfile itself. 
>>      > >
>> > > But perhaps Martijn can tell you how he did it,      i know he did it for
>> > > our project but can't seem to find      where.
>> > >
>> > > Maurice
>> > > 
>> > > On 3/7/06, Joni Suominen < [EMAIL PROTECTED]> wrote:
>>      > > > On Tue, 2006-03-07 at 10:27 +0100, Juergen Donnerstag      wrote:
>> > > > > Do you know how to access that      information?  How do you get the 
>> > > > > jar
>> > > > >      file name a specific class has been loaded from?
>> > >      >
>> > > >
>>      getClass().getProtectionDomain().getCodeSource().getLocation()
>> gives      you
>> > > > the location where the class was loaded from. I      don't know in 
>> > > > which
>> > > > situations the CodeSource may be      null, though.
>> > > >
>> > > > Joni
>>      > > >
>> > > >
>> > > >
>> >      > >
>> ------------------------------------------------------- 
>> > > > This SF.Net email is sponsored by xPML, a      groundbreaking scripting
>> language
>> > > > that      extends applications into web and mobile media. Attend the 
>> > > > live
>>      webcast
>> > > > and join the prime developer group breaking      into this new coding
>> territory!
>> > > >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> > > >      _______________________________________________
>> > > >      Wicket-user mailing list
>> > > > [email protected] 
>> > > >
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>      > > >
>> > >
>> > > 
>> > >      -------------------------------------------------------
>> > >      This SF.Net email is sponsored by xPML, a groundbreaking scripting
>>      language
>> > > that extends applications into web and mobile      media. Attend the live
>> webcast
>> > > and join the prime      developer group breaking into this new coding
>> territory!
>>      > >
>> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
>>      > > _______________________________________________
>> > >      Wicket-user mailing list
>> > > [email protected]
>>      > >
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>      > >
>> > 
>> >
>> >
>> > --
>>      > Living a wicket life...
>> >
>> > Martijn Dashorst - http://www.jroller.com/page/dashorst
>>      > 
>> > Wicket 1.1.1 is out:
>> http://wicket.sourceforge.net/wicket-1.1
>>      >
>>
>>


> ------------------------------------------------------- 
> This SF.Net email is sponsored by xPML, a groundbreaking scripting      
> language
> that extends applications into web and mobile media. Attend the   live webcast
> and join the prime developer group breaking into this new      coding 
> territory!
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
> _______________________________________________ 
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user 








-- 
 shumbola                          mailto:[EMAIL PROTECTED]



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to