org.broadleafcommerce.core.web.api
Class BroadleafRestExceptionMapper

java.lang.Object
  extended by org.broadleafcommerce.core.web.api.BroadleafRestExceptionMapper
All Implemented Interfaces:
javax.ws.rs.ext.ExceptionMapper<Throwable>, org.springframework.beans.factory.Aware, org.springframework.context.MessageSourceAware

@Scope(value="singleton")
@Provider
public class BroadleafRestExceptionMapper
extends Object
implements javax.ws.rs.ext.ExceptionMapper<Throwable>, org.springframework.context.MessageSourceAware

This is a generic JAX-RS ExceptionMapper. This can be registered as a Spring Bean to catch exceptions, log them, and return reasonable responses to the client. Alternatively, you can extend this or implement your own, more granular, mapper(s). This class does not return internationalized messages. But for convenience, this class provides a protected Spring MessageSource to allow for internationalization if one chose to go that route.

Author:
Kelly Tisdell

Field Summary
protected  org.springframework.context.MessageSource messageSource
           
 
Constructor Summary
BroadleafRestExceptionMapper()
           
 
Method Summary
 void setMessageSource(org.springframework.context.MessageSource messageSource)
           
 javax.ws.rs.core.Response toResponse(Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageSource

protected org.springframework.context.MessageSource messageSource
Constructor Detail

BroadleafRestExceptionMapper

public BroadleafRestExceptionMapper()
Method Detail

toResponse

public javax.ws.rs.core.Response toResponse(Throwable t)
Specified by:
toResponse in interface javax.ws.rs.ext.ExceptionMapper<Throwable>

setMessageSource

public void setMessageSource(org.springframework.context.MessageSource messageSource)
Specified by:
setMessageSource in interface org.springframework.context.MessageSourceAware


Copyright © 2013. All Rights Reserved.