Change the context (URL Root) of a web project in eclipse

1

I'm with a project, that when you run it in the eclipse, you leave it listening in http://localhost:8080/nombre_del_proyecto/ . What I want is that now run in http://localhost:8080/otro_nombre/ .

Where do you change the name of the app or root URL where the project runs? Because I have 500 .xml that I tried changing and no change is reflected.

    
asked by Genarito 31.08.2017 в 18:22
source

2 answers

2

You can specify the context path of the Web application for Tomcat through the file context.xml .

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/otro_nombre"/>

However, eclipse ignores this file and considers the value configured in the project properties. See "Properties for project_name" > "Web Project Settings" > "Context root".

Before Tomcat deploys, eclipse edits the file server.xml located in, for example, /Servers/Tomcat v7.0 Server at localhost-config/ and add a line similar to:

<Context docBase="nombre_del_proyecto" 
         path="/otro_nombre" 
         reloadable="true" 
         source="org.eclipse.jst.jee.server:nombre_del_proyecto"/>

Once all the files are ready, they are copied to the corresponding folder in the workspace, e.g. workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps .

    
answered by 31.08.2017 / 19:09
source
1

You must modify in Tomcat the context configuration in the file server.xml if you have not modified it, it should be in [tomcat dir]/config/ , in the you must modify the path attribute by the route you want to place it

<Context docBase="nombre_del_proyecto" path="/otro_nombre" reloadable="true" source="org.eclipse.jst.jee.server:nombre_del_proyecto"/>
    
answered by 31.08.2017 в 19:09