![JAR search and dependency download from the Maven repository](/logo.png)
com.github.phillipkruger.microprofileextentions.config.NoSuchElementMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of config-ext Show documentation
Show all versions of config-ext Show documentation
Some default config providers and converters
package com.github.phillipkruger.microprofileextentions.config;
import java.util.NoSuchElementException;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
/**
* Map a NoSuchElement to a Not Found
* @author Phillip Kruger ([email protected])
*/
@Provider
public class NoSuchElementMapper implements ExceptionMapper{
private static final String REASON = "Reason";
@Override
@Produces(MediaType.APPLICATION_JSON)
public Response toResponse(NoSuchElementException noSuchElementException) {
return Response.status(Response.Status.NOT_FOUND).header(REASON,noSuchElementException.getMessage()).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy