![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.jbizmo.commons.rest.mappers.StandardExceptionMapper Maven / Gradle / Ivy
The newest version!
/*
* This file is part of JBizMo, a set of tools, libraries and plug-ins
* for modeling and creating Java-based enterprise applications.
* For more information visit:
*
* http://sourceforge.net/projects/jbizmo/
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.sourceforge.jbizmo.commons.rest.mappers;
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.core.Response.StatusType;
import jakarta.ws.rs.ext.Provider;
import java.lang.invoke.MethodHandles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Mapper for all kinds of exceptions that are not part of JAX-RS. Note that an application can add any number of mappers for
* specific exceptions in order return a more appropriate status code rather than HTTP {@code 500}!
*
*
* Copyright 2024 (C) by Martin Ganserer
*
* @author Martin Ganserer
* @version 1.0.0
*/
@Provider
public class StandardExceptionMapper extends AbstractExceptionMapper {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
/*
* (non-Javadoc)
* @see net.sourceforge.jbizmo.commons.rest.mappers.AbstractExceptionMapper#getStatus(java.lang.Throwable)
*/
@Override
protected StatusType getStatus(Exception t) {
return Status.INTERNAL_SERVER_ERROR;
}
/*
* (non-Javadoc)
* @see net.sourceforge.jbizmo.commons.rest.mappers.AbstractExceptionMapper#getLogger()
*/
@Override
protected Logger getLogger() {
return logger;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy