/** * GETs the HTML representation of the ORCID record containing only work details * * @param orcid the ORCID that corresponds to the user's record * @return the HTML representation of the ORCID record */ @Override @GET @Produces(value = {MediaType.TEXT_HTML}) @Path(WORKS_PATH) public Response viewWorksDetailsHtml(@PathParam("orcid") String orcid) { Response response = serviceDelegator.findWorksDetails(orcid); return Response.fromResponse(response) .header("Content-Disposition", "attachment; filename=\"" + orcid + "-works.xml\"") .build(); }
/** * GETs the HTML representation of the ORCID external identifiers * * @param orcid the ORCID that corresponds to the user's record * @return the HTML representation of the ORCID record */ @Override @GET @Produces(value = {MediaType.TEXT_HTML}) @Path(EXTERNAL_IDENTIFIER_PATH) public Response viewExternalIdentifiersHtml(@PathParam("orcid") String orcid) { Response response = serviceDelegator.findExternalIdentifiers(orcid); return Response.fromResponse(response) .header("Content-Disposition", "attachment; filename=\"" + orcid + "-external-ids.xml\"") .build(); }
@Override public ContainerResponse filter(ContainerRequest request, ContainerResponse response) { ResponseBuilder responseBuilder = Response.fromResponse(response.getResponse()); responseBuilder.header(ACCESS_CONTROL_ALLOW_ORIGIN, this.origin); response.setResponse(responseBuilder.build()); return response; }
private Response downgradeResponse(Response response) { Object entity = response.getEntity(); V2Convertible result = null; if (entity != null) { result = v2VersionConverterChain.downgrade( new V2Convertible(entity, MemberV2ApiServiceDelegator.LATEST_V2_VERSION), externalVersion); return Response.fromResponse(response).entity(result.getObjectToConvert()).build(); } return response; }
@Override public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return Response.fromResponse(attachDiskToVm(disk)) .entity(map(lookupEntity(asGuid(disk.getId())))) .build(); } else { validateDiskForCreation(disk); return performCreate( addAction, getAddParameters(map(disk), disk), getEntityIdResolver(disk.getName())); } }
@Override public ContainerResponse filter(ContainerRequest req, ContainerResponse contResp) { LOGGER.info("Enter CORS filter"); LOGGER.info("Request= { path:" + req.getPath() + ", method:" + req.getMethod() + " }"); ResponseBuilder resp = Response.fromResponse(contResp.getResponse()); resp.header("Access-Control-Allow-Origin", "*"); resp.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); String reqHead = req.getHeaderValue("Access-Control-Request-Headers"); if (null != reqHead && !reqHead.equals(null)) { resp.header("Access-Control-Allow-Headers", reqHead); } contResp.setResponse(resp.build()); LOGGER.info("Exit CORS filter"); return contResp; }