Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

how to get the web app context root path in a rest service

How can I retrieve the web app context path in a jfs rest service?

I contribute a rest service using the extension point:
<restService>
</restService>

The service url looks like: "https://localhost:9444/my_web_context_name/my_service_base"

In the service implementation class (com.example.MyService), I need to retrieve the web app context root path ("https://localhost:9444/my_web_context_name"). Yes, I can do this by parsing the http request uri. My question is: is there an API to retrieve the web app context path directly?

0 votes



One answer

Permanent link
You can use the com.ibm.team.jfs.app.RequestParam class to retrieve lots of parameters having to do with requests and the application configuration. In particular, the getContextPath method will return the context path. You would do something like this in a service method:


String contextPath = RequestParams.getContextPath(request.getParams());


How can I retrieve the web app context path in a jfs rest service?

I contribute a rest service using the extension point:
<restService>
</restService>

The service url looks like: "https://localhost:9444/my_web_context_name/my_service_base"

In the service implementation class (com.example.MyService), I need to retrieve the web app context root path ("https://localhost:9444/my_web_context_name"). Yes, I can do this by parsing the http request uri. My question is: is there an API to retrieve the web app context path directly?

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Mar 19 '10, 11:39 a.m.

Question was seen: 15,707 times

Last updated: Mar 19 '10, 11:39 a.m.

Related questions
Confirmation Cancel Confirm