public Object returnResponse(ServletRequestDetails theRequest, ParseAction<?> outcome, int operationStatus, boolean allowPrefer, MethodOutcome response, String resourceName) throws IOException { HttpServletResponse servletResponse = theRequest.getServletResponse(); servletResponse.setStatus(operationStatus); servletResponse.setCharacterEncoding(Constants.CHARSET_NAME_UTF8); addHeadersToResponse(servletResponse); if (allowPrefer) { addContentLocationHeaders(theRequest, servletResponse, response, resourceName); } Writer writer; if (outcome != null) { ResponseEncoding encoding = RestfulServerUtils.determineResponseEncodingWithDefault(theRequest); servletResponse.setContentType(encoding.getResourceContentType()); writer = servletResponse.getWriter(); IParser parser = encoding.getEncoding().newParser(getFhirContext()); parser.setPrettyPrint(RestfulServerUtils.prettyPrintResponse(this, theRequest)); outcome.execute(parser, writer); } else { servletResponse.setContentType(Constants.CT_TEXT_WITH_UTF8); writer = servletResponse.getWriter(); } return writer; }
public static void configureResponseParser(RequestDetails theRequestDetails, IParser parser) { boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theRequestDetails.getServer(), theRequestDetails);
boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest);
@Override public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException { IBaseResource response = doInvokeServer(theServer, theRequest); Set<SummaryEnum> summaryMode = RestfulServerUtils.determineSummaryMode(theRequest); ResponseDetails responseDetails = new ResponseDetails(); responseDetails.setResponseResource(response); responseDetails.setResponseCode(Constants.STATUS_HTTP_200_OK); HttpServletRequest servletRequest = null; HttpServletResponse servletResponse = null; if (theRequest instanceof ServletRequestDetails) { servletRequest = ((ServletRequestDetails) theRequest).getServletRequest(); servletResponse = ((ServletRequestDetails) theRequest).getServletResponse(); } for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { IServerInterceptor next = theServer.getInterceptors().get(i); boolean continueProcessing = next.outgoingResponse(theRequest, response); if (!continueProcessing) { return null; } continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse); if (!continueProcessing) { return null; } } boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); return theRequest.getResponse().streamResponseAsResource(responseDetails.getResponseResource(), prettyPrint, summaryMode, responseDetails.getResponseCode(), null, theRequest.isRespondGzip(), isAddContentLocationHeader()); }
boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); Set<SummaryEnum> summaryMode = Collections.emptySet();
public Object returnResponse(ServletRequestDetails theRequest, ParseAction<?> outcome, int operationStatus, boolean allowPrefer, MethodOutcome response, String resourceName) throws IOException { HttpServletResponse servletResponse = theRequest.getServletResponse(); servletResponse.setStatus(operationStatus); servletResponse.setCharacterEncoding(Constants.CHARSET_NAME_UTF8); addHeadersToResponse(servletResponse); if (allowPrefer) { addContentLocationHeaders(theRequest, servletResponse, response, resourceName); } Writer writer; if (outcome != null) { ResponseEncoding encoding = RestfulServerUtils.determineResponseEncodingWithDefault(theRequest); servletResponse.setContentType(encoding.getResourceContentType()); writer = servletResponse.getWriter(); IParser parser = encoding.getEncoding().newParser(getFhirContext()); parser.setPrettyPrint(RestfulServerUtils.prettyPrintResponse(this, theRequest)); outcome.execute(parser, writer); } else { servletResponse.setContentType(Constants.CT_TEXT_WITH_UTF8); writer = servletResponse.getWriter(); } return writer; }
public static void configureResponseParser(RequestDetails theRequestDetails, IParser parser) { boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theRequestDetails.getServer(), theRequestDetails);
boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest);
@Override public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException { IBaseResource response = doInvokeServer(theServer, theRequest); Set<SummaryEnum> summaryMode = RestfulServerUtils.determineSummaryMode(theRequest); ResponseDetails responseDetails = new ResponseDetails(); responseDetails.setResponseResource(response); responseDetails.setResponseCode(Constants.STATUS_HTTP_200_OK); HttpServletRequest servletRequest = null; HttpServletResponse servletResponse = null; if (theRequest instanceof ServletRequestDetails) { servletRequest = ((ServletRequestDetails) theRequest).getServletRequest(); servletResponse = ((ServletRequestDetails) theRequest).getServletResponse(); } for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { IServerInterceptor next = theServer.getInterceptors().get(i); boolean continueProcessing = next.outgoingResponse(theRequest, response); if (!continueProcessing) { return null; } continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse); if (!continueProcessing) { return null; } } boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); return theRequest.getResponse().streamResponseAsResource(responseDetails.getResponseResource(), prettyPrint, summaryMode, responseDetails.getResponseCode(), null, theRequest.isRespondGzip(), isAddContentLocationHeader()); }
boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); Set<SummaryEnum> summaryMode = Collections.emptySet();