Package ca.uhn.fhir.rest.server.exceptions

Examples of ca.uhn.fhir.rest.server.exceptions.InvalidRequestException


    for (List<String> nextParamList : theString) {
      if (nextParamList.isEmpty()) {
        continue;
      }
      if (nextParamList.size() > 1) {
        throw new InvalidRequestException("'OR' query parameters (values containing ',') are not supported in _include parameters");
      }
     
      String value = nextParamList.get(0);
      if (myAllow != null) {
        if (!myAllow.contains(value)) {
          throw new InvalidRequestException("Invalid _include parameter value: '" + value + "'. Valid values are: " + new TreeSet<String>(myAllow));
        }
      }
      retVal.add(new PathSpecification(value));
    }
   
View Full Code Here


    String locationHeader = theRequest.getServletRequest().getHeader(Constants.HEADER_CONTENT_LOCATION);
    if (isNotBlank(locationHeader)) {
      MethodOutcome mo = new MethodOutcome();
      parseContentLocation(mo, locationHeader);
      if (mo.getId() == null || mo.getId().isEmpty()) {
        throw new InvalidRequestException("Invalid Content-Location header for resource " + getResourceName()+ ": " + locationHeader);
      }
      if (mo.getVersionId() != null && mo.getVersionId().isEmpty() == false) {
        theRequest.setVersion(mo.getVersionId());
      }
    }
View Full Code Here

  protected void addParametersForServerRequest(Request theRequest, Object[] theParams) {
    String url = theRequest.getCompleteUrl();
    int resNameIdx = url.indexOf(getResourceName());
    String id = url.substring(resNameIdx+getResourceName().length() + 1);
    if (id.contains("/")) {
      throw new InvalidRequestException("Invalid request path for a DELETE operation: "+theRequest.getCompleteUrl());
    }
   
    theParams[myIdParameterIndex] = new IdDt(id);
  }
View Full Code Here

      dt = newInstance();
      if (theString.size() == 0 || theString.get(0).size() == 0) {
        return dt;
      }
      if (theString.size() > 1) {
        throw new InvalidRequestException("Multiple values detected");
      }
     
      dt.setValuesAsQueryTokens(theString.get(0));
    } catch (SecurityException e) {
      throw new InternalErrorException(e);
View Full Code Here

  public Object parse(List<QualifiedParamList> theParams) throws InternalErrorException, InvalidRequestException {
    if (theParams.size() == 0 || theParams.get(0).size() == 0) {
      return "";
    }
    if (theParams.size() > 1 || theParams.get(0).size() > 1) {
      throw new InvalidRequestException("Multiple values detected");
    }

    return theParams.get(0).get(0);
  }
View Full Code Here

        if (StringUtils.isNotBlank(sinceParams[0])) {
          try {
            InstantDt since = new InstantDt(sinceParams[0]);
            return ParameterUtil.fromInstant(myType, since);
          } catch (DataFormatException e) {
            throw new InvalidRequestException("Invalid " + Constants.PARAM_SINCE + " value: " + sinceParams[0]);
          }
        }
      }
    }
    return ParameterUtil.fromInstant(myType, null);
View Full Code Here

      }
      encoding = EncodingEnum.forContentType(contentTypeHeader);
    }

    if (encoding == null) {
      throw new InvalidRequestException("Request contins non-FHIR conent-type header value: " + contentTypeHeader);
    }

    IParser parser = encoding.newParser(getContext());
    return parser;
  }
View Full Code Here

  protected BaseServerResponseException processNon2xxResponseAndReturnExceptionToThrow(int theStatusCode, String theResponseMimeType, Reader theResponseReader) {
    BaseServerResponseException ex;
    switch (theStatusCode) {
    case Constants.STATUS_HTTP_400_BAD_REQUEST:
      ex = new InvalidRequestException("Server responded with HTTP 400");
      break;
    case Constants.STATUS_HTTP_404_NOT_FOUND:
      ex = new ResourceNotFoundException("Server responded with HTTP 404");
      break;
    case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED:
View Full Code Here

    if (theParams.size() == 0 || theParams.get(0).size() == 0) {
      return dt;
    }
    if (theParams.size() > 1 || theParams.get(0).size() > 1) {
      throw new InvalidRequestException("Multiple values detected");
    }

    dt.setValueAsQueryToken(theParams.get(0).getQualifier(), value);
    return dt;
  }
View Full Code Here

  public BaseHttpClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException {
    HttpPostClientInvocation retVal;

    IdDt id = (IdDt) theArgs[myIdParamIndex];
    if (id == null || id.isEmpty()) {
      throw new InvalidRequestException("ID must not be null or empty for this operation");
    }

    IdDt versionId = null;
    if (myVersionIdParamIndex != null) {
      versionId = (IdDt) theArgs[myVersionIdParamIndex];
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.rest.server.exceptions.InvalidRequestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.