@Override public String getHttpVerbName() { return myRequestTypeEnum.name(); }
@Override public String getHttpVerbName() { return myRequestType.name(); }
private void updateAllowHeader() { getResponseHeaders().remove(Constants.HEADER_ALLOW); StringBuilder b = new StringBuilder(); for (RequestTypeEnum next : myAllowedMethods) { if (b.length() > 0) { b.append(','); } b.append(next.name()); } addResponseHeader(Constants.HEADER_ALLOW, b.toString()); }
public static void throwUnknownFhirOperationException(RequestDetails requestDetails, String requestPath, RequestTypeEnum theRequestType, FhirContext theFhirContext) { throw new InvalidRequestException(theFhirContext.getLocalizer().getMessage(RestfulServer.class, "unknownMethod", theRequestType.name(), requestPath, requestDetails.getParameters().keySet())); }
@Override public IHttpResponse execute() { StopWatch responseStopWatch = new StopWatch(); Invocation invocation = getRequest().build(getRequestType().name(), getEntity()); Response response = invocation.invoke(); return new JaxRsHttpResponse(response, responseStopWatch); }
@Override public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException { if (theRequest.getRequestType() == RequestTypeEnum.POST) { // all good } else if (theRequest.getRequestType() == RequestTypeEnum.GET) { if (!myIdempotent) { String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.POST); } } else { if (!myIdempotent) { String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.POST); } String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.GET.name(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.GET, RequestTypeEnum.POST); } if (myIdParamIndex != null) { theMethodParams[myIdParamIndex] = theRequest.getId(); } Object response = invokeServerMethod(theServer, theRequest, theMethodParams); IBundleProvider retVal = toResourceList(response); return retVal; }
private void updateAllowHeader() { getResponseHeaders().remove(Constants.HEADER_ALLOW); StringBuilder b = new StringBuilder(); for (RequestTypeEnum next : myAllowedMethods) { if (b.length() > 0) { b.append(','); } b.append(next.name()); } addResponseHeader(Constants.HEADER_ALLOW, b.toString()); }
public static void throwUnknownFhirOperationException(RequestDetails requestDetails, String requestPath, RequestTypeEnum theRequestType, FhirContext theFhirContext) { throw new InvalidRequestException(theFhirContext.getLocalizer().getMessage(RestfulServer.class, "unknownMethod", theRequestType.name(), requestPath, requestDetails.getParameters().keySet())); }
@Override public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException { if (theRequest.getRequestType() == RequestTypeEnum.POST) { // all good } else if (theRequest.getRequestType() == RequestTypeEnum.GET) { if (!myIdempotent) { String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.POST); } } else { if (!myIdempotent) { String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.POST); } String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.GET.name(), RequestTypeEnum.POST.name()); throw new MethodNotAllowedException(message, RequestTypeEnum.GET, RequestTypeEnum.POST); } if (myIdParamIndex != null) { theMethodParams[myIdParamIndex] = theRequest.getId(); } Object response = invokeServerMethod(theServer, theRequest, theMethodParams); IBundleProvider retVal = toResourceList(response); return retVal; }