@Override public BaseHttpClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException { IIdType idDt = (IIdType) theArgs[getIdParameterIndex()]; if (idDt == null) { throw new NullPointerException("ID can not be null"); } if (idDt.hasResourceType() == false) { idDt = idDt.withResourceType(getResourceName()); } else if (getResourceName().equals(idDt.getResourceType()) == false) { throw new InvalidRequestException( "ID parameter has the wrong resource type, expected '" + getResourceName() + "', found: " + idDt.getResourceType()); } HttpDeleteClientInvocation retVal = createDeleteInvocation(getContext(), idDt); for (int idx = 0; idx < theArgs.length; idx++) { IParameter nextParam = getParameters().get(idx); nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, null); } return retVal; }
private Object returnResponse( IRestfulServer<?> theServer, RequestDetails theRequest, MethodOutcome response, IBaseResource originalOutcome, IBaseResource resource) throws IOException { boolean allowPrefer = false; int operationStatus = getOperationStatus(response); IBaseResource outcome = originalOutcome; if (ourOperationsWhichAllowPreferHeader.contains(getRestOperationType())) { allowPrefer = true; } if (resource != null && allowPrefer) { String prefer = theRequest.getHeader(Constants.HEADER_PREFER); PreferReturnEnum preferReturn = RestfulServerUtils.parsePreferHeader(prefer); if (preferReturn != null) { if (preferReturn == PreferReturnEnum.REPRESENTATION) { outcome = resource; } } } for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { IServerInterceptor next = theServer.getInterceptors().get(i); boolean continueProcessing = next.outgoingResponse(theRequest, outcome); if (!continueProcessing) { return null; } } IRestfulResponse restfulResponse = theRequest.getResponse(); if (response != null) { if (response.getResource() != null) { restfulResponse.setOperationResourceLastUpdated( RestfulServerUtils.extractLastUpdatedFromResource(response.getResource())); } IIdType responseId = response.getId(); if (responseId != null && responseId.getResourceType() == null && responseId.hasIdPart()) { responseId = responseId.withResourceType(getResourceName()); } if (responseId != null) { String serverBase = theRequest.getFhirServerBase(); responseId = RestfulServerUtils.fullyQualifyResourceIdOrReturnNull( theServer, resource, serverBase, responseId); restfulResponse.setOperationResourceId(responseId); } } boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); Set<SummaryEnum> summaryMode = Collections.emptySet(); return restfulResponse.streamResponseAsResource( outcome, prettyPrint, summaryMode, operationStatus, null, theRequest.isRespondGzip(), true); // return theRequest.getResponse().returnResponse(ParseAction.create(outcome), operationStatus, // allowPrefer, response, getResourceName()); }