File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes context path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "context path" Watch "context path" New topic
Author

context path

Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Does anybody know how can I access the context path (rooth path) of a web service?
I am looking for something equivalent to what you would do in a servlet: "getServletContext().getRealPath("/WEB-INF/xxxdirectory")".
Thanks,
Miki


Miki<br /> <br />SCJP 1.4, SCBCD 1.3
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Your only hope is probably proprietary features in your web services engine. Remember that not all SOAP messages are transmitted over HTTP...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Koskela,
I think I was not clear enough. I want to retrieve the context path (root path) from the web service itself, where this is running (for e.g. for making use of the I/O file system for different resources allocation). So not from the client. In other word how can I read from/create files from the web service from a subdirectory of the WEB-INF for e.g.
I this is what you understood initially what does this have to do with SOAP messages transmitted over HTTP ?
Miki
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ok. I thought you meant context path as in "the concept defined in the Java Servlet specification", which means "http://host ort/myapp/mywebapp" etc...
Still, I believe there is no standard way of doing this.
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Sorry, I've ment the root path of the application (web service). However it feels very strange there is not way to retrieve that. It seems to me very basic. Otherwise I'll just put it in a property file and change it each time the aaplication is deployed in a different location. But this is what I wanted to avoid.
Ok, thanks anyway.
Miki
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: context path