43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
|
/**
|
||
|
*
|
||
|
*/
|
||
|
package org.gcube.datatransfer.resolver.services.exceptions;
|
||
|
|
||
|
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import javax.ws.rs.WebApplicationException;
|
||
|
import javax.ws.rs.core.MediaType;
|
||
|
import javax.ws.rs.core.Response;
|
||
|
import javax.ws.rs.core.Response.Status;
|
||
|
|
||
|
import org.gcube.datatransfer.resolver.services.Util;
|
||
|
;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* The Class WrongParameterException.
|
||
|
*
|
||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||
|
* Oct 22, 2018
|
||
|
*/
|
||
|
public class WrongParameterException extends WebApplicationException {
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
private static final long serialVersionUID = -7600028435121268528L;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Instantiates a new wrong parameter exception.
|
||
|
*
|
||
|
* @param request the request
|
||
|
* @param httpReturnStatus the http return status
|
||
|
* @param message the message
|
||
|
* @param reportedBySource the reported by source
|
||
|
*/
|
||
|
public WrongParameterException(HttpServletRequest request, Status httpReturnStatus, String message, Class reportedBySource) {
|
||
|
super(Response.status(httpReturnStatus).entity(new ExceptionReport(Util.getFullURL(request), request.getMethod(), false, new ErrorReport(Status.BAD_REQUEST.getStatusCode(), Status.BAD_REQUEST.name(), message, reportedBySource.getName()))).type(MediaType.APPLICATION_XML).build());
|
||
|
|
||
|
}
|
||
|
}
|