I have a tomcat running my CXF-based webapp.
Methods I work with have signatures like that:
@GET
@Path ("/handler/contract/{ItemId}")
@Produces ("application/xml")
public Item getItem(@PathParam("ItemId") Integer ItemId) throws Exception{
//...
return item;
}
This is usually very useful since I don’t have to deal with reponse/request objects and cover the business logic.
But now I need to access a local file in order to insert it into a PDF. I looked at all items here and in the doc but couldn’t find a reliable, easy way to access the Context or Request to find the current path of the webapp so I can access the file within the exploded WAR.
Any help how to get the current local path of the CXF-webapp?
As always, if you finally wrote a post you’ll find the solution yourself. With the
@Contextannotation you’ll get the correct context.Thanks for visiting. 🙂