@Override public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) { RequestTypeEnum requestType = RequestTypeEnum.valueOf(theRequest.getMethod()); if (myAllowedMethods.contains(requestType)) { return true; } throw new MethodNotAllowedException("Method not supported: " + theRequest.getMethod()); }
@Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { if (theRequest.getRequestType() == RequestTypeEnum.OPTIONS) { if (theRequest.getOperation() == null && theRequest.getResourceName() == null) { return true; } } if (theRequest.getResourceName() != null) { return false; } if ("metadata".equals(theRequest.getOperation())) { if (theRequest.getRequestType() == RequestTypeEnum.GET) { return true; } throw new MethodNotAllowedException("/metadata request must use HTTP GET", RequestTypeEnum.GET); } return false; }
HapiLocalizer localizer = theRequest.getServer().getFhirContext().getLocalizer(); String msg = localizer.getMessage(OperationParameter.class, "urlParamNotPrimitive", myOperationName, myName); throw new MethodNotAllowedException(msg, RequestTypeEnum.POST);
throw new MethodNotAllowedException("$expunge is not enabled on this server");
@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; }
break; case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED: ex = new MethodNotAllowedException("Server responded with HTTP 405"); break; case Constants.STATUS_HTTP_409_CONFLICT:
break; case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED: ex = new MethodNotAllowedException("Server responded with HTTP 405"); break; case Constants.STATUS_HTTP_409_CONFLICT:
for (IQueryParameterType next : nextOrs) { if (next.getMissing() != null) { throw new MethodNotAllowedException(":missing modifier is disabled on this server");
if (id.isContains()) { if (!myDaoConfig.isAllowContainsSearches()) { throw new MethodNotAllowedException(":contains modifier is disabled on this server");
@Override public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) { RequestTypeEnum requestType = RequestTypeEnum.valueOf(theRequest.getMethod()); if (myAllowedMethods.contains(requestType)) { return true; } throw new MethodNotAllowedException("Method not supported: " + theRequest.getMethod()); }
@Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { if (theRequest.getRequestType() == RequestTypeEnum.OPTIONS) { if (theRequest.getOperation() == null && theRequest.getResourceName() == null) { return true; } } if (theRequest.getResourceName() != null) { return false; } if ("metadata".equals(theRequest.getOperation())) { if (theRequest.getRequestType() == RequestTypeEnum.GET) { return true; } throw new MethodNotAllowedException("/metadata request must use HTTP GET", RequestTypeEnum.GET); } return false; }
HapiLocalizer localizer = theRequest.getServer().getFhirContext().getLocalizer(); String msg = localizer.getMessage(OperationParameter.class, "urlParamNotPrimitive", myOperationName, myName); throw new MethodNotAllowedException(msg, RequestTypeEnum.POST);
throw new MethodNotAllowedException("$expunge is not enabled on this server");
@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; }
break; case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED: ex = new MethodNotAllowedException("Server responded with HTTP 405"); break; case Constants.STATUS_HTTP_409_CONFLICT:
break; case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED: ex = new MethodNotAllowedException("Server responded with HTTP 405"); break; case Constants.STATUS_HTTP_409_CONFLICT:
for (IQueryParameterType next : nextOrs) { if (next.getMissing() != null) { throw new MethodNotAllowedException(":missing modifier is disabled on this server");
if (id.isContains()) { if (!myDaoConfig.isAllowContainsSearches()) { throw new MethodNotAllowedException(":contains modifier is disabled on this server");