@Override
  public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
    Set<RequestTypeEnum> allowableRequestTypes = provideAllowableRequestTypes();
    RequestTypeEnum requestType = theRequest.getRequestType();
    if (!allowableRequestTypes.contains(requestType)) {
      return false;
    }
    if (!getResourceName().equals(theRequest.getResourceName())) {
      return false;
    }
    if (getMatchingOperation() == null && StringUtils.isNotBlank(theRequest.getOperation())) {
      return false;
    }
    if (getMatchingOperation() != null
        && !getMatchingOperation().equals(theRequest.getOperation())) {
      return false;
    }

    /*
     * Note: Technically this will match an update (PUT) method even if
     * there is no ID in the URL - We allow this here because there is no
     * better match for that, and this allows the update/PUT method to give
     * a helpful error if the client has forgotten to include the
     * ID in the URL.
     *
     * It's also needed for conditional update..
     */

    return true;
  }
 @Override
 public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
   if (theRequest.getRequestType() != RequestTypeEnum.POST) {
     return false;
   }
   if (isNotBlank(theRequest.getOperation())) {
     return false;
   }
   if (isNotBlank(theRequest.getResourceName())) {
     return false;
   }
   return true;
 }
  @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;
      } else {
        throw new MethodNotAllowedException(
            "/metadata request must use HTTP GET", RequestTypeEnum.GET);
      }
    }

    return false;
  }