@Override public boolean handleException(RequestDetails theRequestDetails, BaseServerResponseException theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException, IOException { /* * It's not a browser... */ Set<String> accept = RestfulServerUtils.parseAcceptHeaderAndReturnHighestRankedOptions(theServletRequest); if (!accept.contains(Constants.CT_HTML)) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } /* * It's an AJAX request, so no HTML */ String requestedWith = theServletRequest.getHeader("X-Requested-With"); if (requestedWith != null) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } /* * Not a GET */ if (theRequestDetails.getRequestType() != RequestTypeEnum.GET) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } if (theException.getOperationOutcome() == null) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest, theException.getStatusCode()); return false; }
@Override public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) { if (CorsUtils.isCorsRequest(theRequest)) { boolean isValid; try { isValid = myCorsProcessor.processRequest(myConfig, theRequest, theResponse); } catch (IOException e) { throw new InternalErrorException(e); } if (!isValid || CorsUtils.isPreFlightRequest(theRequest)) { return false; } } return super.incomingRequestPreProcessed(theRequest, theResponse); }
@Override public boolean outgoingResponse(RequestDetails theRequestDetails) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(theRequestDetails, details.getServletRequest(), details.getServletResponse()); }
@Override public void incomingRequestPreHandled(RestOperationTypeEnum theOperation, ActionRequestDetails theProcessedRequest) { boolean isEnabled = Boolean.valueOf(enabled); if (isEnabled && baselineDate != null) { // transform dates switch (theOperation) { case CREATE: case DELETE: case UPDATE: IBaseResource resource = theProcessedRequest.getResource(); // todo need to do something here break; default: break; } super.incomingRequestPreHandled(theOperation, theProcessedRequest); } else { super.incomingRequestPreHandled(theOperation, theProcessedRequest); } } }
@Override public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(details, theResponseObject, details.getServletRequest(), details.getServletResponse()); }
@Override public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) { if (CorsUtils.isCorsRequest(theRequest)) { boolean isValid; try { isValid = myCorsProcessor.processRequest(myConfig, theRequest, theResponse); } catch (IOException e) { throw new InternalErrorException(e); } if (!isValid || CorsUtils.isPreFlightRequest(theRequest)) { return false; } } return super.incomingRequestPreProcessed(theRequest, theResponse); }
@Override public boolean handleException(RequestDetails theRequestDetails, BaseServerResponseException theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException, IOException { /* * It's not a browser... */ Set<String> accept = RestfulServerUtils.parseAcceptHeaderAndReturnHighestRankedOptions(theServletRequest); if (!accept.contains(Constants.CT_HTML)) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } /* * It's an AJAX request, so no HTML */ String requestedWith = theServletRequest.getHeader("X-Requested-With"); if (requestedWith != null) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } /* * Not a GET */ if (theRequestDetails.getRequestType() != RequestTypeEnum.GET) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } if (theException.getOperationOutcome() == null) { return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); } streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest, theException.getStatusCode()); return false; }
@Override public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(details, theResponseObject, details.getServletRequest(), details.getServletResponse()); }
if (rawParamValues != null && rawParamValues.length > 0 && rawParamValues[0].equals(PARAM_RAW_TRUE)) { ourLog.warn("Client is using non-standard/legacy _raw parameter - Use _format=json or _format=xml instead, as this parmameter will be removed at some point"); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); theRequestDetails.addParameter(Constants.PARAM_FORMAT, PARAM_FORMAT_VALUE_JSON); } else { return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
@Override public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(details, theResponseObject, details.getServletRequest(), details.getServletResponse()); }
@Override public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(details, theResponseObject, details.getServletRequest(), details.getServletResponse()); }
@Override public boolean outgoingResponse(RequestDetails theRequestDetails) { ServletRequestDetails details = (ServletRequestDetails) theRequestDetails; return outgoingResponse(theRequestDetails, details.getServletRequest(), details.getServletResponse()); }
if (rawParamValues != null && rawParamValues.length > 0 && rawParamValues[0].equals(PARAM_RAW_TRUE)) { ourLog.warn("Client is using non-standard/legacy _raw parameter - Use _format=json or _format=xml instead, as this parmameter will be removed at some point"); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); theRequestDetails.addParameter(Constants.PARAM_FORMAT, PARAM_FORMAT_VALUE_JSON); } else { return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);