Revision 60369
Added by Konstantina Galouni about 3 years ago
SimpleErrorController.java | ||
---|---|---|
24 | 24 |
@RequestMapping("/error") |
25 | 25 |
public class SimpleErrorController implements ErrorController { |
26 | 26 |
private final Logger log = Logger.getLogger(this.getClass()); |
27 |
private final Logger orcid_log = Logger.getLogger("ORCID-"+this.getClass().getName()); |
|
27 | 28 |
|
28 | 29 |
private final ErrorAttributes errorAttributes; |
29 | 30 |
|
... | ... | |
57 | 58 |
// message=Unknown status code [525] Origin SSL Handshake Error, |
58 | 59 |
// path=/uoa-orcid-service/orcid/work/save} |
59 | 60 |
|
60 |
log.debug(body); |
|
61 |
log.debug(body.get("status")); |
|
61 |
String path = (String)body.get("path"); |
|
62 |
if(path.contains("/uoa-orcid-service/orcid")) { |
|
63 |
orcid_log.error(body); |
|
64 |
} else { |
|
65 |
log.error(body); |
|
66 |
} |
|
67 |
|
|
62 | 68 |
Integer status = (Integer)body.get("status"); |
63 |
log.debug("status: "+status); |
|
64 | 69 |
|
65 | 70 |
HttpStatus statusCode = HttpStatus.INTERNAL_SERVER_ERROR; |
66 | 71 |
if (status != null) { |
67 | 72 |
statusCode = HttpStatus.valueOf(status); |
68 |
log.debug(statusCode); |
|
69 | 73 |
} |
70 | 74 |
|
71 | 75 |
ExceptionResponse response = new ExceptionResponse(); |
... | ... | |
73 | 77 |
response.setErrorMessage((String)body.get("exception")); |
74 | 78 |
response.setErrors((String)body.get("message")); |
75 | 79 |
response.setStatus(statusCode); |
76 |
log.error((String)body.get("exception")+" : "+ (String)body.get("message")); |
|
80 |
// log.error((String)body.get("exception")+" : "+ (String)body.get("message"));
|
|
77 | 81 |
return new ResponseEntity<ExceptionResponse>(response, statusCode); |
78 | 82 |
|
79 | 83 |
// return body; |
Also available in: Unified diff
[Trunk | Orcid Service]: getLocalWorks(@RequestBody String[][] pids)" (/local/works).
1. orcidservice.properties: Added properties "apiURL", "tokenURL", "clientId", "clientSecret" for ORCID API.
2. log4j.properties: Added configuration for ORCID log file "uoa-orcid-service-orcid.log".
3. UoaOrcidServiceApplication.java: Added "OrcidConfig.class" in "@EnableConfigurationProperties".
4. SimpleErrorController.java: If body.path.contains("/uoa-orcid-service/orcid"), log error in ORCID log file too.
5. UserTokensService.java: Added method "getEncryptedUserTokensByAai()".
6. UserTokensController.java:
a. Added ORCID log file for responses by ORCID API.
b. Added @Autowired OrcidConfig for getting ORICD token url, client and secret from properties.
c. Added method "getUserOrcidId()" (/local/orcidId)
d. Added method "getPersonalDetailsFromOrcid()" (/orcid/personal-details)
e. Renamed "/orcid/tokens/decrypt" to "/local/tokens/decrypt" & "/orcid/tokens/encrypt" to "/local/tokens/encrypt".
7. Work.java: Added field "updateDate".
8. WorkDAO.java & MongoDBWorkDAO.java: Added methods "List<Work> findByOrcidOrderByCreationDateDesc(String Orcid);" and "Work findByPutCode(String putCode);".
9. WorkService.java:
a. Added method "getLocalWorkByPutCode()".
b. Method "getLocalWorks()" returns works ordered by most recent creation date.
10. WorkController.java:
a. Added ORCID log file for responses by ORCID API.
b. Added @Autowired OrcidConfig for getting ORICD token url, client and secret from properties.
c. Added "charset=UTF-8" in all Content-Type request headers.
d. Renamed "/orcid/put-code" to "/local/put-code".
e. Added method "List<List
f. Added method "List<Work> getMyLocalWorks()" (/local/works).
g. Added method "updateWork()" (/orcid/work/update/{putCode}).
h. Added method "getWorksByPutCodes()" (/orcid/works).