Is the request to create an indirect or direct container.

@param request The current request
@return whether we are acting on/creating an indirect/direct container.
179162
private boolean isPayloadIndirectOrDirect(final HttpServletRequest request) {
        return Collections.list(request.getHeaders("Link")).stream().map(Link::valueOf).map(Link::getUri)
                .anyMatch(l -> directOrIndirect.contains(l));
    }
659946
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		if (isMenuPresent(request)) {
			// If current ajax trigger, process menu for current selections
			if (AjaxHelper.isCurrentAjaxTrigger(this)) {
				WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
				menu.handleRequest(request);

				// Execute associated action, if set
				final Action action = getAction();

				if (action != null) {
					final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
							this.getActionObject());

					Runnable later = new Runnable() {
						@Override
						public void run() {
							action.execute(event);
						}
					};

					invokeLater(later);
				}
			}

			boolean openState = "true".equals(request.getParameter(getId() + ".open"));
			setOpen(openState);
		}
	}
709764
public <R extends Request<T>, T> R add(R request) {
        //Listener factories should be first so client can listen to events
        for (ListenerFactory listenerFactory : listenerFactories) {
            RequestListener.ResponseListener qResponseListener = listenerFactory
                    .getResponseListener(request);
            RequestListener.ErrorListener qErrorListener = listenerFactory.getErrorListener
                    (request);
            RequestListener.MarkerListener qMarkerListener = listenerFactory.getMarkerListener
                    (request);

            if (qMarkerListener != null) {
                request.addMarkerListener(qMarkerListener);
            }
            if (qResponseListener != null) {
                request.addResponseListener(qResponseListener);
            }
            if (qErrorListener != null) {
                request.addErrorListener(qErrorListener);
            }
        }
        if (JusLog.ErrorLog.isOn()) {
            request.addErrorListener(JusLog.ErrorLog.getLogger(request));
        }

        if (JusLog.ResponseLog.isOn()) {
            request.addResponseListener(JusLog.ResponseLog.getLogger(request));
        }

        if (JusLog.MarkerLog.isOn()) {
            request.addMarkerListener(JusLog.MarkerLog.getLogger(request));
        }
        request.addMarker(Request.EVENT_PRE_ADD_TO_QUEUE);
        Authenticator serverAuthenticator = null;
        Authenticator proxyAuthenticator = null;
        for (Authenticator.Factory factory : authenticatorFactories) {

            if (serverAuthenticator == null) {
                serverAuthenticator = factory.forServer(request.getUrl(), request
                        .getNetworkRequest());
                if (serverAuthenticator != null)
                    request.setServerAuthenticator(serverAuthenticator);
            }

            if (proxyAuthenticator == null) {
                proxyAuthenticator = factory.forProxy(request.getUrl(), request.getNetworkRequest
                        ());
                if (proxyAuthenticator != null)
                    request.setProxyAuthenticator(proxyAuthenticator);
            }

            if (proxyAuthenticator != null && serverAuthenticator != null) {
                break;
            }

        }

        for (Transformer.RequestTransformer transformer : requestTransformers) {
            if (transformer.filter == null || transformer.filter.apply(request)) {
                request.setNetworkRequest(transformer.transform(request.getNetworkRequest()));
            }
        }

        if (retryPolicyFactory != null) {
            request.setRetryPolicy(retryPolicyFactory.get(request));
        }
        if (redirectPolicyFactory != null) {
            request.setRedirectPolicy(redirectPolicyFactory.get(request));
        }

        if (connectivityManagerFactory != null) {
            request.setConnectivityManager(connectivityManagerFactory.get(request));
        }
        if (noConnectionPolicyFactory != null) {
            request.setNoConnectionPolicy(noConnectionPolicyFactory.get(request));
        }

        synchronized (currentRequests) {
            //check if not already cancelled
            if (request.isCanceled()) {
                request.finish(Request.EVENT_ADD_DISCARD_CANCELED);
            }
            // Process requests in the order they are added.
            request.setSequence(getSequenceNumber());
            // Tag the request as belonging to this queue and add it to the set of current requests.
            request.setRequestQueue(this);
            currentRequests.add(request);
        }
        request.addMarker(Request.EVENT_ADD_TO_QUEUE);

        // If the request is uncacheable, skip the cache queue and go straight to the network.
        if (!request.shouldCache()) {
            networkQueue.add(request);
            return request;
        }

        // Insert request into stage if there's already a request with the same cache key in flight.
        synchronized (waitingRequests) {
            String cacheKey = request.getCacheKey();
            if (waitingRequests.containsKey(cacheKey)) {
                // There is already a request in flight. Queue up.
                Queue<Request<?>> stagedRequests = waitingRequests.get(cacheKey);
                if (stagedRequests == null) {
                    stagedRequests = new LinkedList<>();
                }
                stagedRequests.add(request);
                waitingRequests.put(cacheKey, stagedRequests);
//                if (JusLog.DEBUG) {
//                    JusLog.v("Request for cacheKey=%s is in flight, putting on hold.", cacheKey);
//                }
                //todo add queue markers
            } else {
                // Insert 'empty list' queue for this cacheKey, indicating there is now a request in
                // flight.
                waitingRequests.put(cacheKey, new LinkedList<Request<?>>());
                cacheQueue.add(request);
            }
            return request;
        }
    }
964241
protected boolean isMenuPresent(final Request request) {
		WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);

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

		return false;
	}
1252465
protected boolean isAzureAppService(HttpServletRequest request)
	{
		if (_isAzureAppService != null)
			return _isAzureAppService.booleanValue();

		_isAzureAppService = (SystemUtils.IS_OS_WINDOWS && System.getenv("WEBSITE_SITE_NAME") != null);

		return _isAzureAppService.booleanValue();
	}
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();
		}
	}
493283
@Override
  public boolean service(RequestBaratine request)
  {
    request.status(HttpStatus.NOT_FOUND);
    
    request.write("Not found: " + request.uri() + "\n");
    request.ok();
    
    return true;
  }
595633
public boolean actionModifyAce(HttpServletRequest request) {

        String file = getParamResource();

        // get request parameters
        String name = getParamName();
        String type = getParamType();
        String inherit = request.getParameter(PARAM_INHERIT);
        String overWriteInherited = request.getParameter(PARAM_OVERWRITEINHERITED);
        String responsible = request.getParameter(PARAM_RESPONSIBLE);

        // get the new permissions
        Set<String> permissionKeys = CmsPermissionSet.getPermissionKeys();
        int allowValue = 0;
        int denyValue = 0;
        String key, param;
        int value, paramInt;

        Iterator<String> i = permissionKeys.iterator();
        // loop through all possible permissions
        while (i.hasNext()) {
            key = i.next();
            value = CmsPermissionSet.getPermissionValue(key);
            // set the right allowed and denied permissions from request parameters
            try {
                param = request.getParameter(value + PERMISSION_ALLOW);
                paramInt = Integer.parseInt(param);
                allowValue |= paramInt;
            } catch (Exception e) {
                // can usually be ignored
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
            }
            try {
                param = request.getParameter(value + PERMISSION_DENY);
                paramInt = Integer.parseInt(param);
                denyValue |= paramInt;
            } catch (Exception e) {
                // can usually be ignored
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
            }
        }

        // get the current Ace to get the current ace flags
        try {
            List<CmsAccessControlEntry> allEntries = getCms().getAccessControlEntries(file, false);
            int flags = 0;
            for (int k = 0; k < allEntries.size(); k++) {
                CmsAccessControlEntry curEntry = allEntries.get(k);
                String curType = getEntryType(curEntry.getFlags(), false);
                I_CmsPrincipal p;
                try {
                    p = CmsPrincipal.readPrincipalIncludingHistory(getCms(), curEntry.getPrincipal());
                } catch (CmsException e) {
                    p = null;
                }
                if (((p != null) && p.getName().equals(name) && curType.equals(type))) {
                    flags = curEntry.getFlags();
                    break;
                } else if (p == null) {
                    // check if it is the case of a role
                    CmsRole role = CmsRole.valueOfId(curEntry.getPrincipal());
                    if ((role != null) && name.equals(role.getRoleName())) {
                        flags = curEntry.getFlags();
                        break;
                    } else if ((curEntry.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID)
                        && name.equals(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME))
                        || (curEntry.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)
                            && name.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME))) {
                        flags = curEntry.getFlags();
                        break;
                    }
                }
            }

            // modify the ace flags to determine inheritance of the current ace
            if (Boolean.valueOf(inherit).booleanValue()) {
                flags |= CmsAccessControlEntry.ACCESS_FLAGS_INHERIT;
            } else {
                flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_INHERIT;
            }

            // modify the ace flags to determine overwriting of inherited ace
            if (Boolean.valueOf(overWriteInherited).booleanValue()) {
                flags |= CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE;
            } else {
                flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE;
            }

            if (Boolean.valueOf(responsible).booleanValue()) {
                flags |= CmsAccessControlEntry.ACCESS_FLAGS_RESPONSIBLE;
            } else {
                flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_RESPONSIBLE;
            }

            // lock resource if autolock is enabled
            checkLock(getParamResource());
            // try to change the access entry
            if (name.equals(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID.toString())) {
                getCms().chacc(
                    file,
                    type,
                    CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME,
                    allowValue,
                    denyValue,
                    flags);
            } else if (name.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID.toString())) {
                getCms().chacc(
                    file,
                    type,
                    CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME,
                    allowValue,
                    denyValue,
                    flags);
            } else {
                getCms().chacc(file, type, name, allowValue, denyValue, flags);
            }
            return true;
        } catch (CmsException e) {
            m_errorMessages.add(key(Messages.ERR_CHACC_MODIFY_ENTRY_0));
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
            return false;
        }
    }
1001617
public boolean requestShouldBeHandledByTAI(HttpServletRequest request, SocialTaiRequest socialTaiRequest) {
        // 241526 don't process jmx requests with this interceptor
        if (isJmxConnectorRequest(request)) {
            return false;
        }
        String loginHint = webUtils.getLoginHint(request);
        socialTaiRequest = setSocialTaiRequestConfigInfo(request, loginHint, socialTaiRequest);
        return socialTaiRequest.hasServices();
    }
130295
public static boolean isStatic(final HttpServletRequest request) {
        final boolean requestStaticResourceChecked = null == request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED)
                ? false
                : (Boolean) request.getAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED);

        if (requestStaticResourceChecked) {
            return (Boolean) request.getAttribute(Keys.HttpRequest.IS_REQUEST_STATIC_RESOURCE);
        }

        if (!inited) {
            init();
        }

        request.setAttribute(Keys.HttpRequest.REQUEST_STATIC_RESOURCE_CHECKED, true);
        request.setAttribute(Keys.HttpRequest.IS_REQUEST_STATIC_RESOURCE, false);

        final String requestURI = request.getRequestURI();

        for (final String pattern : STATIC_RESOURCE_PATHS) {
            if (AntPathMatcher.match(Latkes.getContextPath() + pattern, requestURI)) {
                request.setAttribute(Keys.HttpRequest.IS_REQUEST_STATIC_RESOURCE, true);
                return true;
            }
        }

        return false;
    }
977663
private void addPostParams(final Request request) {
        if (identifier != null) {
            request.addPostParam("Identifier", identifier);
        }

        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (proxyIdentifier != null) {
            request.addPostParam("ProxyIdentifier", proxyIdentifier);
        }

        if (proxyIdentifierSid != null) {
            request.addPostParam("ProxyIdentifierSid", proxyIdentifierSid);
        }
    }
890551
public static void storeRequestURI(final HttpServletRequest request) {
		request.getSession(true).setAttribute(STORE_URI_KEY, request.getRequestURI());
	}
577109
public static boolean isSslRequest(HttpServletRequest request) {

		String scheme = request.getScheme();
		return JawrConstant.HTTPS.equals(scheme);
	}
928472
@Override
	public void handleRequest(final Request request) {
		if (!isInitialised()) {
			getOrCreateComponentModel().delegate = new SafetyContainerDelegate(UIContextHolder.
					getCurrent());
			setInitialised(true);
		}

		try {
			UIContext delegate = getComponentModel().delegate;
			UIContextHolder.pushContext(delegate);

			try {
				for (int i = 0; i < shim.getChildCount(); i++) {
					shim.getChildAt(i).serviceRequest(request);
				}

				delegate.doInvokeLaters();
			} finally {
				UIContextHolder.popContext();
			}
		} catch (final ActionEscape e) {
			// We don't want to catch ActionEscapes (e.g. ForwardExceptions)
			throw e;
		} catch (final Exception e) {
			if (isAjaxOrTargetedRequest(request)) {
				throw new SystemException(e.getMessage(), e);
			} else {
				setAttribute(ERROR_KEY, e);
			}
		}
	}
678360
boolean isRootRequest(HttpServletRequest request) {
        String path = request.getPathInfo();
        if (StringUtils.isBlank(path)) {
            return true;
        } else if (StringUtils.equals("/", path)) {
            return true;
        }
        return false;
    }
462441
public static boolean isStepOnRequest(final Request request) {
		String val = request.getParameter(Environment.STEP_VARIABLE);
		return val != null;
	}
602254
public static Tag method(ContainerRequest request) {
        return (request != null) ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN;
    }