Returns true if the configured pattern (and HTTP-Method) match those of
the supplied request.

@param request
the request to match against. The ant pattern will be matched
against the {@code servletPath} + {@code pathInfo} of the
request.
490239
public boolean matches(HttpServletRequest request) {
    if (httpMethod != null && httpMethod != HttpMethod.valueOf(request.getMethod())) { return false; }
    String url = request.getServletPath();
    if (null != request.getPathInfo()) url += request.getPathInfo();
    return pattern.match(url);
  }
1189149
private boolean isFresh(final YokeRequest request) {
        // defaults
        boolean etagMatches = true;
        boolean notModified = true;

        // fields
        String modifiedSince = request.getHeader("if-modified-since");
        String noneMatch = request.getHeader("if-none-match");
        String[] noneMatchTokens = null;
        String lastModified = request.response().getHeader("last-modified");
        String etag = request.response().getHeader("etag");

        // unconditional request
        if (modifiedSince == null && noneMatch == null) {
            return false;
        }

        // parse if-none-match
        if (noneMatch != null) {
            noneMatchTokens = noneMatch.split(" *, *");
        }

        // if-none-match
        if (noneMatchTokens != null) {
            etagMatches = false;
            for (String s : noneMatchTokens) {
                if (etag.equals(s) || "*".equals(noneMatchTokens[0])) {
                    etagMatches = true;
                    break;
                }
            }
        }

        // if-modified-since
        if (modifiedSince != null) {
            try {
                Date modifiedSinceDate = parse(modifiedSince);
                Date lastModifiedDate = parse(lastModified);
                notModified = lastModifiedDate.getTime() <= modifiedSinceDate.getTime();
            } catch (ParseException e) {
                notModified = false;
            }
        }

        return etagMatches && notModified;
    }
504756
public static boolean isAllowed(ServletContext servletContext, ServletRequest request) {
		return
			Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM))
			&& isAllowedAddr(request.getRemoteAddr())
		;
	}
92025
@Override
	public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
		if (!Constants.PARAM_HISTORY.equals(theRequest.getOperation())) {
			return false;
		}
		if (theRequest.getResourceName() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_SYSTEM;
		}
		if (!StringUtils.equals(theRequest.getResourceName(), myResourceName)) {
			return false;
		}

		boolean haveIdParam = theRequest.getId() != null && !theRequest.getId().isEmpty();
		boolean wantIdParam = myIdParamIndex != null;
		if (haveIdParam != wantIdParam) {
			return false;
		}

		if (theRequest.getId() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_TYPE;
		} else if (theRequest.getId().hasVersionIdPart()) {
			return false;
		}

		return true;
	}
597893
public boolean matches(String uri) {
		if (uri == null) {
			return false;
		}
		Matcher matcher = this.matchPattern.matcher(uri);
		return matcher.matches();
	}
1239347
static String getServletPath(HttpServletRequest request) {
    String servletPath = request.getServletPath();
    if (hackWorks && PACKAGE.equals(request.getClass().getPackage().getName())) {
      try {
        Object outer = get(request, "this$0");
        Object servletPipeline = get(outer, "servletPipeline");
        Object servletDefs = get(servletPipeline, "servletDefinitions");
        int length = Array.getLength(servletDefs);
        for (int i = 0; i < length; ++i) {
          Object pattern = get(Array.get(servletDefs, i), "patternMatcher");
          if (matches(pattern, servletPath)) {
            servletPath = extractPath(pattern, servletPath);
            break;
          }
        }
      } catch (Exception e) {
        hackWorks = false;
      }
    }
    return servletPath;
  }
1369491
public static boolean matches(Collection<PathPattern> patterns, List<String> path) {
		for (PathPattern pattern : patterns)
			if (pattern.matches(path))
				return true;
		return false;
	}
1208706
public static void setupRequestParameters(final HttpServletRequest request) {

		// Check already processed
		if (request.getAttribute(REQUEST_PROCESSED_KEY) != null) {
			return;
		}

		Map<String, String[]> parameters = new HashMap<>();
		Map<String, FileItem[]> files = new HashMap<>();

		extractParameterMap(request, parameters, files);

		request.setAttribute(REQUEST_PROCESSED_KEY, "Y");
		request.setAttribute(REQUEST_PARAMETERS_KEY, Collections.unmodifiableMap(parameters));
		request.setAttribute(REQUEST_FILES_KEY, Collections.unmodifiableMap(files));
	}
1120973
public static boolean isJsonRequest(ServletRequest request) {

        HttpServletRequest sr = (HttpServletRequest)request;
        return (sr.getQueryString() != null) && (sr.getQueryString().contains("__json=true"));
    }
361540
public static boolean isMultipart(HttpServletRequest request) {
		if (false == isPostMethod(request)) {
			return false;
		}

		String contentType = request.getContentType();
		if (StrUtil.isBlank(contentType)) {
			return false;
		}
		if (contentType.toLowerCase().startsWith("multipart/")) {
			return true;
		}

		return false;
	}
1058852
public static boolean isHttpGetRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isGet = isSane && request.getMethod().equals(HttpMethod.GET.toString());
        return isSane && isGet;
    }
1238486
public boolean matches(HttpServletRequest request) {
        if (pattern.equals(MATCH_ALL)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Request '" + getRequestPath(request) + "' matched by universal pattern '/**'");
            }

            return true;
        }

        String url = getRequestPath(request);

        if (logger.isDebugEnabled()) {
            logger.debug("Checking match of request : '" + url + "'; against '" + pattern + "'");
        }

        return matcher.matches(url);
    }
1165574
public boolean isAsyncStarted(ServletRequest request) {

        if (isAsyncStartedMethod != null) {
            try {
                return (Boolean) isAsyncStartedMethod.invoke(request);
            } catch (IllegalAccessException e) {
                ServletLogger.LOG.error(e);
                return false;
            } catch (InvocationTargetException e) {
                ServletLogger.LOG.error(e);
                return false;
            }
        } else {
            return false;
        }
    }
430312
private boolean allMatch(final Request request) throws IOException {
        boolean success = true;
        for (final Pass pass : this.all) {
            if (!pass.enter(request).has()) {
                success = false;
                break;
            }
        }
        return success;
    }
92717
public boolean isValid(HttpServletRequest request) {
    String challenge = request.getParameter(CHALLENGE_FIELD_NAME);
    String response = request.getParameter(RESPONSE_FIELD_NAME);    
    return isValid(request, challenge, response);
  }
841222
public boolean matches(HttpMethod method, String uri) {
        if (this.httpMethod == method) {
            Matcher matcher = regex.matcher(uri);
            return matcher.matches();
        } else {
            return false;
        }
    }
1039850
static public boolean isFromLocalhost(HttpServletRequest request){
		String addr = request.getRemoteAddr();
		return "0:0:0:0:0:0:0:1".equals(addr) || "::1".equals(addr)
				|| (addr != null && addr.startsWith("127."));
	}