Get top http referer statistics with specified attributes.

@param request The request containing all the options related to the statistics.
@return Details of statistics
428190
public GetStatTopRefererResponse getStatTopReferer(GetStatTopRefererRequest request) {
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, STAT, "topn", "referer");
        
        if (request.getStartTime() != null) {
            internalRequest.addParameter("startTime", DateUtils.formatAlternateIso8601Date(request.getStartTime()));
        }
        
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", DateUtils.formatAlternateIso8601Date(request.getEndTime()));
        }
        
        if (request.getDomain() != null) {
            internalRequest.addParameter("domain", request.getDomain());
        }
        
        if (request.getPeriod() != null) {
            internalRequest.addParameter("period", String.valueOf(request.getPeriod()));
        }
        
        return this.invokeHttpClient(internalRequest, GetStatTopRefererResponse.class);
    }
469603
@SuppressWarnings("unchecked")
	static public Map<String, Object> getParameters(ServletRequest request){
    	Map<String, Object> params = (Map<String, Object>) request.getAttribute(TEMPLATE_PARAMETER_MAP);
    	if (params == null){							// no need to check thread-safe?
    		params = new HashMap<String, Object>();
    		request.setAttribute(TEMPLATE_PARAMETER_MAP, params);
    	}
    	return params;
    }
567546
public String getSelectedProfile(PortletRequest request) {

        // if a profile selection exists in the session, use it
        final PortletSession session = request.getPortletSession();
        String profileName =
                (String)
                        session.getAttribute(
                                SessionAttributeProfileMapperImpl.DEFAULT_SESSION_ATTRIBUTE_NAME,
                                PortletSession.APPLICATION_SCOPE);

        // otherwise, set the selected profile to the one currently in use by
        // the user
        if (profileName == null) {
            // get the profile for the current request
            final HttpServletRequest httpServletRequest =
                    portalRequestUtils.getPortletHttpRequest(request);
            final IUserInstance ui = userInstanceManager.getUserInstance(httpServletRequest);
            final IUserProfile profile = ui.getPreferencesManager().getUserProfile();

            // check to see if the profile's fname matches one of the entries in
            // the profile key map used by the session attribute profile mapper
            for (Map.Entry<String, String> entry : mappings.entrySet()) {
                if (entry.getValue().equals(profile.getProfileFname())) {
                    profileName = entry.getKey();
                    break;
                }
            }
        }

        return profileName;
    }
1058852
public static boolean isHttpGetRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isGet = isSane && request.getMethod().equals(HttpMethod.GET.toString());
        return isSane && isGet;
    }
521171
protected Set<String> getParameters(HttpServletRequest request) {
        Set<String> parameters = new HashSet<String>();
        Enumeration<?> paramNames = request.getParameterNames();
        while (paramNames.hasMoreElements()) {
            String parameter = (String) paramNames.nextElement();
            // Keep only first property.
            while (parameter.contains(".") || parameter.contains("[")) {
                if (parameter.contains(".")) {
                    parameter = parameter.substring(0, parameter.indexOf("."));
                }
                if (parameter.contains("[")) {
                    parameter = parameter.substring(0, parameter.indexOf("["));
                }
            }
            parameters.add(parameter);
        }
        return parameters;
    }
162779
public GetDomainStatisticsResponse getDomainStatistics(GetDomainStatisticsRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS,
                LIVE_DOMAIN, request.getDomain());
        if (request.getStartDate() != null) {
            internalRequest.addParameter("startDate", request.getStartDate());
        }
        if (request.getEndDate() != null) {
            internalRequest.addParameter("endDate", request.getEndDate());
        }
        if (request.getAggregate() != null) {
            internalRequest.addParameter("aggregate", request.getAggregate().toString());
        }
        return invokeHttpClient(internalRequest, GetDomainStatisticsResponse.class);
    }
182645
public JobResult jobResult(HttpRequestBase request) {
        JobResult jobResult = new JobResult();
        try {
            HttpResponse response = httpClient.execute(request);
            if (response != null) {
                jobResult.responseCode = response.getStatusLine().getStatusCode();
                HttpEntity responseEntity = response.getEntity();
                long contentLength = responseEntity.getContentLength();
                if (contentLength < 0) {
                    contentLength = 0;
                }
                ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
                InputStream in = responseEntity.getContent();
                int read;
                byte[] tmpBuf = new byte[8192];
                while ((read = in.read(tmpBuf)) != -1) {
                    bOut.write(tmpBuf, 0, read);
                }
                in.close();
                bOut.close();
                jobResult.response = bOut.toByteArray();
                switch (jobResult.responseCode) {
                case 200:
                    jobResult.parse(xmlValidator);
                    in = new ByteArrayInputStream(jobResult.response);
                    jobResult.job = Job.unmarshall(in);
                    in.close();
                    jobResult.status = ResultStatus.OK;
                    break;
                case 404:
                    jobResult.status = ResultStatus.NOT_FOUND;
                    break;
                case 500:
                    jobResult.status = ResultStatus.INTERNAL_ERROR;
                    break;
                default:
                    jobResult.status = ResultStatus.NO_RESPONSE;
                    break;
                }
            } else {
                jobResult.status = ResultStatus.NO_RESPONSE;
            }
        } catch (NoHttpResponseException e) {
            jobResult.status = ResultStatus.OFFLINE;
            jobResult.t = e;
        } catch (ClientProtocolException e) {
            jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
            jobResult.t = e;
        } catch (IOException e) {
            jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
            jobResult.t = e;
        } catch (JAXBException e) {
            jobResult.status = ResultStatus.JAXB_EXCEPTION;
            jobResult.t = e;
        } catch (XMLStreamException e) {
            jobResult.status = ResultStatus.XML_EXCEPTION;
            jobResult.t = e;
        }
        return jobResult;
    }
721315
function(request) {
  var options = {};

  if (request.getQueryParameters()) {
    options.query = request.getQueryParameters();
  }

  if (
    request.getHeaders() &&
    request.getHeaders()['Content-Type'] === 'application/json'
  ) {
    options.data = JSON.stringify(request.getBodyParameters());
  } else if (request.getBodyParameters()) {
    options.data = request.getBodyParameters();
  }

  if (request.getHeaders()) {
    options.headers = request.getHeaders();
  }
  return options;
}
1289181
public static Map<String, String[]> getParameterMap(final Request request)
	{
		final Map<String, String[]> map = new HashMap<>();
		addParameters(request.getRequestParameters(), map);
		addParameters(request.getQueryParameters(), map);
		addParameters(request.getPostParameters(), map);
		return map;
	}
319208
protected StringBuffer getHeaderSection(HttpServletRequest request){
	
		StringBuffer sb = super.getHeaderSection(request);
		if(null != this.config.getDwrMapping()){
			sb.append(DWRParamWriter.buildDWRJSParams(request.getContextPath(),PathNormalizer.joinPaths(request.getContextPath(),  
																						 			this.config.getDwrMapping())));
			sb.append("if(!window.DWR)window.DWR={};\nDWR.loader = JAWR.loader;\n");
		}
		return sb;
	}
346796
protected String statBase(final AbstractStatRequest request) throws AbstractCosException {
		request.check_param();

		String url = buildUrl(request);
		long signExpired = System.currentTimeMillis() / 1000 + this.config.getSignExpired();
		String sign = Sign.getPeriodEffectiveSign(request.getBucketName(),request.getCosPath(), this.cred, signExpired);

		HttpRequest httpRequest = new HttpRequest();
		httpRequest.setUrl(url);
		httpRequest.addHeader(RequestHeaderKey.Authorization, sign);
		httpRequest.addHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());
		httpRequest.addParam(RequestBodyKey.OP, RequestBodyValue.OP.STAT);
		httpRequest.setMethod(HttpMethod.GET);

		return httpClient.sendHttpRequest(httpRequest);
	}
1041913
public static String getRequestURI(final HttpServletRequest request) {
		return (String) request.getSession(true).getAttribute(STORE_URI_KEY);
	}
1333762
public static Map<String, String[]> getRequestParameters(final HttpServletRequest request) {
		if (request.getAttribute(REQUEST_PROCESSED_KEY) == null) {
			setupRequestParameters(request);
		}
		return (Map<String, String[]>) request.getAttribute(REQUEST_PARAMETERS_KEY);
	}
83866
public void extractHttpRequestInfo(HttpServletRequest httpRequest) {
		
		putUnlessNull(REQUEST_REFERER_URL, httpRequest.getHeader("REFERER"));
		
		String remoteAddr = httpRequest.getHeader("X-Forwarded-For");
		remoteAddr = (remoteAddr == null) ? 
			httpRequest.getRemoteAddr() :
			remoteAddr + ", " + httpRequest.getRemoteAddr();
		
		putUnlessNull(REQUEST_REMOTE_ADDRESS, remoteAddr);
		
		// Check for AJAX
		String x_req_with = httpRequest.getHeader("X-Requested-With");
		if (x_req_with != null) {
			if (x_req_with.equals("XMLHttpRequest")) {
				this.setAjaxRequest(true);
			}
		} else if (this.getRefererUrl() != null && httpRequest.getParameter("ajaxpipe") != null) {
			this.setAjaxRequest(true);
		}
		
		if (isMementoEnabled()) {
			// Check for Memento Accept-Datetime
			String acceptDateTime = httpRequest.getHeader(MementoUtils.ACCEPT_DATETIME);
			if (acceptDateTime != null) {
				this.setMementoAcceptDatetime(true);
			}
		}
		
		putUnlessNull(REQUEST_WAYBACK_HOSTNAME, httpRequest.getLocalName());
		putUnlessNull(REQUEST_AUTH_TYPE, httpRequest.getAuthType());
		putUnlessNull(REQUEST_REMOTE_USER, httpRequest.getRemoteUser());
		
		putUnlessNull(REQUEST_AUTHORIZATION,
				httpRequest.getHeader(REQUEST_AUTHORIZATION));
		putUnlessNull(REQUEST_WAYBACK_PORT, 
				String.valueOf(httpRequest.getLocalPort()));
		putUnlessNull(REQUEST_WAYBACK_CONTEXT, httpRequest.getContextPath());

		Locale l = null;
		if (accessPoint != null) {
			l = accessPoint.getLocale();
		}
		if (l == null) {
			l = httpRequest.getLocale();
		}
		//setLocale(l);
		this.locale = l;

		putUnlessNull(REQUEST_LOCALE_LANG,l.getDisplayLanguage());

		Cookie[] cookies = httpRequest.getCookies();
		if(cookies != null) {
			for(Cookie cookie : cookies) {
				String name = cookie.getName();
				String value = cookie.getValue();
				String oldVal = get(name);
				if(oldVal == null || oldVal.length() == 0) {
					put(name,value);
				}
			}
		}
	}
418956
@Override
    public IPortalRequestInfo getPortalRequestInfo(HttpServletRequest request) {
        request = this.portalRequestUtils.getOriginalPortalRequest(request);
        final IPortalRequestInfo cachedPortalRequestInfo =
                (IPortalRequestInfo) request.getAttribute(PORTAL_REQUEST_INFO_ATTR);
        if (cachedPortalRequestInfo != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("short-circuit: found portalRequestInfo within request attributes");
            }
            return cachedPortalRequestInfo;
        }

        synchronized (PortalWebUtils.getRequestAttributeMutex(request)) {
            // set a flag to say this request is currently being parsed
            final Boolean inProgressAttr =
                    (Boolean) request.getAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR);
            if (inProgressAttr != null && inProgressAttr) {
                if (logger.isDebugEnabled()) {
                    logger.warn("Portal request info parsing already in progress, returning null");
                }
                return null;
            }
            request.setAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR, Boolean.TRUE);
        }

        try {
            // Clone the parameter map so data can be removed from it as it is parsed to help
            // determine
            // what to do with non-namespaced parameters
            final Map<String, String[]> parameterMap = new ParameterMap(request.getParameterMap());

            final String requestPath = this.urlPathHelper.getPathWithinApplication(request);

            if (LEGACY_URL_PATHS.contains(requestPath)) {
                return parseLegacyPortalUrl(request, parameterMap);
            }

            final IUrlNodeSyntaxHelper urlNodeSyntaxHelper =
                    this.urlNodeSyntaxHelperRegistry.getCurrentUrlNodeSyntaxHelper(request);

            final PortalRequestInfoImpl portalRequestInfo = new PortalRequestInfoImpl();
            IPortletWindowId targetedPortletWindowId = null;
            PortletRequestInfoImpl targetedPortletRequestInfo = null;

            final String[] requestPathParts = SLASH_PATTERN.split(requestPath);

            UrlState requestedUrlState = null;
            ParseStep parseStep = ParseStep.FOLDER;
            for (int pathPartIndex = 0; pathPartIndex < requestPathParts.length; pathPartIndex++) {
                String pathPart = requestPathParts[pathPartIndex];

                logger.trace("In parseStep {} considering pathPart [{}].", parseStep, pathPart);

                if (StringUtils.isEmpty(pathPart)) {
                    continue;
                }

                switch (parseStep) {
                    case FOLDER:
                        {
                            parseStep = ParseStep.PORTLET;

                            if (FOLDER_PATH_PREFIX.equals(pathPart)) {

                                logger.trace(
                                        "Skipping adding {} to the folders deque "
                                                + "because it is simply the folder path prefix.",
                                        pathPart);

                                pathPartIndex++;

                                final LinkedList<String> folders = new LinkedList<String>();
                                for (; pathPartIndex < requestPathParts.length; pathPartIndex++) {
                                    pathPart = requestPathParts[pathPartIndex];

                                    if (PORTLET_PATH_PREFIX.equals(pathPart)) {
                                        logger.trace(
                                                "Found the portlet part of the path "
                                                        + "demarked by portlet path prefix [{}]; "
                                                        + "stepping back one path part to finish folder processing",
                                                pathPart);
                                        pathPartIndex--;
                                        break;
                                    } else {

                                        if (pathPart.endsWith(REQUEST_TYPE_SUFFIX)) {
                                            logger.trace(
                                                    "Found the end of the folder path with pathPart [{}];"
                                                            + " stepping back one, checking for state, "
                                                            + "and finishing folder parsing",
                                                    pathPart);
                                            pathPartIndex--;
                                            pathPart = requestPathParts[pathPartIndex];

                                            // If a state was added to the folder list remove it and
                                            // step back one so
                                            // other code can handle it
                                            if (UrlState.valueOfIngoreCase(pathPart, null)
                                                    != null) {
                                                logger.trace(
                                                        "A state was added to the end of folder list {};"
                                                                + " removing it.",
                                                        folders);
                                                folders.removeLast();
                                                pathPartIndex--;
                                            }
                                            break;
                                        }
                                    }

                                    logger.trace("Adding pathPart [{}] to folders.", pathPart);
                                    folders.add(pathPart);
                                }

                                logger.trace("Folders is [{}]", folders);
                                if (folders.size() > 0) {
                                    final String targetedLayoutNodeId =
                                            urlNodeSyntaxHelper.getLayoutNodeForFolderNames(
                                                    request, folders);
                                    portalRequestInfo.setTargetedLayoutNodeId(targetedLayoutNodeId);
                                }
                                break;
                            }
                        }
                        // fall through
                    case PORTLET:
                        {
                            parseStep = ParseStep.STATE;

                            final String targetedLayoutNodeId =
                                    portalRequestInfo.getTargetedLayoutNodeId();

                            if (PORTLET_PATH_PREFIX.equals(pathPart)) {
                                if (++pathPartIndex < requestPathParts.length) {
                                    pathPart = requestPathParts[pathPartIndex];

                                    targetedPortletWindowId =
                                            urlNodeSyntaxHelper.getPortletForFolderName(
                                                    request, targetedLayoutNodeId, pathPart);
                                }

                                break;
                            }

                            // See if a portlet was targeted by parameter
                            final String[] targetedPortletIds =
                                    parameterMap.remove(PARAM_TARGET_PORTLET);
                            if (targetedPortletIds != null && targetedPortletIds.length > 0) {
                                final String targetedPortletString = targetedPortletIds[0];
                                targetedPortletWindowId =
                                        urlNodeSyntaxHelper.getPortletForFolderName(
                                                request,
                                                targetedLayoutNodeId,
                                                targetedPortletString);
                            }
                        }
                        // fall through
                    case STATE:
                        {
                            parseStep = ParseStep.TYPE;

                            // States other than the default only make sense if a portlet is being
                            // targeted
                            if (targetedPortletWindowId == null) {
                                break;
                            }

                            requestedUrlState = UrlState.valueOfIngoreCase(pathPart, null);

                            // Set the URL state
                            if (requestedUrlState != null) {
                                portalRequestInfo.setUrlState(requestedUrlState);

                                // If the request is stateless
                                if (statelessUrlStates.contains(requestedUrlState)) {
                                    final IPortletWindow statelessPortletWindow =
                                            this.portletWindowRegistry
                                                    .getOrCreateStatelessPortletWindow(
                                                            request, targetedPortletWindowId);
                                    targetedPortletWindowId =
                                            statelessPortletWindow.getPortletWindowId();
                                }

                                // Create the portlet request info
                                targetedPortletRequestInfo =
                                        portalRequestInfo.getPortletRequestInfo(
                                                targetedPortletWindowId);
                                portalRequestInfo.setTargetedPortletWindowId(
                                        targetedPortletWindowId);

                                // Set window state based on URL State first then look for the
                                // window state parameter
                                switch (requestedUrlState) {
                                    case MAX:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    WindowState.MAXIMIZED);
                                        }
                                        break;

                                    case DETACHED:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    IPortletRenderer.DETACHED);
                                        }
                                        break;

                                    case EXCLUSIVE:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    IPortletRenderer.EXCLUSIVE);
                                        }
                                        break;

                                    default:
                                        // Nothing to do -- some cases don't need treatment
                                }

                                break;
                            }
                        }
                        // fall through
                    case TYPE:
                        {
                            parseStep = ParseStep.COMPLETE;

                            if (pathPartIndex == requestPathParts.length - 1
                                    && pathPart.endsWith(REQUEST_TYPE_SUFFIX)
                                    && pathPart.length() > REQUEST_TYPE_SUFFIX.length()) {
                                final String urlTypePart =
                                        pathPart.substring(
                                                0,
                                                pathPart.length() - REQUEST_TYPE_SUFFIX.length());
                                final UrlType urlType;

                                // Handle inline resourceIds, look for a . in the request type
                                // string and use the suffix as the urlType
                                final int lastPeriod = urlTypePart.lastIndexOf('.');
                                if (lastPeriod >= 0 && lastPeriod < urlTypePart.length()) {
                                    final String urlTypePartSuffix =
                                            urlTypePart.substring(lastPeriod + 1);
                                    urlType = UrlType.valueOfIngoreCase(urlTypePartSuffix, null);
                                    if (urlType == UrlType.RESOURCE
                                            && targetedPortletRequestInfo != null) {
                                        final String resourceId =
                                                urlTypePart.substring(0, lastPeriod);
                                        targetedPortletRequestInfo.setResourceId(resourceId);
                                    }
                                } else {
                                    urlType = UrlType.valueOfIngoreCase(urlTypePart, null);
                                }

                                if (urlType != null) {
                                    portalRequestInfo.setUrlType(urlType);
                                    break;
                                }
                            }
                        }
                        // fall through
                    default:
                        // Nothing to do -- some cases don't need treatment
                }
            }

            // If a targeted portlet window ID is found but no targeted portlet request info has
            // been retrieved yet, set it up
            if (targetedPortletWindowId != null && targetedPortletRequestInfo == null) {
                targetedPortletRequestInfo =
                        portalRequestInfo.getPortletRequestInfo(targetedPortletWindowId);
                portalRequestInfo.setTargetedPortletWindowId(targetedPortletWindowId);
            }

            // Get the set of portlet window ids that also have parameters on the url
            final String[] additionalPortletIdArray = parameterMap.remove(PARAM_ADDITIONAL_PORTLET);
            final Set<String> additionalPortletIds =
                    Sets.newHashSet(
                            additionalPortletIdArray != null
                                    ? additionalPortletIdArray
                                    : new String[0]);

            // Used if there is delegation to capture form-submit and other non-prefixed parameters
            // Map of parent id to delegate id
            final Map<IPortletWindowId, IPortletWindowId> delegateIdMappings =
                    new LinkedHashMap<IPortletWindowId, IPortletWindowId>(0);

            // Parse all remaining parameters from the request
            final Set<Entry<String, String[]>> parameterEntrySet = parameterMap.entrySet();
            for (final Iterator<Entry<String, String[]>> parameterEntryItr =
                            parameterEntrySet.iterator();
                    parameterEntryItr.hasNext(); ) {
                final Entry<String, String[]> parameterEntry = parameterEntryItr.next();

                final String name = parameterEntry.getKey();
                final List<String> values = Arrays.asList(parameterEntry.getValue());

                /* NOTE: continues are being used to allow fall-through behavior like a switch statement would provide */

                // Portal Parameters, just need to remove the prefix
                if (name.startsWith(PORTAL_PARAM_PREFIX)) {
                    final Map<String, List<String>> portalParameters =
                            portalRequestInfo.getPortalParameters();
                    portalParameters.put(
                            this.safeSubstringAfter(PORTAL_PARAM_PREFIX, name), values);
                    parameterEntryItr.remove();
                    continue;
                }

                // Generic portlet parameters, have to remove the prefix and see if there was a
                // portlet windowId between the prefix and parameter name
                if (name.startsWith(PORTLET_PARAM_PREFIX)) {
                    final Tuple<String, IPortletWindowId> portletParameterParts =
                            this.parsePortletParameterName(request, name, additionalPortletIds);
                    final IPortletWindowId portletWindowId = portletParameterParts.second;
                    final String paramName = portletParameterParts.first;

                    // Get the portlet parameter map to add the parameter to
                    final Map<String, List<String>> portletParameters;
                    if (portletWindowId == null) {
                        if (targetedPortletRequestInfo == null) {
                            this.logger.warn(
                                    "Parameter "
                                            + name
                                            + " is for the targeted portlet but no portlet is targeted by the request. The parameter will be ignored. Value: "
                                            + values);
                            parameterEntryItr.remove();
                            break;
                        }

                        portletParameters = targetedPortletRequestInfo.getPortletParameters();
                    } else {
                        final PortletRequestInfoImpl portletRequestInfoImpl =
                                portalRequestInfo.getPortletRequestInfo(portletWindowId);
                        portletParameters = portletRequestInfoImpl.getPortletParameters();
                    }

                    portletParameters.put(paramName, values);
                    parameterEntryItr.remove();
                    continue;
                }

                // Portlet control parameters are either used directly or as a prefix to a windowId.
                // Use the
                // SuffixedPortletParameter to simplify their parsing
                for (final SuffixedPortletParameter suffixedPortletParameter :
                        SuffixedPortletParameter.values()) {
                    final String parameterPrefix = suffixedPortletParameter.getParameterPrefix();
                    // Skip to the next parameter prefix if the current doesn't match
                    if (!name.startsWith(parameterPrefix)) {
                        continue;
                    }

                    // All of these parameters require at least one value
                    if (values.isEmpty()) {
                        this.logger.warn(
                                "Ignoring parameter {} as it must have a value. Value: {}",
                                name,
                                values);
                        break;
                    }

                    // Verify the parameter is being used on the correct type of URL
                    final Set<UrlType> validUrlTypes = suffixedPortletParameter.getValidUrlTypes();
                    if (!validUrlTypes.contains(portalRequestInfo.getUrlType())) {
                        this.logger.warn(
                                "Ignoring parameter {} as it is only valid for {} requests and this is a "
                                        + "{} request. Value: {}",
                                name,
                                validUrlTypes,
                                portalRequestInfo.getUrlType(),
                                values);
                        break;
                    }

                    // Determine the portlet window and request info the parameter targets
                    final IPortletWindowId portletWindowId =
                            this.parsePortletWindowIdSuffix(
                                    request, parameterPrefix, additionalPortletIds, name);
                    final PortletRequestInfoImpl portletRequestInfo =
                            getTargetedPortletRequestInfo(
                                    portalRequestInfo, targetedPortletRequestInfo, portletWindowId);
                    if (portletRequestInfo == null) {
                        this.logger.warn(
                                "Parameter {} is for the targeted portlet but no portlet is targeted"
                                        + " by the request. The parameter will be ignored. Value: {}",
                                name,
                                values);
                        break;
                    }

                    parameterEntryItr.remove();

                    // Use the enum helper to store the parameter values on the request info
                    suffixedPortletParameter.updateRequestInfo(
                            request,
                            portletWindowRegistry,
                            portletRequestInfo,
                            values,
                            delegateIdMappings);
                    break;
                }
            }

            // Any non-namespaced parameters still need processing?
            if (!parameterMap.isEmpty()) {
                // If the parameter was not ignored by a previous parser add it to whatever was
                // targeted (portlet or portal)
                final Map<String, List<String>> parameters;
                if (!delegateIdMappings.isEmpty()) {
                    // Resolve the last portlet window in the chain of delegation
                    PortletRequestInfoImpl delegatePortletRequestInfo = null;
                    for (final IPortletWindowId delegatePortletWindowId :
                            delegateIdMappings.values()) {
                        if (!delegateIdMappings.containsKey(delegatePortletWindowId)) {
                            delegatePortletRequestInfo =
                                    portalRequestInfo.getPortletRequestInfo(
                                            delegatePortletWindowId);
                            break;
                        }
                    }

                    if (delegatePortletRequestInfo != null) {
                        parameters = delegatePortletRequestInfo.getPortletParameters();
                    } else {
                        this.logger.warn(
                                "No root delegate portlet could be resolved, non-namespaced parameters"
                                        + " will be sent to the targeted portlet. THIS SHOULD NEVER HAPPEN. Delegate"
                                        + " parent/child mapping: {}",
                                delegateIdMappings);

                        if (targetedPortletRequestInfo != null) {
                            parameters = targetedPortletRequestInfo.getPortletParameters();
                        } else {
                            parameters = portalRequestInfo.getPortalParameters();
                        }
                    }
                } else if (targetedPortletRequestInfo != null) {
                    parameters = targetedPortletRequestInfo.getPortletParameters();
                } else {
                    parameters = portalRequestInfo.getPortalParameters();
                }

                ParameterMap.putAllList(parameters, parameterMap);
            }

            // If a portlet is targeted but no layout node is targeted must be maximized
            if (targetedPortletRequestInfo != null
                    && portalRequestInfo.getTargetedLayoutNodeId() == null
                    && (requestedUrlState == null || requestedUrlState == UrlState.NORMAL)) {
                portalRequestInfo.setUrlState(UrlState.MAX);
                targetedPortletRequestInfo.setWindowState(WindowState.MAXIMIZED);
            }

            // Make the request info object read-only, once parsed the request info should be static
            portalRequestInfo.makeReadOnly();

            request.setAttribute(PORTAL_REQUEST_INFO_ATTR, portalRequestInfo);

            logger.debug("Finished building requestInfo: {}", portalRequestInfo);

            return portalRequestInfo;
        } finally {
            request.removeAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR);
        }
    }
966150
public ListStreamStatisticsResponse listStreamStatistics(ListStreamStatisticsRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getDomain(), "Domain should NOT be null");
        checkStringNotEmpty(request.getApp(), "App should NOT be null");
        checkStringNotEmpty(request.getStartTime(), "StartTime should NOT be null");

        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
                STATISTICS, LIVE_DOMAIN, request.getDomain(), LIVE_STREAM);

        internalRequest.addParameter("app", request.getApp());
        internalRequest.addParameter("startTime", request.getStartTime());
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", request.getEndTime());
        }
        if (request.getKeyword() != null) {
            internalRequest.addParameter("keyword", request.getKeyword());
        }
        if (request.getKeywordType() != null) {
            internalRequest.addParameter("keywordType", request.getKeywordType());
        }
        if (request.getOrderBy() != null) {
            internalRequest.addParameter("orderBy", request.getOrderBy());
        }
        if (request.getPageNo() != null) {
            internalRequest.addParameter("pageNo", request.getPageNo().toString());
        }
        if (request.getPageSize() != null) {
            internalRequest.addParameter("pageSize", request.getPageSize().toString());
        }
        return invokeHttpClient(internalRequest, ListStreamStatisticsResponse.class);
    }
729944
public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(GetDomainSummaryStatisticsRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
                STATISTICS, LIVE_DOMAIN, "summary");
        internalRequest.addParameter("startTime", request.getStartTime());
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", request.getEndTime());
        }
        return invokeHttpClient(internalRequest, GetDomainSummaryStatisticsResponse.class);
    }