Is it possible to debug WebApps in Tomcat and Eclipse with an empty project name?

I am developing several java-ee web applications in Eclipse kepler and tomcat7 and everything is going well now. I am getting a specific application with http://localhost:8080/appname

.

But can I do some customization to make this project an empty name so that I can visit it with http://localhost:8080/

Tomcat 6: How to change the ROOT application might not work for server integration in Eclipse.

PS: Running on Windows XP with eclipse-jee-kepler-R-win32 and tomcat7

+3


source to share


3 answers


Creating (or renaming) a project called ROOT allowed me to do this in Eclipse.

When you initially run on the server, it will load the app using a long url:

http://localhost:8080/ROOT

      

But if you go to:

http://localhost:8080/

      

You will see that it goes to the same page.

One caveat is that on the Tomcat preferences page in Eclipse, you need to make sure Use Workspace Metadata is selected for Server Location. I installed "Use Tomcat Installation" first, and calling the default http://localhost:8080/

url will just load the default Tomcat page (presumably because the ROOT app already exists / takes precedence).



Update

I found that you can achieve the same result without changing the project name. Just edit your Eclipse project file .settings/org.eclipse.wst.common.component

and change the context-root property to "ROOT" as follows:

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="YourProjectName">
        <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <property name="java-output-path" value="/YourProjectName/build/classes"/>
        <property name="context-root" value="ROOT"/>
    </wb-module>
</project-modules>

      

If "YourProjectName" is the name of your project, obviously. :)

Second update

As per this answer on the related question, you can actually change the content root from the GUI in Eclipse, but by going to "Web Project Settings" in your project settings.

0


source


From experience I would say that this is not possible.

Since we cannot hide the url.



Instead, you can do,

  • Redirect url to application server via webserver (Apache WebServer), so when you click http://localhost:8080/

    it will automatically redirect to the displayed url, say http://localhost:8080/appname

    Cf: How to rewrite url in Tomcat 6 and is there a url rewriting mechanism for Tomcat / Java?

  • You can develop your app as a single page app and replace your content by updating div and span using AJAX . If you give http://localhost:8080/appname

    without changing or redirecting the URL, we can do our job.

+2


source


Well, there are some pretty simple ways to do it:

  • double-click the server name (for example, Tomcat 7) in the Servers view;
  • go to the tab Modules

    ;
  • select appname

    and click "Change" then leave the path blank
0


source







All Articles