이 콘텐츠는 선택한 언어로 제공되지 않습니다.

7.3. Context Root


The context root determines the URL of a deployed application. By default, the context root is identical with the application directory or archive structure; for example, if you deploy an application.war archive, which contains JSP pages in a hello directory, the JSPs in the hello directory will be available under /application/hello/.

Procedure 7.2. Rewriting the Default Context Root

You can change the context root if required. To rewrite the context root, you need to define the new context root and allow the server to use the new context.
  1. To define a new context root, add the context-root element with the new value to the deployment descriptor of the application:
    • To change the context root of a web application, add the context-root element to the jboss-web.xml file.

      Example 7.3. Example jboss-web.xml with a context root defined

      <?xml version="1.0"?>
      <jboss-web>
         <context-root>/application-root</context-root>
      </jboss-web>
      Copy to Clipboard Toggle word wrap
      The URL address for the application on localhost is

      http://localhost:8080/application-root

    • To change the context root of a servlet, change the url-pattern element in the web.xml file.

      Example 7.4. Example web.xml with a context root defined

      <?xml version="1.0"?>
      <servlet-mapping>
        <servlet-name>MapRenderer</servlet-name>
        <url-pattern>/servlet-root</url-pattern>
      </servlet-mapping>
      Copy to Clipboard Toggle word wrap
      The URL address for the servlet on localhost is

      http://localhost:8080/application-root/servlet-root

  2. To start the server with the REWRITE_CONTEXT_CHECK variable set to false, run the following command: run.sh -Dorg.apache.catalina.connector.Response.REWRITE_CONTEXT_CHECK=false
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat