Compare commits
10 Commits
spring-res
...
spring-res
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac0a9d9a19 | ||
|
|
05af97338a | ||
|
|
b727a63bec | ||
|
|
1743af38b8 | ||
|
|
2e7a8a2fc5 | ||
|
|
4a9ae1803c | ||
|
|
39a26e4812 | ||
|
|
60ff377162 | ||
|
|
dbd18858eb | ||
|
|
84a2615aef |
@@ -1,314 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.1</version>
|
||||
<name>spring-restful-exception-handler</name>
|
||||
<description>Custom exception handler annotation for Spring to unify the error handling.</description>
|
||||
<url>https://github.com/raychatter/spring-restful-exception-handler</url>
|
||||
<parent>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler-parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
<organization>
|
||||
<name>ThoughtWorks</name>
|
||||
<url>http://www.thoughtworks.com/</url>
|
||||
</organization>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
|
||||
<siteProjectVersion>${project.version}</siteProjectVersion>
|
||||
<manifest.builtBy>Rachel Walker</manifest.builtBy>
|
||||
<manifest.addDefaultImplementationEntries>true</manifest.addDefaultImplementationEntries>
|
||||
<manifest.addClasspath>true</manifest.addClasspath>
|
||||
<manifest.packageName>${project.groupId}</manifest.packageName>
|
||||
<manifest.mainClass>${project.groupId}.Main</manifest.mainClass>
|
||||
<manifest.compress>true</manifest.compress>
|
||||
<compileSource>1.6</compileSource>
|
||||
</properties>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>3.1.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<useDefaultManifestFile>false</useDefaultManifestFile>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-javadocs-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<quiet>true</quiet>
|
||||
<javadocVersion>${compileSource}</javadocVersion>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<threadCount>50</threadCount>
|
||||
<parallel>classes</parallel>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<configuration>
|
||||
<effort>Max</effort>
|
||||
<threshold>Exp</threshold>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<configuration>
|
||||
<targetJdk>${compileSource}</targetJdk>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<configuration>
|
||||
<suppressionsLocation>
|
||||
${project.basedir}/checkstyleSupressions.xml
|
||||
</suppressionsLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<quiet>true</quiet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
</plugin>
|
||||
</reportPlugins>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>deploy</phase>
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete>
|
||||
<fileset dir="${project.basedir}/artifacts" includes="*.${project.packaging}" />
|
||||
</delete>
|
||||
<copy todir="${project.basedir}/artifacts">
|
||||
<fileset dir="${project.build.directory}">
|
||||
<include name="${project.build.finalName}*.${project.packaging}" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sign</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<configuration>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<serverAuthId>oss-sonatype-org</serverAuthId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</developerConnection>
|
||||
<url>git@github.com:raychatter/spring-restful-exception-handler.git</url>
|
||||
<tag>spring-restful-exception-handler-0.1</tag>
|
||||
</scm>
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/raychatter/spring-restful-exception-handler/issues/</url>
|
||||
</issueManagement>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>raychatter</id>
|
||||
<name>Rachel Walker</name>
|
||||
<email>rachel.e.walker@gmail.com</email>
|
||||
<roles>
|
||||
<role>author</role>
|
||||
</roles>
|
||||
<organization>ThoughtWorks</organization>
|
||||
<organizationUrl>http://www.ThoughtWorks.com</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
</project>
|
||||
271
pom.xml
271
pom.xml
@@ -1,24 +1,213 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.1</version>
|
||||
<name>Spring Restful Exception Handler</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
</parent>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</developerConnection>
|
||||
<url>git@github.com:raychatter/spring-restful-exception-handler.git</url>
|
||||
</scm>
|
||||
|
||||
<name>spring-restful-exception-handler</name>
|
||||
<description>Custom exception handler annotation for Spring to unify the error handling.</description>
|
||||
<url>https://github.com/raychatter/spring-restful-exception-handler</url>
|
||||
<organization>
|
||||
<name>ThoughtWorks</name>
|
||||
<url>http://www.thoughtworks.com/</url>
|
||||
</organization>
|
||||
<inceptionYear>2012</inceptionYear>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
|
||||
<siteProjectVersion>${project.version}</siteProjectVersion>
|
||||
<manifest.builtBy>Rachel Walker</manifest.builtBy>
|
||||
<manifest.addDefaultImplementationEntries>true</manifest.addDefaultImplementationEntries>
|
||||
<manifest.addClasspath>true</manifest.addClasspath>
|
||||
<manifest.packageName>${project.groupId}</manifest.packageName>
|
||||
<manifest.mainClass>${project.groupId}.Main</manifest.mainClass>
|
||||
<manifest.compress>true</manifest.compress>
|
||||
<compileSource>1.6</compileSource>
|
||||
</properties>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>3.1.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>${compileSource}</source>
|
||||
<target>${compileSource}</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classifier>no-dependencies</classifier>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<useDefaultManifestFile>false</useDefaultManifestFile>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-javadocs-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<quiet>true</quiet>
|
||||
<javadocVersion>${compileSource}</javadocVersion>
|
||||
<archive>
|
||||
<compress>${manifest.compress}</compress>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>
|
||||
${manifest.addDefaultImplementationEntries}
|
||||
</addDefaultImplementationEntries>
|
||||
<addClasspath>${manifest.addClasspath}</addClasspath>
|
||||
<mainClass>${manifest.mainClass}</mainClass>
|
||||
<packageName>${manifest.packageName}</packageName>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Built-By>${manifest.builtBy}</Built-By>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<id>sign</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
@@ -30,7 +219,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@@ -41,27 +230,43 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<configuration>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<serverAuthId>oss-sonatype-org</serverAuthId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<modules>
|
||||
<module>exception-handler</module>
|
||||
<module>sample</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArgument>-Xlint:all</compilerArgument>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:raychatter/spring-restful-exception-handler.git</developerConnection>
|
||||
<url>git@github.com:raychatter/spring-restful-exception-handler.git</url>
|
||||
<tag>spring-restful-exception-handler-1.0.3</tag>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/raychatter/spring-restful-exception-handler/issues/</url>
|
||||
</issueManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>raychatter</id>
|
||||
<name>Rachel Walker</name>
|
||||
<email>rachel.e.walker@gmail.com</email>
|
||||
<roles>
|
||||
<role>author</role>
|
||||
</roles>
|
||||
<organization>ThoughtWorks</organization>
|
||||
<organizationUrl>http://www.ThoughtWorks.com</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>sample</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.1</version>
|
||||
<name>A demo app that shows custom exception handling</name>
|
||||
<url>https://github.com/raychatter/spring-restful-exception-handler</url>
|
||||
<parent>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler-parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<spring.version>3.1.1.RELEASE</spring.version>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<!-- Spring 3 dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.raychatter</groupId>
|
||||
<artifactId>spring-restful-exception-handler</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>sample</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.github.raychatter.common.controller;
|
||||
|
||||
import com.github.raychatter.common.exception.MyNegativeArraySizeException;
|
||||
import com.github.raychatter.common.exception.CustomException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
|
||||
@Controller
|
||||
public class HelloController {
|
||||
|
||||
@RequestMapping(value = "/welcome", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object welcome() {
|
||||
return "Hello World";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/custom404", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object custom404() throws Exception {
|
||||
throw new CustomException("It's broken!");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/custom500", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object custom500() throws Exception {
|
||||
throw new MyNegativeArraySizeException("oops");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/unchecked", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object unchecked() throws Exception {
|
||||
throw new NullPointerException("an npe");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.github.raychatter.common.exception;
|
||||
|
||||
import com.github.raychatter.ExceptionHandler;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@ExceptionHandler(httpStatus = HttpStatus.NOT_FOUND, contentType = "text/html")
|
||||
public class CustomException extends Exception {
|
||||
|
||||
public CustomException(final String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.github.raychatter.common.exception;
|
||||
|
||||
import com.github.raychatter.ExceptionHandler;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@ExceptionHandler(httpStatus = HttpStatus.INTERNAL_SERVER_ERROR, contentType = "application/json")
|
||||
public class MyNegativeArraySizeException extends NegativeArraySizeException {
|
||||
public MyNegativeArraySizeException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "errors": "%s" }
|
||||
@@ -1,25 +0,0 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<context:annotation-config />
|
||||
<context:component-scan base-package="com.github.raychatter.common.controller" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix">
|
||||
<value>/WEB-INF/pages/</value>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<value>.jsp</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="exceptionResolver" class="com.github.raychatter.AnnotationHandler" />
|
||||
|
||||
</beans>
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Message : ${message}</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<web-app id="WebApp_ID" 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">
|
||||
|
||||
<display-name>Spring Web MVC Application</display-name>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>mvc-dispatcher</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>mvc-dispatcher</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
</web-app>
|
||||
@@ -19,6 +19,7 @@ public class AnnotationHandler implements HandlerExceptionResolver {
|
||||
protected static final String DEFAULT_TEMPLATE = "defaults/default.template";
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
|
||||
//TODO: When there's a wrapper exception leave it unannotated… call the e.getCause() method… until there is an annotated exception or if there are no more causes (e.geCause()==null)??.
|
||||
@Override
|
||||
public ModelAndView resolveException(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final Exception thrownException) {
|
||||
final ExceptionHandler annotation = getAnnotationFrom(thrownException);
|
||||
Reference in New Issue
Block a user