2

I'm working on a webapp which have webservices.

I'm to get build version, specification title etc which are then in the manifest file to respond to the resful service

For a web request I can do below. How can I access the manifest resource from a webservice request

FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/META-INF/MANIFEST.MF")

Sudhik
  • 119
  • 8

1 Answers1

2

By reading the java doc, it looks like that the package information only exists in the JAR file. which was generated by
jar cfm MyJar.jar Manifest.txt yourPackage/*.class

and the Manifest.txt would be:

Name: java/util/
Specification-Title: Java Utility Classes
Specification-Version: 1.2
Specification-Vendor: Example Tech, Inc.
Implementation-Title: java.util
Implementation-Version: build57
Implementation-Vendor: Example Tech, Inc.

Preston
  • 180
  • 9
  • ok. that makes sense. my app is a war file but still has the mf file with required details. any ideas on how i read that – Sudhik Sep 02 '21 at 09:20
  • @Sudhik Maybe you want this https://stackoverflow.com/questions/4239368/how-to-read-manifest-mf-inside-war-application – Preston Sep 03 '21 at 01:46
  • Thanks I got it to work for web requests. How about webservice requests – Sudhik Sep 03 '21 at 08:55
  • For those one uses Spring, I found useful this solution in webservices where don't have ServletContext: https://stackoverflow.com/a/25700939/2186777 – fl4l Aug 18 '23 at 15:04