Loading src/main/java/it/inaf/oats/vospace/exception/ErrorController.java 0 → 100644 +33 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("${server.error.path:${error.path:/error}}") public class ErrorController extends AbstractErrorController { @Autowired public ErrorController(ErrorAttributes errorAttributes) { super(errorAttributes); } @RequestMapping(produces = MediaType.TEXT_XML_VALUE) public void errorText(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> errors = super.getErrorAttributes(request, true); response.setContentType("text/plain;charset=UTF-8"); response.getOutputStream().print((String) errors.get("message")); } @Override public String getErrorPath() { return null; } } src/main/java/it/inaf/oats/vospace/exception/NodeNotFoundException.java 0 → 100644 +12 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class NodeNotFoundException extends VoSpaceException { public NodeNotFoundException(String path) { super("NodeNotFound: " + path); } } src/main/java/it/inaf/oats/vospace/exception/VoSpaceException.java 0 → 100644 +8 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; public class VoSpaceException extends RuntimeException { public VoSpaceException(String message) { super(message); } } Loading
src/main/java/it/inaf/oats/vospace/exception/ErrorController.java 0 → 100644 +33 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("${server.error.path:${error.path:/error}}") public class ErrorController extends AbstractErrorController { @Autowired public ErrorController(ErrorAttributes errorAttributes) { super(errorAttributes); } @RequestMapping(produces = MediaType.TEXT_XML_VALUE) public void errorText(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> errors = super.getErrorAttributes(request, true); response.setContentType("text/plain;charset=UTF-8"); response.getOutputStream().print((String) errors.get("message")); } @Override public String getErrorPath() { return null; } }
src/main/java/it/inaf/oats/vospace/exception/NodeNotFoundException.java 0 → 100644 +12 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class NodeNotFoundException extends VoSpaceException { public NodeNotFoundException(String path) { super("NodeNotFound: " + path); } }
src/main/java/it/inaf/oats/vospace/exception/VoSpaceException.java 0 → 100644 +8 −0 Original line number Diff line number Diff line package it.inaf.oats.vospace.exception; public class VoSpaceException extends RuntimeException { public VoSpaceException(String message) { super(message); } }