This filter only processes GET requests that targets a nt:file resource.
@param request
@return true if the filter accepts the given request
422615
@SuppressWarnings("null")
  private boolean accepts(SlingHttpServletRequest request) {
    return request.getMethod().equalsIgnoreCase(METHOD_GET)
        && request.getResource() != null
        && StringUtils.equals(request.getResource().getValueMap().get(JCR_PRIMARYTYPE, String.class), NT_FILE);
  }
151698
public static boolean isCachedContentRequest(final Request request) {

		// Get target id on request
		String targetId = request.getParameter(Environment.TARGET_ID);
		if (targetId == null) {
			return false;
		}

		// Get target
		ComponentWithContext targetWithContext = WebUtilities.getComponentById(targetId, true);
		if (targetWithContext == null) {
			return false;
		}

		// Check for caching key
		WComponent target = targetWithContext.getComponent();
		UIContextHolder.pushContext(targetWithContext.getContext());

		try {
			// TODO Look at implementing CacheableTarget interface
			String key = null;
			if (target instanceof WContent) {
				key = ((WContent) target).getCacheKey();
			} else if (target instanceof WImage) {
				key = ((WImage) target).getCacheKey();
			} else if (target instanceof WVideo) {
				key = ((WVideo) target).getCacheKey();
			} else if (target instanceof WAudio) {
				key = ((WAudio) target).getCacheKey();
			}
			return !Util.empty(key);
		} finally {
			UIContextHolder.popContext();
		}
	}
984053
public static boolean useXhtmlContentType(HttpServletRequest request) {
		// Some test accept headers:
		//   Firefox: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
		//   IE 6: */*
		//   IE 8: */*
		//   IE 8 Compat: */*
		@SuppressWarnings("unchecked")
		Enumeration<String> acceptValues = request.getHeaders("Accept");

		boolean hasAcceptHeader = false;
		boolean hasAcceptApplicationXhtmlXml = false;
		boolean hasAcceptHtmlHtml = false;
		boolean hasAcceptStarStar = false;
		if(acceptValues!=null) {
			while(acceptValues.hasMoreElements()) {
				hasAcceptHeader = true;
				for(String value : StringUtility.splitString(acceptValues.nextElement(), ',')) {
					value = value.trim();
					final List<String> params = StringUtility.splitString(value, ';');
					final int paramsSize = params.size();
					if(paramsSize>0) {
						String acceptType = params.get(0).trim();
						if(acceptType.equals("*/*")) {
							// No q parameter parsing for */*
							hasAcceptStarStar = true;
						} else if(
							// Parse and check the q for these two types
							acceptType.equalsIgnoreCase(CONTENT_TYPE_XHTML)
							|| acceptType.equalsIgnoreCase(CONTENT_TYPE_HTML)
						) {
							// Find any q value
							boolean hasNegativeQ = false;
							for(int paramNum = 1; paramNum<paramsSize; paramNum++) {
								String paramSet = params.get(paramNum).trim();
								if(paramSet.startsWith("q=") || paramSet.startsWith("Q=")) {
									try {
										float q = Float.parseFloat(paramSet.substring(2).trim());
										if(q<0) {
											hasNegativeQ = true;
											break;
										}
									} catch(NumberFormatException err) {
										// Intentionally ignored
									}
								}
							}
							if(!hasNegativeQ) {
								if(acceptType.equalsIgnoreCase(CONTENT_TYPE_XHTML)) hasAcceptApplicationXhtmlXml = true;
								else if(acceptType.equalsIgnoreCase(CONTENT_TYPE_HTML)) hasAcceptHtmlHtml = true;
								else throw new AssertionError("Unexpected value for acceptType: "+acceptType);
							}
						}
					}
				}
			}
		}
		// If the Accept header explicitly contains application/xhtml+xml  (with either no "q" parameter or a positive "q" value) deliver the document using that media type.
		if(hasAcceptApplicationXhtmlXml) return true;
		// If the Accept header explicitly contains text/html  (with either no "q" parameter or a positive "q" value) deliver the document using that media type.
		if(hasAcceptHtmlHtml) return false;
		// If the accept header contains "*/*" (a convention some user agents use to indicate that they will accept anything), deliver the document using text/html.
		if(hasAcceptStarStar) return false;
		// If has no accept headers
		if(!hasAcceptHeader) return true;
		// This choice is not clear from either of the cited documents.  If there is an accept line,
		// and it doesn't have */* or application/xhtml+xml or text/html, we'll serve as text/html
		// since it is a fairly broken client anyway and would be even less likely to know xhtml.
		return false;

	}
493283
@Override
  public boolean service(RequestBaratine request)
  {
    request.status(HttpStatus.NOT_FOUND);
    
    request.write("Not found: " + request.uri() + "\n");
    request.ok();
    
    return true;
  }
366642
public static final boolean isMultipartContent(HttpServletRequest request) {
		if (!RestConst.POST_METHOD.equalsIgnoreCase(request.getMethod())) {
			return false;
		}
		String contentType = request.getContentType();
		if (contentType == null) {
			return false;
		}
		contentType = contentType.toLowerCase(Locale.ENGLISH);
		if (contentType.startsWith(RestConst.MULTIPART) 
				|| MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
			return true;
		}
		return false;
	}
1188343
public static boolean isMultipartContent(HttpServletRequest request) {
		if (!"post".equals(request.getMethod().toLowerCase())) {
			return false;
		}

		String contentType = request.getContentType();
		if (contentType == null) {
			return false;
		}
		if (contentType.toLowerCase().startsWith(MULTIPART)) {
			return true;
		}

		return false;
	}
341942
public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain)
	throws IOException, ServletException
    {
        String path=((HttpServletRequest)request).getServletPath();
        if (welcome!=null && path.endsWith("/"))
            request.getRequestDispatcher(path+welcome).forward(request,response);
        else
            chain.doFilter(request, response);
    }
436764
private boolean checkAndRespond(Request request) {
        if (!URIBean.checkUri(request.getUrl())) {
            ServerResponseBean responseBean = new ServerResponseBean();
            responseBean.setMsgId(request.getMsgId());
            responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON);
            responseBean.setResponseBody(UnitResponse.createError(Group.CODE_BAD_REQUEST, null, String.format("URI %s is illegal.", request.getUrl()))
                    .toVoJSONString());
            IServerResponder.singleton.response(responseBean);
            return false;
        }
        return true;
    }
129353
private void handleItemImageRequest(final Request request) {

		// Check for tree item id
		String itemId = request.getParameter(ITEM_REQUEST_KEY);
		if (itemId == null) {
			throw new SystemException("No tree item id provided for image request.");
		}

		// Check valid item id
		if (!isValidTreeItem(itemId)) {
			throw new SystemException("Tree item id for an image request [" + itemId + "] is not valid.");
		}

		List<Integer> index = getExpandedItemIdIndexMap().get(itemId);
		TreeItemImage image = getTreeModel().getItemImage(index);
		if (image == null) {
			throw new SystemException("Tree item id [" + itemId + "] does not have an image.");
		}

		ContentEscape escape = new ContentEscape(image.getImage());
		throw escape;
	}
819298
def _is_request_in_exclude_path(self, request):
        """"""
        if self._exclude_paths:
            for path in self._exclude_paths:
                if request.path.startswith(path):
                    return True
            return False
        else:
            return False
1087378
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		// Check if window in request
		boolean targeted = isPresent(request);
		setTargeted(targeted);

		if (getState() == ACTIVE_STATE && isTargeted()) {
			getComponentModel().wrappedContent.serviceRequest(request);
		}
	}
433041
public void checkContentType(final HttpServletRequest request) {
    String reqpar = request.getParameter(getContentTypeRequestName());

    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(false);
      }
    }

    reqpar = request.getParameter(getContentTypeStickyRequestName());
    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(true);
      }
    }
  }
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);
  }
1025691
public void filter(ClientRequestContext request) throws IOException
    {
        if(!request.getHeaders().containsKey("X-Api-Key"))
            request.getHeaders().add("X-Api-Key", this.apikey);
    }
853417
protected void doHandleTargetedRequest(final Request request) {

		// Check for file id
		String fileId = request.getParameter(FILE_UPLOAD_ID_KEY);
		if (fileId == null) {
			throw new SystemException("No file id provided for content request.");
		}

		// Check valid file id
		FileWidgetUpload file = getFile(fileId);
		if (file == null) {
			throw new SystemException("Invalid file id [" + fileId + "].");
		}

		// Check if thumb nail requested
		boolean thumbNail = request.getParameter(FILE_UPLOAD_THUMB_NAIL_KEY) != null;
		if (thumbNail) {
			doHandleThumbnailRequest(file);
		} else {
			doHandleFileContentRequest(file);
		}
	}
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;
    }
504756
public static boolean isAllowed(ServletContext servletContext, ServletRequest request) {
		return
			Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM))
			&& isAllowedAddr(request.getRemoteAddr())
		;
	}