streamResponse(theRequestDetails, theServletResponse, theResponseObject.getResponseResource(), theServletRequest, 200);
@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; }
streamResponse(theRequestDetails, theServletResponse, theResponseObject.getResponseResource(), theServletRequest, 200);
@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; }