URL "base" de Spring Roo
Frecuentes
Visto 727 veces
1
I'm current building a fairly simple webapp using Spring Roo. It seems, however, that Spring apps by default deploy to "/{app name}", rather than "/" as the top level directory. That is, controllers are mapped by "/{app name}/person", rather than just "/person". After poking around considerably, I couldn't see where this would be fixed. Is it a setting somewhere?
2 Respuestas
2
The base path is defined by the application server, not the application itself. In the pom.xml, overwrite the following plugins:
maven-war-plugin - mvn package, mvn tomcat:run-war
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warName>ROOT</warName>
<!-- exclude test files from war package -->
<packagingExcludes>src/test/**</packagingExcludes>
</configuration>
</plugin>
tomcat-maven-plugin - mvn tomcat:run
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
org.mortbay.jetty - mvn jetty:run
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.0.4.v20111024</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
</configuration>
</plugin>
Respondido el 02 de Septiembre de 12 a las 09:09
0
Assuming your Spring Roo application runs on Apache Tomcat, what you can do is to configure the Tomcat Root context.
You can do this in following ways.
- Defina un archivo de contexto ROOT.xml en conf / Catalina / localhost
- Nombra tu aplicación web WAR "ROOT.war" o la carpeta que contiene "ROOT"
More information can be found on the following link.
http://benhutchison.wordpress.com/2008/07/30/how-to-configure-tomcat-root-context/
¡Aclamaciones!
Respondido 26 ago 12, 18:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas tomcat spring-mvc spring-roo or haz tu propia pregunta.
Hi Aaron, as you are new to StackOverflow, I have a little hint for you: It is much more likely to get an answer fast, if you phrase your question as a question and if you include all names in it. So it would be better not to use "it" in the question, if possible. For example: `How can I change the Spring Roo "Base" URL?". Just a minor hint. - Martin Thoma