0

Example of root-context

   <?xml version="1.0" encoding="UTF-8"?>
    <jboss-web>
        <context-root>/Tesoreria-WEB</context-root>
        <max-active-sessions>300</max-active-sessions>
    </jboss-web>

Is it possible to get that "/TESORERIA-WEB" with some method in java with primefaces?

I have tried

PrimeRequestContext.getCurrentInstance(FacesContext.getCurrentInstance()).getApplicationContext());

But no success and can't find something on the internet about specifically getting root-context from web.xml

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
BugsForBreakfast
  • 712
  • 10
  • 30
  • This answer from @BalusC is what worked for me, thank you guys https://stackoverflow.com/questions/46556861/get-the-web-application-context-path-from-meta-inf-context-xml-to-produce-an-out so its basically FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); to get that "/Tesoreria-WEB" – BugsForBreakfast Jul 22 '19 at 15:14

1 Answers1

0

servletContext.getContextPath()

Returns the context path of the web application.

The context path is the portion of the request URI that is used to select the context of the request. The context path always comes first in a request URI. The path starts with a / character but does not end with a / character. For servlets in the default (root) context, this method returns "".*

or

httpServletRequest.getContextPath()

Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.

Community
  • 1
  • 1
Andreas
  • 154,647
  • 11
  • 152
  • 247