[Trunk | Admin Tools]:

1. Deleted folder "responses" with all its files (moved to uoa-admin-tools-library in r60105).
2. Deleted file "SimpleErrorController.java" (moved to uoa-admin-tools-library in r60105).
This commit is contained in:
Konstantina Galouni 2021-02-25 10:07:57 +00:00
parent 5f2bc1fdfb
commit 8c3db8e451
3 changed files with 0 additions and 115 deletions

View File

@ -1,60 +0,0 @@
package eu.dnetlib.uoaadmintools.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* Created by argirok on 8/3/2018.
*/
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/error")
public class SimpleErrorController implements ErrorController {
private final ErrorAttributes errorAttributes;
@Autowired
public SimpleErrorController(ErrorAttributes errorAttributes) {
Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
this.errorAttributes = errorAttributes;
}
@Override
public String getErrorPath() {
return "/error";
}
@RequestMapping
public Map<String, Object> error(HttpServletRequest aRequest){
Map<String, Object> body = getErrorAttributes(aRequest,getTraceParameter(aRequest));
String trace = (String) body.get("trace");
if(trace != null){
String[] lines = trace.split("\n\t");
body.put("trace", lines);
}
return body;
}
private boolean getTraceParameter(HttpServletRequest request) {
String parameter = request.getParameter("trace");
if (parameter == null) {
return false;
}
return !"false".equals(parameter.toLowerCase());
}
private Map<String, Object> getErrorAttributes(HttpServletRequest aRequest, boolean includeStackTrace) {
RequestAttributes requestAttributes = new ServletRequestAttributes(aRequest);
return errorAttributes.getErrorAttributes(requestAttributes, includeStackTrace);
}
}

View File

@ -1,37 +0,0 @@
package eu.dnetlib.uoaadmintools.responses;
import java.util.List;
public class ExceptionResponse {
private String errorCode;
private String errorMessage;
private String errors;
public ExceptionResponse() {
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getErrors() {
return errors;
}
public void setErrors(String errors) {
this.errors = errors;
}
}

View File

@ -1,18 +0,0 @@
package eu.dnetlib.uoaadmintools.responses;
public class SingleValueWrapperResponse<T> {
private T value = null;
public SingleValueWrapperResponse() { }
public SingleValueWrapperResponse(T value) {
this.value = value;
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}