get domain's statistics in the live stream service.

@param request The request object containing all options for getting domain's statistics
@return the response
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);
    }
1241624
private SipResponse processRegisterRequest(final SipRequest request) {
        final SipURI requestURI = (SipURI) request.getRequestUri();
        final Buffer domain = requestURI.getHost();
        final SipURI aor = getAOR(request);

        // the aor is not allowed to register under this domain
        // generate a 404 according to specfication
        if (!validateDomain(domain, aor)) {
            return request.createResponse(404);
        }

        final Binding.Builder builder = Binding.with();
        builder.aor(aor);
        builder.callId(request.getCallIDHeader());
        builder.expires(getExpires(request));
        builder.cseq(request.getCSeqHeader());

        // NOTE: this is also cheating. There may be multiple contacts
        // and they must all get processed but whatever...
        builder.contact(getContactURI(request));

        final Binding binding = builder.build();
        final List<Binding> currentBindings = this.locationService.updateBindings(binding);
        final SipResponse response = request.createResponse(200);
        currentBindings.forEach(b -> {
            final SipURI contactURI = b.getContact();
            contactURI.setParameter("expires", b.getExpires());
            final ContactHeader contact = ContactHeader.with(contactURI).build();
            response.addHeader(contact);
        });

        return response;
    }
1041913
public static String getRequestURI(final HttpServletRequest request) {
		return (String) request.getSession(true).getAttribute(STORE_URI_KEY);
	}
1324665
public GetDomainConfigResponse getDomainConfig(GetDomainConfigRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        InternalRequest internalRequest = createRequest(request, HttpMethodName.GET, DOMAIN, request.getDomain(), "config");
        return invokeHttpClient(internalRequest, GetDomainConfigResponse.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);
    }
137842
public ListStreamResponse listStream(ListStreamRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty.");

        InternalRequest internalRequest = createRequest(HttpMethodName.GET,
                request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_STREAM);
        if (request.getStatus() != null) {
            internalRequest.addParameter("status", request.getStatus());
        }

        if (request.getMarker() != null) {
            internalRequest.addParameter("marker", request.getMarker());
        }

        if (request.getMaxSize() != null) {
            internalRequest.addParameter("maxSize", request.getMaxSize().toString());
        }

        return invokeHttpClient(internalRequest, ListStreamResponse.class);

    }
1117789
public GetStatFlowResponse getStatFlow(GetStatFlowRequest request) {
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, STAT, "flow");
        
        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()));
        }
        
        if (request.isWithRegion()) {
            internalRequest.addParameter("withRegion", "");
        }
        return this.invokeHttpClient(internalRequest, GetStatFlowResponse.class);
    }
471479
public GetVerifiedDomainResponse getVerifiedDomain(GetVerifiedDomainRequest request) {
        checkNotNull(request, "object request should not be null.");
        assertStringNotNullOrEmpty(request.getDomainName(), "object domainName should not be null or empty");

        InternalRequest internalRequest =
                this.createRequest("verifiedDomain", request, HttpMethodName.GET, request.getDomainName());
        return this.invokeHttpClient(internalRequest, GetVerifiedDomainResponse.class);
    }
1140598
public Map<String, String> getAssociationResponse(final HttpServletRequest request) {
        val parameters = new ParameterList(request.getParameterMap());

        val mode = parameters.hasParameter(OpenIdProtocolConstants.OPENID_MODE)
            ? parameters.getParameterValue(OpenIdProtocolConstants.OPENID_MODE)
            : null;

        val response = FunctionUtils.doIf(StringUtils.equals(mode, OpenIdProtocolConstants.ASSOCIATE),
            () -> this.serverManager.associationResponse(parameters),
            () -> null)
            .get();

        val responseParams = new HashMap<String, String>();
        if (response != null) {
            responseParams.putAll(response.getParameterMap());
        }
        return responseParams;
    }
978190
public SetDomainLimitRateResponse setDomainLimitRate(SetDomainLimitRateRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
        internalRequest.addParameter("limitRate","");
        this.attachRequestToBody(request, internalRequest);
        return invokeHttpClient(internalRequest, SetDomainLimitRateResponse.class);
    }
506023
public static MetricRequest fromProtobuf(TopologyMaster.MetricRequest request) {
    String componentName = request.getComponentName();

    Map<String, Set<String>> componentNameInstanceId = new HashMap<>();
    if (request.getInstanceIdCount() == 0) {
      // empty list means all instances
      // 'null' means all instances
      componentNameInstanceId.put(componentName, null);
    } else {
      Set<String> instances = new HashSet<>();
      // only one component
      componentNameInstanceId.put(componentName, instances);
      // if there are instances specified
      instances.addAll(request.getInstanceIdList());
    }

    Set<String> metricNames = new HashSet<>();
    if (request.getMetricCount() > 0) {
      metricNames.addAll(request.getMetricList());
    } // empty list means no metrics

    // default: the whole time horizon
    long startTime = 0;
    long endTime = Long.MAX_VALUE;
    if (request.hasInterval()) { // endTime = now
      endTime = System.currentTimeMillis();

      long interval = request.getInterval(); // in seconds
      if (interval <= 0) { // means all
        startTime = 0;
      } else { // means [-interval, now]
        startTime = endTime - interval * 1000;
      }
    } else {
      startTime = request.getExplicitInterval().getStart() * 1000;
      endTime = request.getExplicitInterval().getEnd() * 1000;
    }

    // default: aggregate all metrics
    MetricGranularity aggregationGranularity = AGGREGATE_ALL_METRICS;
    if (request.hasMinutely() && request.getMinutely()) {
      aggregationGranularity = AGGREGATE_BY_BUCKET;
    }

    return new MetricRequest(componentNameInstanceId, metricNames,
        startTime, endTime, aggregationGranularity);
  }
714841
protected String getRequestedService(final HttpServletRequest request) {
        val targetService = request.getParameter(CasProtocolConstants.PARAMETER_TARGET_SERVICE);
        val service = request.getParameter(CasProtocolConstants.PARAMETER_SERVICE);
        val serviceAttribute = request.getAttribute(CasProtocolConstants.PARAMETER_SERVICE);

        if (StringUtils.isNotBlank(targetService)) {
            return targetService;
        }
        if (StringUtils.isNotBlank(service)) {
            return service;
        }
        if (serviceAttribute != null) {
            if (serviceAttribute instanceof Service) {
                return ((Service) serviceAttribute).getId();
            }
            return serviceAttribute.toString();
        }
        return null;
    }
604273
@GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response totalApplications(@Context HttpServletRequest request) {
        final DashboardData dataForUser =  service.getSearchService().loadDashboardData();

        return Response.ok(dataForUser).build();
    }
695234
public static String getRequestBody(HttpServletRequest request) {
		if(request.getMethod().equals("GET") || request.getMethod().equals("DELETE")) {
			return null;
		}
		
		StringBuilder stringBuilder = new StringBuilder();
		BufferedReader bufferedReader = null;
		try {
			InputStream inputStream = request.getInputStream();
			if (inputStream != null) {
				bufferedReader = new BufferedReader(new InputStreamReader(
						inputStream));
				char[] charBuffer = new char[128];
				int bytesRead = -1;
				while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
					stringBuilder.append(charBuffer, 0, bytesRead);
				}
			} else {
				stringBuilder.append("");
			}
		} catch (IOException ex) {
			// to nothing
		} finally {
			if (bufferedReader != null) {
				try {
					bufferedReader.close();
				} catch (IOException ex) {

				}
			}
		}

		if (!StringUtils.isEmpty(stringBuilder)) {
			return stringBuilder.toString();
		}

		if (request.getParameterMap().keySet().size() > 0) {
			return request.getParameterMap().keySet().toArray()[0].toString();
		}

        return null;
	}
288960
public GetStreamResponse getStream(String domain, String app, String stream) {
        GetStreamRequest request = new GetStreamRequest();
        request.withPlayDomain(domain).withApp(app).withStream(stream);
        return getStream(request);
    }
924073
public void updateStreamPullUrl(UpdateStreamPullUrlRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty.");
        checkStringNotEmpty(request.getApp(), "App should NOT be empty");
        checkStringNotEmpty(request.getStream(), "Stream should NOT be empty.");
        checkStringNotEmpty(request.getPullUrl(), "PullUrl should NOT be empty.");

        InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN,
                request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream());
        internalRequest.addParameter("pullUrl", request.getPullUrl());
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
96679
def get_domain_id_for_operation(request):
    

    domain_context = request.session.get('domain_context')
    if domain_context:
        return domain_context
    return api.keystone.get_effective_domain_id(request)