tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fulltruth <dlove...@gmail.com>
Subject ExceptionMapper support in TomEE 1.6.0
Date Sat, 05 Apr 2014 00:17:37 GMT
Does TomEE 1.6.0 support the use of ExceptionMapper providers?  If so, how to
get it to discover the provider?  

It does not seem to be detecting or using my example class below.  Throwing
an exception inside of a resource request method simply results in the
default exception page being shown.

Here is my ExceptionMapper class:

package com.que.util;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import com.que.exception.MissingParameterException;

@Provider
public class DefaultExceptionHandler implements
ExceptionMapper<MissingParameterException> {
	
	@Override
	public Response toResponse(MissingParameterException e) {
		String response = "Mapped by ExceptionMapper: " + e.getMessage();
		return
Response.serverError().entity(response).type(MediaType.APPLICATION_JSON).build();
	}
}


And here is the method throwing the exception:

	@POST
	@Path("{id: [0-9]+}")
    public Response update(@PathParam("id") Integer userID, User userBean) 
    		throws ClassNotFoundException, MissingParameterException, SQLException
    {
    		if (userID == null) {
    			throw new MissingParameterException("id");
    		}



--
View this message in context: http://openejb.979440.n4.nabble.com/ExceptionMapper-support-in-TomEE-1-6-0-tp4668599.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message