Questions tagged [exceptionmapper]

JAX-RS contract for a provider that maps Java exceptions to Response.

From Javadoc

public interface ExceptionMapper<E extends Throwable>

Contract for a provider that maps Java exceptions to Response.

Providers implementing ExceptionMapper contract must be either programmatically registered in a JAX-RS runtime or must be annotated with @Provider annotation to be automatically discovered by the JAX-RS runtime during a provider scanning phase.

46 questions
0
votes
0 answers

JerseyServlet - ExceptionMapper is not always working when deploy

I'm trying to make a global ExceptionMapper for my app, this ExceptionMapper will show the excepction in console, then will show it again in a beautify way and then save some info of it in the database to make it easier in the future to identify…
Ise92
  • 127
  • 1
  • 1
  • 12
0
votes
0 answers

Can I call Dropwizard/Jersey exception mapping directly?

Is it possible to call the jersey exception mapper directly? We've got a Dropwizard REST app, and we need to add a non-REST interface. We've got a large number of exception mappers that are called implicitly when a service throws an exception. We'd…
Ron Romero
  • 9,211
  • 8
  • 43
  • 64
0
votes
0 answers

Jersey not trapping injection exception

In my Jersey / JAX-RS resource I'm injecting a header param: @Path("/foo") class MyService { @HeaderParam("Authorization") public void setAuth(String auth) { if (!"mysecret".equals(auth)) { throw new…
ccleve
  • 15,239
  • 27
  • 91
  • 157
0
votes
0 answers

Return custom exception thrown in response fiters on Glassfish 5 and Jersey 2.27

I have a glassfish 5 with jersey 2.27 server application that has a custom response filter that in some cases throws a custom business exception. The response filter looks like : public class CustomResponseFilter implements ContainerResponseFilter…
Ionut Ursan
  • 187
  • 1
  • 2
  • 11
0
votes
0 answers

Jersey Web Service ExceptionMapper Oracle EPM HFMException

I have created a Web Service ( running on Tomcat Server ) using one of the standard Oracle EPM Java API's for extracting HFM metadata. When there is an error within the API's it throws a HFM Exception which is a subclass of java Exception class. I…
GrahamD
  • 1
  • 1
0
votes
0 answers

On error, can’t retrieve ResponseBuilder entity in XMLHttpRequest response

In my JAXRS app, I issue a LicenseKeyException when the license is invalid. That exception is trapped by an ExceptionMapper which responds to the caller by a 403 status code, with an entity holding some extra info which I want to send along the…
0
votes
1 answer

Use ExceptionMapper to log CLIENT_ERRORs

I am working on an application which uses Dropwizard, which has this implementation of ExceptionMapper:…
hal9000
  • 201
  • 5
  • 25
0
votes
1 answer

Custom WebApplicationExceptions in jaxrs caught by ExceptionMapper show up in server log

I use the following Exceptionmapper to map WebApplicationExceptions in my jaxrs rest api to responses. @Provider public class ErrorHandler implements ExceptionMapper { @Override public Response…
Goos van den Bekerom
  • 1,475
  • 3
  • 20
  • 32
0
votes
1 answer

Exception Mapping in Restful Spring boot application

I have a custom Exception class which I want to return as a json when an exception occurs. SpringCacheException.java @JsonSerialize public class SpringCacheException extends Exception{ private static final long serialVersionUID = 1L; private…
Sunny
  • 858
  • 3
  • 17
  • 39
0
votes
1 answer

Junit: testing thrown exception while using exception mapper

How can I use Junit4 to test the thrown exception while using the exception mapper ?
binodsh
  • 3
  • 3
0
votes
0 answers

Exception mapper doesn't work on wildfly RestEasy

I have web resource @Path("/test") public class Test { private TestService service; @GET @Path("/test") @Produces(MediaType.APPLICATION_JSON) public Response hello() { service = new TestService(); // String o = service.helloWorld(); …
0
votes
1 answer

Jersey test - ExceptionMapper - UniformInterfaceException when HTTP status is not 200

I have to test Jersey 1.19 with jersey-test-framework-grizzly2. There is configuration class with registered REST endpoint and exception mapper class: public class ConfiguredMyServiceTest extends JerseyTest { @Override protected int…
Justinas Jakavonis
  • 8,220
  • 10
  • 69
  • 114
0
votes
1 answer

Can you import Jersey custom ExceptionMappers from a .jar war file into a .war file?

I keep getting this error when running my JUnit tests. It only occurs when I try to import Jersey custom ExceptionMappers from a .jar file to my .war file. I know that the mappers work correctly when they are in the .war file but I have two separate…
alats
  • 1
  • 1
0
votes
1 answer

Jersey SQLException Mapper not Called

This is my SqlExceptionMapper @Provider public class SqlExceptionMapper implements ExceptionMapper { @Override public Response toResponse(SQLException e){ return…
Shivkumar Mallesappa
  • 2,875
  • 7
  • 41
  • 68
0
votes
1 answer

How to priorize CDI Interceptor over JAX-RS ExceptionMapper

I have a REST webservice that manage its transactions using the following approach: @Inherited @InterceptorBinding @Retention(RetentionPolicy.RUNTIME) @Target({METHOD, TYPE, FIELD, PARAMETER}) public @interface TransactionRequired…
Marcos J.C Kichel
  • 6,887
  • 8
  • 38
  • 78