Backstopper is a framework-agnostic API error handling and (optional) model validation solution for Java 7 and greater.
This readme focuses specifically on the Backstopper Jersey 1 integration. If you are looking for a different framework integration check out the relevant section of the base readme to see if one already exists. The base project README.md and User Guide contain the main bulk of information regarding Backstopper.
NOTE: There is a Jersey 1 sample application that provides a simple concrete example of the information covered in this readme.
- Pull in the
com.nike.backstopper:backstopper-jersey1
dependency into your project. - Register Backstopper components with Jersey 1. Jersey has many ways to configure itself, so this is often a project-specific process.
Jersey1BackstopperConfigHelper
contains some helpers that will be useful. See the Jersey 1 sample application'sJersey1SampleConfigHelper
andMain
classes for a concrete example which should help guide you even if you don't end up registering things the same way in your project.- This causes
Jersey1ApiExceptionHandler
to be registered with the Jersey 1 error mapping system so that the Backstopper handlers will take care of allThrowable
s. - Your project's
ProjectApiErrors
will need to be provided when theJersey1ApiExceptionHandler
is created.ProjectApiErrors
creation is discussed in the base Backstopper readme here.
- This causes
- Setup the reusable unit tests for your project as described in the base Backstopper readme here and shown in the sample application.
The base Backstopper readme covers the usage basics. There should be no difference when running in a Jersey 1 environment, other than Jersey1ApiExceptionHandler
knowing how to handle Jersey 1 framework exceptions properly (this should happen automatically without any effort from you).
This backstopper-jersey1
module does not export any transitive Jersey 1 or Servlet API dependencies to prevent runtime
version conflicts with whatever Jersey 1 and Servlet environment you deploy to.
This should not affect most users since this library is likely to be used in a Jersey 1/Servlet environment where the required dependencies are already on the classpath at runtime, however if you receive class-not-found errors related to Jersey 1 or Servlet API classes then you'll need to pull the necessary dependency into your project.
The dependencies you may need to pull in:
- Jersey 1: com.sun.jersey:jersey-server:[jersey1-version]
- Servlet API (choose one of the following, depending on your environment needs):
- Servlet 3+ API: javax.servlet:javax.servlet-api:[servlet-api-version]
- Servlet 2 API: javax.servlet:servlet-api:[servlet-2-api-version]
See the base project README.md, User Guide, and Backstopper repository source code and javadocs for all further information.
Backstopper is released under the Apache License, Version 2.0