Determine if this WMenuItem's parent WMenu is on the Request.

@param request the request being responded to.
@return true if this WMenuItem's WMenu is on the Request, otherwise return false.
964241
protected boolean isMenuPresent(final Request request) {
		WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);

		if (menu != null) {
			return menu.isPresent(request);
		}

		return false;
	}
487505
private function checkRequest(ServerRequestInterface $request): bool
    {
        if ($request->getParsedBody() && !$this->override) {
            return false;
        }

        if (!in_array($request->getMethod(), $this->methods, true)) {
            return false;
        }

        $contentType = $request->getHeaderLine('Content-Type');

        foreach ($this->contentType as $allowedType) {
            if (stripos($contentType, $allowedType) === 0) {
                return true;
            }
        }

        return false;
    }
278139
@Override
  public boolean service(RequestBaratine request)
  {
    /*
    try {
      _service.open((WebRequest) request);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
    */

    ServiceWebSocket<T, S> service = _factory.apply(request);

    WebSocketManager wsManager = request.webApp().wsManager();
    WebSocketBaratineImpl<T,S> ws
      = new WebSocketBaratineImpl<>(wsManager, service, _type);
    
    try {
      if (ws.handshake(request)) {
        return true;
      }
      else {
        log.fine("WebSocket handshake failed for " + request);
        return false;
      }
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
      e.printStackTrace();
      
      request.fail(e);
      
      return true;
    }
    //request.flush();
  }
834275
def _can_access_request(self):
        
        if self.parent:
            return False

        if not hasattr(self, "context") or not self.context.get("request", None):
            return False

        return self.context["request"].method == "GET"
889430
public static boolean isIE(HttpServletRequest request) {
		String userAgent = getHeaderIgnoreCase(request, "User-Agent");
		if (StrUtil.isNotBlank(userAgent)) {
			userAgent = userAgent.toUpperCase();
			if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
				return true;
			}
		}
		return false;
	}
733825
private void findSelections(final Request request, final MenuSelectContainer selectContainer,
			final List<MenuItemSelectable> selections) {

		// Don't bother checking disabled or invisible containers
		if (!selectContainer.isVisible()
				|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).isDisabled())) {
			return;
		}

		// Get any selectable children of this container
		List<MenuItemSelectable> selectableItems = getSelectableItems(selectContainer);

		// Now add the selections (if in the request)
		for (MenuItemSelectable selectableItem : selectableItems) {
			// Check if the item is on the request
			if (request.getParameter(selectableItem.getId() + ".selected") != null) {
				selections.add(selectableItem);
				if (SelectionMode.SINGLE.equals(selectContainer.getSelectionMode())) {
					// Only select the first item at this level.
					// We still need to check other levels of the menu for selection.
					break;
				}
			}
		}

		// We need to recurse through and check for other selectable containers
		for (MenuItem item : selectContainer.getMenuItems()) {
			if (item instanceof MenuItemGroup) {
				for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
					if (groupItem instanceof MenuSelectContainer) {
						findSelections(request, (MenuSelectContainer) groupItem, selections);
					}
				}
			} else if (item instanceof MenuSelectContainer) {
				findSelections(request, (MenuSelectContainer) item, selections);
			}
		}
	}
1134217
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		if (isPresent(request)) {
			List<MenuItemSelectable> selectedItems = new ArrayList<>();
			// Unfortunately, we need to recurse through all the menu/sub-menus
			findSelections(request, this, selectedItems);
			setSelectedMenuItems(selectedItems);
		}
	}
820277
@Override
	public void serviceRequest(final Request request) {
		// Only apply for POST
		if ("POST".equals(request.getMethod())) {
			// Apply Controls (Use values on request)
			SubordinateControlHelper.applyRegisteredControls(request, true);
		}

		// Service Request
		super.serviceRequest(request);
	}
933934
@Override
  public boolean isSecure(HttpServletRequest request) {
    String proto = request.getHeader(X_FORWARED_PROTO);
    if( proto != null ) return proto.equalsIgnoreCase(HTTPS_PROTOCOL);
    return super.isSecure(request);
  }
215267
function onWsRequest(request) {
  if (-1 == request.requestedProtocols.indexOf(ragentsServer.wsProtocol)) {
    return request.reject()
  }

  request.accept(ragentsServer.wsProtocol, request.origin)
}
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);
      }
    }
  }
60996
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			setInitialised(true);
			setTreeModel(new MenuTreeModel(data));
		}
	}
486098
public static boolean isSourceMapsEnabled(HttpServletRequest request) {
		IAggregator aggr = (IAggregator)request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME);
		IOptions options = aggr.getOptions();
		boolean result = false;
		if (options.isSourceMapsEnabled()) {
			result = TypeUtil.asBoolean(request.getAttribute(IHttpTransport.GENERATESOURCEMAPS_REQATTRNAME));
		}
		return result;
	}
670254
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		WComponent visibleDialog = getVisible();

		if (visibleDialog != null) {
			visibleDialog.serviceRequest(request);
		}
	}
1082478
@Override
    public boolean isWsocRequest(ServletRequest request) throws ServletException {
        ServletContext context = request.getServletContext();
        Object wsocContainer = null;
        if (context != null) {
            wsocContainer = context.getAttribute(WebSocketContainerManager.SERVER_CONTAINER_ATTRIBUTE);
        }

        if (wsocContainer != null) {
            //check if this is a IBM's implementation of WebSocketContainer. If this is a tomcat or some other server's WebSocket
            //implementation of WebSocketContainer then, this is not a valid WebSocket request for us and Web Container should not call
            //WsocHandler.handleRequest() subsequently.
            if (!isValidContainer(wsocContainer)) {
                return false;
            }
        } else { //not a WebSocket request if ServerContainer attribute is missing.
            return false;
        }

        //call setNoMoreAddEndPoints only once per webapp
        if (!noMoreAddsCalled) {
            ((ServerContainerExt) wsocContainer).setNoMoreAddEndpointsAllowed();
            noMoreAddsCalled = true;
        }

        return checkWebSocketRequest(request, wsocContainer);
    }
960119
private boolean isVisibleForSite(final HttpServletRequest request, final Page page) {

		final Site site = page.getSite();
		if (site == null) {

			return true;
		}

		final String serverName = request.getServerName();
		final int serverPort    = request.getServerPort();

		if (StringUtils.isNotBlank(serverName) && !serverName.equals(site.getHostname())) {
			return false;
		}

		final Integer sitePort = site.getPort();

		if (sitePort != null && serverPort != sitePort) {
			return false;
		}

		return true;

	}
380800
public void removeMenuItem(SubMenuItem parent, MenuItem item) {
        SubMenuItem subMenu = (parent != null) ? parent : ROOT;

        synchronized (subMenuItems) {
            ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu);
            if (subMenuChildren == null) {
                throw new UnsupportedOperationException("Menu element not found");
            }

            subMenuChildren.remove(item);
            if (item.hasChildren()) {
                subMenuItems.remove(item);
            }
        }
        menuStates.remove(item.getId());
    }