Java Code Examples for javax.ws.rs.core.UriInfo#getQueryParameters()

The following examples show how to use javax.ws.rs.core.UriInfo#getQueryParameters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadFileResponseFilter.java    From che with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Check if we need to apply a filter
 *
 * @param request
 * @return
 */
protected String getFileName(
    Request request, MediaType mediaType, UriInfo uriInfo, int responseStatus) {

  // manage only GET requests
  if (!HttpMethod.GET.equals(request.getMethod())) {
    return null;
  }

  // manage only OK code
  if (Response.Status.OK.getStatusCode() != responseStatus) {
    return null;
  }

  // Only handle JSON content
  if (!MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) {
    return null;
  }

  // check if parameter filename is given
  MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
  return queryParameters.getFirst(QUERY_DOWNLOAD_PARAMETER);
}
 
Example 2
Source File: CubeResource.java    From cubedb with GNU General Public License v3.0 6 votes vote down vote up
@GET
@Path("/{cubeName}/last/{range}")
public APIResponse<Map<String, Map<String, Map<String, Long>>>> get(
    @PathParam("cubeName") String cubeName,
    @PathParam("range") int range,
    @Context UriInfo info) {
  final long startTime = System.currentTimeMillis();
  final MultivaluedMap<String, String> filterCriterias = info.getQueryParameters();

  if (!cube.hasCube(cubeName)) {
    log.warn("Could not find cube {}", cubeName);
    throw new NotFoundException(String.format("Could not find cube %s", cubeName));
  }
  Map<GroupedSearchResultRow, Long> result =
      cube.get(cubeName, range, buildFilters(filterCriterias));
  return new APIResponse<>(CubeUtils.searchResultsToMap(result), info, startTime);
}
 
Example 3
Source File: UserOperationLogRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public List<UserOperationLogEntryDto> queryUserOperationEntries(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.getQueryParameters());
  UserOperationLogQuery query = queryDto.toQuery(processEngine);

  if (firstResult == null && maxResults == null) {
    return UserOperationLogEntryDto.map(query.list());
  } else {
    if (firstResult == null) {
      firstResult = 0;
    }
    if (maxResults == null) {
      maxResults = Integer.MAX_VALUE;
    }
    return UserOperationLogEntryDto.map(query.listPage(firstResult, maxResults));
  }
}
 
Example 4
Source File: IncidentRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public List<IncidentDto> getIncidents(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  IncidentQueryDto queryDto = new IncidentQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  IncidentQuery query = queryDto.toQuery(processEngine);

  List<Incident> queryResult;
  if (firstResult != null || maxResults != null) {
    queryResult = executePaginatedQuery(query, firstResult, maxResults);
  } else {
    queryResult = query.list();
  }

  List<IncidentDto> result = new ArrayList<IncidentDto>();
  for (Incident incident : queryResult) {
    IncidentDto dto = IncidentDto.fromIncident(incident);
    result.add(dto);
  }

  return result;
}
 
Example 5
Source File: HistoricIncidentRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public List<HistoricIncidentDto> getHistoricIncidents(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  HistoricIncidentQueryDto queryDto = new HistoricIncidentQueryDto(objectMapper, uriInfo.getQueryParameters());
  HistoricIncidentQuery query = queryDto.toQuery(processEngine);

  List<HistoricIncident> queryResult;
  if (firstResult != null || maxResults != null) {
    queryResult = executePaginatedQuery(query, firstResult, maxResults);
  } else {
    queryResult = query.list();
  }

  List<HistoricIncidentDto> result = new ArrayList<HistoricIncidentDto>();
  for (HistoricIncident historicIncident : queryResult) {
    HistoricIncidentDto dto = HistoricIncidentDto.fromHistoricIncident(historicIncident);
    result.add(dto);
  }

  return result;
}
 
Example 6
Source File: SecurityCatalogResource.java    From streamline with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/roles")
@Timed
public Response listRoles(@Context UriInfo uriInfo,
                          @Context SecurityContext securityContext) throws Exception {
    if (!SecurityUtil.hasRole(authorizer, securityContext, ROLE_SECURITY_ADMIN)) {
        LOG.debug("Allowing logged-in user '{}'", SecurityUtil.getUserName(securityContext.getUserPrincipal().getName()));
    }
    Collection<Role> roles;
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    List<QueryParam> queryParams = WSUtils.buildQueryParameters(params);
    if (params == null || params.isEmpty()) {
        roles = catalogService.listRoles();
    } else {
        roles = catalogService.listRoles(queryParams);
    }
    if (roles != null) {
        return WSUtils.respondEntities(roles, OK);
    }
    throw EntityNotFoundException.byFilter(queryParams.toString());
}
 
Example 7
Source File: HistoricDetailRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public CountResultDto getHistoricDetailsCount(UriInfo uriInfo) {
  HistoricDetailQueryDto queryDto = new HistoricDetailQueryDto(objectMapper, uriInfo.getQueryParameters());
  HistoricDetailQuery query = queryDto.toQuery(processEngine);

  long count = query.count();
  CountResultDto result = new CountResultDto();
  result.setCount(count);

  return result;
}
 
Example 8
Source File: TenantRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public List<TenantDto> queryTenants(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  TenantQueryDto queryDto = new TenantQueryDto(getObjectMapper(), uriInfo.getQueryParameters());

  TenantQuery query = queryDto.toQuery(getProcessEngine());

  List<Tenant> tenants;
  if (firstResult != null || maxResults != null) {
    tenants = executePaginatedQuery(query, firstResult, maxResults);
  } else {
    tenants = query.list();
  }

  return TenantDto.fromTenantList(tenants );
}
 
Example 9
Source File: JaxrsRequestContext.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
private Map<String, Set<String>> getParameters(UriInfo uriInfo) {
	MultivaluedMap<String, String> queryParametersMultiMap = uriInfo.getQueryParameters();
	Map<String, Set<String>> queryParameters = new HashMap<>();

	for (Map.Entry<String, List<String>> queryEntry : queryParametersMultiMap.entrySet()) {
		queryParameters.put(queryEntry.getKey(), new LinkedHashSet<>(queryEntry.getValue()));
	}
	return queryParameters;
}
 
Example 10
Source File: HistoricDecisionDefinitionRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public List<CleanableHistoricDecisionInstanceReportResultDto> getCleanableHistoricDecisionInstanceReport(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  CleanableHistoricDecisionInstanceReportDto queryDto = new CleanableHistoricDecisionInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
  CleanableHistoricDecisionInstanceReport query = queryDto.toQuery(processEngine);

  List<CleanableHistoricDecisionInstanceReportResult> reportResult;
  if (firstResult != null || maxResults != null) {
    reportResult = executePaginatedQuery(query, firstResult, maxResults);
    } else {
    reportResult = query.list();
    }

  return CleanableHistoricDecisionInstanceReportResultDto.convert(reportResult);
}
 
Example 11
Source File: CaseInstanceRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public List<CaseInstanceDto> getCaseInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  CaseInstanceQueryDto queryDto = new CaseInstanceQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryCaseInstances(queryDto, firstResult, maxResults);
}
 
Example 12
Source File: HistoricDecisionInstanceRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public List<HistoricDecisionInstanceDto> getHistoricDecisionInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  HistoricDecisionInstanceQueryDto queryHistoricDecisionInstanceDto = new HistoricDecisionInstanceQueryDto(objectMapper, uriInfo.getQueryParameters());
  return queryHistoricDecisionInstances(queryHistoricDecisionInstanceDto, firstResult, maxResults);
}
 
Example 13
Source File: JobRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public List<JobDto> getJobs(UriInfo uriInfo, Integer firstResult,
                            Integer maxResults) {
  JobQueryDto queryDto = new JobQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryJobs(queryDto, firstResult, maxResults);
}
 
Example 14
Source File: SamlProtocolUtils.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public static void verifyRedirectSignature(SAMLDocumentHolder documentHolder, KeyLocator locator, UriInfo uriInformation, String paramKey) throws VerificationException {
    MultivaluedMap<String, String> encodedParams = uriInformation.getQueryParameters(false);
    verifyRedirectSignature(documentHolder, locator, encodedParams, paramKey);
}
 
Example 15
Source File: ExecutionRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public List<ExecutionDto> getExecutions(UriInfo uriInfo, Integer firstResult,
    Integer maxResults) {
  ExecutionQueryDto queryDto = new ExecutionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryExecutions(queryDto, firstResult, maxResults);
}
 
Example 16
Source File: ExternalTaskRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public List<ExternalTaskDto> getExternalTasks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  ExternalTaskQueryDto queryDto = new ExternalTaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryExternalTasks(queryDto, firstResult, maxResults);
}
 
Example 17
Source File: TaskRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CountResultDto getTasksCount(UriInfo uriInfo) {
  TaskQueryDto queryDto = new TaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryTasksCount(queryDto);
}
 
Example 18
Source File: UserRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public List<UserProfileDto> queryUsers(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  UserQueryDto queryDto = new UserQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryUsers(queryDto, firstResult, maxResults);
}
 
Example 19
Source File: HistoricTaskInstanceRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public List<HistoricTaskInstanceDto> getHistoricTaskInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  HistoricTaskInstanceQueryDto queryDto = new HistoricTaskInstanceQueryDto(objectMapper, uriInfo.getQueryParameters());
  return queryHistoricTaskInstances(queryDto, firstResult, maxResults);
}
 
Example 20
Source File: ProcessInstanceRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public CountResultDto getProcessInstancesCount(UriInfo uriInfo) {
  ProcessInstanceQueryDto queryDto = new ProcessInstanceQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  return queryProcessInstancesCount(queryDto);
}