@Override public Response sendAttachmentResponse(IBaseBinary bin, int statusCode, String contentType) throws IOException { ResponseBuilder response = buildResponse(statusCode); if (bin.getContent() != null && bin.getContent().length > 0) { response.header(Constants.HEADER_CONTENT_TYPE, contentType).entity(bin.getContent()); } return response.build(); }
@Override public IHttpRequest createBinaryRequest(FhirContext theContext, IBaseBinary theBinary) { initBaseRequest(theContext, null, createPostBody(theBinary.getContent(), theBinary.getContentType())); return myRequest; }
@Override public IHttpRequest createBinaryRequest(FhirContext theContext, IBaseBinary theBinary) { byte[] content = theBinary.getContent(); IHttpRequest retVal = createHttpRequest(content); addHeadersToRequest(retVal, null, theContext); retVal.addHeader(Constants.HEADER_CONTENT_TYPE, theBinary.getContentType()); return retVal; }
@Override public Object sendAttachmentResponse(IBaseBinary bin, int stausCode, String contentType) throws IOException { addHeaders(); HttpServletResponse theHttpResponse = getRequestDetails().getServletResponse(); theHttpResponse.setStatus(stausCode); theHttpResponse.setContentType(contentType); theHttpResponse.setCharacterEncoding(null); if (bin.getContent() == null || bin.getContent().length == 0) { return theHttpResponse.getOutputStream(); } theHttpResponse.setContentLength(bin.getContent().length); ServletOutputStream oos = theHttpResponse.getOutputStream(); oos.write(bin.getContent()); return oos; }
@Override public IHttpRequest createBinaryRequest(FhirContext theContext, IBaseBinary theBinary) { byte[] content = theBinary.getContent(); IHttpRequest retVal = createHttpRequest(content); addHeadersToRequest(retVal, null, theContext); retVal.addHeader(Constants.HEADER_CONTENT_TYPE, theBinary.getContentType()); return retVal; }
@Override public Object sendAttachmentResponse(IBaseBinary bin, int stausCode, String contentType) throws IOException { addHeaders(); HttpServletResponse theHttpResponse = getRequestDetails().getServletResponse(); theHttpResponse.setStatus(stausCode); theHttpResponse.setContentType(contentType); theHttpResponse.setCharacterEncoding(null); if (bin.getContent() == null || bin.getContent().length == 0) { return theHttpResponse.getOutputStream(); } theHttpResponse.setContentLength(bin.getContent().length); ServletOutputStream oos = theHttpResponse.getOutputStream(); oos.write(bin.getContent()); return oos; }