Skip to content
Snippets Groups Projects
Commit fe63e9c8 authored by Costin Leau's avatar Costin Leau Committed by Mic
Browse files

+ add default servlet definition (for containers that do not declare it - such as GlassFish)

+ increase Spring version to RC3 (it works with trunk just fine)
parent d8b76157
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<packaging>war</packaging> <packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<properties> <properties>
<spring.version>3.0.0.RC2</spring.version> <spring.version>3.0.0.RC3</spring.version>
<slf4j.version>1.5.6</slf4j.version> <slf4j.version>1.5.6</slf4j.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -73,12 +73,24 @@ ...@@ -73,12 +73,24 @@
<dependency> <dependency>
<groupId>org.aspectj</groupId> <groupId>org.aspectj</groupId>
<artifactId>com.springsource.org.aspectj.weaver</artifactId> <artifactId>com.springsource.org.aspectj.weaver</artifactId>
<version>1.6.3.RELEASE</version> <version>1.6.5.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>com.springsource.org.hibernate</artifactId> <artifactId>hibernate</artifactId>
<version>3.3.1.GA</version> <version>3.2.7.ga</version>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
<!--
<exclusion>
<groupId>org.apache.log4j</groupId>
<artifactId>com.springsource.org.apache.log4j</artifactId>
</exclusion>
-->
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
...@@ -222,8 +234,10 @@ ...@@ -222,8 +234,10 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<verbose>true</verbose>
<source>1.5</source> <source>1.5</source>
<target>1.5</target> <target>1.5</target>
<showWarnings>true</showWarnings>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
......
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring PetClinic</display-name> <display-name>Spring PetClinic</display-name>
<description>Spring PetClinic sample application</description> <description>Spring PetClinic sample application</description>
<!-- <!--
Key of the system property that should specify the root directory of this Key of the system property that should specify the root directory of this
web app. Applied by WebAppRootListener or Log4jConfigListener. web app. Applied by WebAppRootListener or Log4jConfigListener.
--> -->
<context-param> <context-param>
<param-name>webAppRootKey</param-name> <param-name>webAppRootKey</param-name>
<param-value>petclinic.root</param-value> <param-value>petclinic.root</param-value>
</context-param> </context-param>
<!-- <!--
Location of the Log4J config file, for initialization and refresh checks. Location of the Log4J config file, for initialization and refresh checks.
Applied by Log4jConfigListener. Applied by Log4jConfigListener.
--> -->
<context-param> <context-param>
<param-name>log4jConfigLocation</param-name> <param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value> <param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param> </context-param>
<!-- <!--
- Location of the XML file that defines the root application context. - Location of the XML file that defines the root application context.
- Applied by ContextLoaderServlet. - Applied by ContextLoaderServlet.
- -
- Can be set to: - Can be set to:
- "/WEB-INF/applicationContext-hibernate.xml" for the Hibernate implementation, - "/WEB-INF/applicationContext-hibernate.xml" for the Hibernate implementation,
- "/WEB-INF/applicationContext-jpa.xml" for the JPA one, or - "/WEB-INF/applicationContext-jpa.xml" for the JPA one, or
- "/WEB-INF/applicationContext-jdbc.xml" for the JDBC one. - "/WEB-INF/applicationContext-jdbc.xml" for the JDBC one.
--> -->
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-jdbc.xml</param-value>
<param-value>/WEB-INF/applicationContext-jdbc.xml</param-value> <!--
<!-- <param-value>/WEB-INF/applicationContext-hibernate.xml</param-value>
<param-value>/WEB-INF/applicationContext-hibernate.xml</param-value> <param-value>/WEB-INF/applicationContext-jpa.xml</param-value>
<param-value>/WEB-INF/applicationContext-jpa.xml</param-value> -->
-->
<!--
<!-- To use the JPA variant above, you will need to enable Spring load-time
To use the JPA variant above, you will need to enable Spring load-time weaving in your server environment. See PetClinic's readme and/or
weaving in your server environment. See PetClinic's readme and/or Spring's JPA documentation for information on how to do this.
Spring's JPA documentation for information on how to do this. -->
--> </context-param>
</context-param>
<!--
<!-- - Configures Log4J for this web app.
- Configures Log4J for this web app. - As this context specifies a context-param "log4jConfigLocation", its file path
- As this context specifies a context-param "log4jConfigLocation", its file path - is used to load the Log4J configuration, including periodic refresh checks.
- is used to load the Log4J configuration, including periodic refresh checks. -
- - Would fall back to default Log4J initialization (non-refreshing) if no special
- Would fall back to default Log4J initialization (non-refreshing) if no special - context-params are given.
- context-params are given. -
- - Exports a "web app root key", i.e. a system property that specifies the root
- Exports a "web app root key", i.e. a system property that specifies the root - directory of this web app, for usage in log file paths.
- directory of this web app, for usage in log file paths. - This web app specifies "petclinic.root" (see log4j.properties file).
- This web app specifies "petclinic.root" (see log4j.properties file). -->
--> <!-- Leave the listener commented-out if using JBoss -->
<!-- Leave the listener commented-out if using JBoss --> <!--
<!-- <listener>
<listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>
</listener> -->
-->
<!--
<!-- - Loads the root application context of this web app at startup,
- Loads the root application context of this web app at startup, - by default from "/WEB-INF/applicationContext.xml".
- by default from "/WEB-INF/applicationContext.xml". - Note that you need to fall back to Spring's ContextLoaderServlet for
- Note that you need to fall back to Spring's ContextLoaderServlet for - J2EE servers that do not follow the Servlet 2.4 initialization order.
- J2EE servers that do not follow the Servlet 2.4 initialization order. -
- - Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
- Use WebApplicationContextUtils.getWebApplicationContext(servletContext) - to access it anywhere in the web application, outside of the framework.
- to access it anywhere in the web application, outside of the framework. -
- - The root context is the parent of all servlet-specific contexts.
- The root context is the parent of all servlet-specific contexts. - This means that its beans are automatically available in these child contexts,
- This means that its beans are automatically available in these child contexts, - both for getBean(name) calls and (external) bean references.
- both for getBean(name) calls and (external) bean references. -->
--> <listener>
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
</listener>
<!--
<!-- Defines the 'default' servlet (usually for service static resources).
- Map static resources to the default servlet Uncomment this in containers (GlassFish) that do not declare this
- examples: implicit definition out of the box, or change the name of the servlet mapping
- http://localhost:8080/static/images/pets.png below to the appropriate one.
- http://localhost:8080/static/styles/petclinic.css
--> <servlet>
<servlet-mapping> <servlet-name>default</servlet-name>
<servlet-name>default</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<url-pattern>/static/*</url-pattern> <init-param>
</servlet-mapping> <param-name>debug</param-name>
<param-value>0</param-value>
<!-- </init-param>
- Servlet that dispatches request to registered handlers (Controller implementations). <init-param>
- Has its own application context, by default defined in "{servlet-name}-servlet.xml", <param-name>listings</param-name>
- i.e. "petclinic-servlet.xml". <param-value>false</param-value>
- </init-param>
- A web app can contain any number of such servlets. <load-on-startup>1</load-on-startup>
- Note that this web app has a shared root application context, serving as parent </servlet>
- of all DispatcherServlet contexts. -->
--> <!--
<servlet> - Map static resources to the default servlet
<servlet-name>petclinic</servlet-name> - examples:
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> - http://localhost:8080/static/images/pets.png
<load-on-startup>2</load-on-startup> - http://localhost:8080/static/styles/petclinic.css
</servlet> -->
<servlet-mapping>
<!-- <servlet-name>default</servlet-name>
- Maps the petclinic dispatcher to "*.do". All handler mappings in <url-pattern>/static/*</url-pattern>
- petclinic-servlet.xml will by default be applied to this subpath. </servlet-mapping>
- If a mapping isn't a /* subpath, the handler mappings are considered
- relative to the web app root. <!--
- - Servlet that dispatches request to registered handlers (Controller implementations).
- NOTE: A single dispatcher can be mapped to multiple paths, like any servlet. - Has its own application context, by default defined in "{servlet-name}-servlet.xml",
--> - i.e. "petclinic-servlet.xml".
<servlet-mapping> -
<servlet-name>petclinic</servlet-name> - A web app can contain any number of such servlets.
<url-pattern>/</url-pattern> - Note that this web app has a shared root application context, serving as parent
</servlet-mapping> - of all DispatcherServlet contexts.
-->
<filter> <servlet>
<filter-name>httpMethodFilter</filter-name> <servlet-name>petclinic</servlet-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</filter> <load-on-startup>2</load-on-startup>
</servlet>
<filter-mapping>
<filter-name>httpMethodFilter</filter-name> <!--
<servlet-name>petclinic</servlet-name> - Maps the petclinic dispatcher to "*.do". All handler mappings in
</filter-mapping> - petclinic-servlet.xml will by default be applied to this subpath.
- If a mapping isn't a /* subpath, the handler mappings are considered
<session-config> - relative to the web app root.
<session-timeout>10</session-timeout> -
</session-config> - NOTE: A single dispatcher can be mapped to multiple paths, like any servlet.
-->
<error-page> <servlet-mapping>
<exception-type>java.lang.Exception</exception-type> <servlet-name>petclinic</servlet-name>
<!-- Displays a stack trace --> <url-pattern>/</url-pattern>
<location>/WEB-INF/jsp/uncaughtException.jsp</location> </servlet-mapping>
</error-page>
<filter>
<!-- <filter-name>httpMethodFilter</filter-name>
- Reference to PetClinic database. <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
- Only needed if not using a local DataSource but a JNDI one instead. </filter>
-->
<!-- <filter-mapping>
<resource-ref> <filter-name>httpMethodFilter</filter-name>
<res-ref-name>jdbc/petclinic</res-ref-name> <servlet-name>petclinic</servlet-name>
<res-type>javax.sql.DataSource</res-type> </filter-mapping>
<res-auth>Container</res-auth>
</resource-ref> <session-config>
--> <session-timeout>10</session-timeout>
</session-config>
</web-app>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<!-- Displays a stack trace -->
<location>/WEB-INF/jsp/uncaughtException.jsp</location>
</error-page>
<!--
- Reference to PetClinic database.
- Only needed if not using a local DataSource but a JNDI one instead.
-->
<!--
<resource-ref>
<res-ref-name>jdbc/petclinic</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
-->
</web-app>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment