Java 类javax.ws.rs.QueryParam 实例源码

项目:microprofile-jwt-auth    文件:JsonValuejectionEndpoint.java   
@GET
@Path("/verifyInjectedIssuer")
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("Tester")
public JsonObject verifyInjectedIssuer(@QueryParam("iss") String iss) {
    boolean pass = false;
    String msg;
    String issValue = issuer.getString();
    if(issValue == null || issValue.length() == 0) {
        msg = Claims.iss.name()+"value is null or empty, FAIL";
    }
    else if(issValue.equals(iss)) {
        msg = Claims.iss.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.iss.name(), issValue, iss);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
项目:presto-manager    文件:ControllerPackageAPI.java   
@PUT
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Install Presto using rpm or tarball")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response install(String urlToFetchPackage,
        @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class)
            .httpMethod(PUT)
            .accept(MediaType.TEXT_PLAIN)
            .entity(Entity.entity(urlToFetchPackage, MediaType.TEXT_PLAIN));

    optionalQueryParam(apiRequester, "checkDependencies", checkDependencies);

    return forwardRequest(scope, apiRequester.build(), nodeId);
}
项目:Equella    文件:EquellaItemResource.java   
@DELETE
@Path("/{uuid}/{version}/comment")
@ApiOperation(value = "Delete a comment")
Response deleteComment(
    @Context 
        UriInfo info,
    @ApiParam(APIDOC_ITEMUUID) 
    @PathParam("uuid") 
        String uuid,
    @ApiParam(APIDOC_ITEMVERSION) 
    @PathParam("version") 
        int version,
    @ApiParam(APIDOC_ITEMVERSION) 
    @QueryParam("commentuuid") 
        String commentUuid
    );
项目:presto-manager    文件:ControllerConfigAPI.java   
@GET
@Path("/{file}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Get contents of a configuration file")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response getConfigFile(
        @PathParam("file") String file,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester apiRequester = requesterBuilder(ControllerConfigAPI.class)
            .pathMethod("getConfigFile")
            .httpMethod(GET)
            .resolveTemplate("file", file)
            .accept(MediaType.TEXT_PLAIN)
            .build();

    return forwardRequest(scope, apiRequester, nodeId);
}
项目:traccar-service    文件:UserResource.java   
@GET
public Collection<User> get(@QueryParam("userId") long userId) throws SQLException {
    UsersManager usersManager = Context.getUsersManager();
    Set<Long> result = null;
    if (Context.getPermissionsManager().getUserAdmin(getUserId())) {
        if (userId != 0) {
            result = usersManager.getUserItems(userId);
        } else {
            result = usersManager.getAllItems();
        }
    } else if (Context.getPermissionsManager().getUserManager(getUserId())) {
        result = usersManager.getManagedItems(getUserId());
    } else {
        throw new SecurityException("Admin or manager access required");
    }
    return usersManager.getItems(result);
}
项目:neo4j-sparql-extension-yars    文件:GraphStore.java   
/**
 * Indirect HTTP PUT
 *
 * @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-put">
 * Section 5.3 "HTTP PUT"
 * </a>
 * @param uriInfo JAX-RS {@link UriInfo} object
 * @param type Content-Type HTTP header field
 * @param graphString the "graph" query parameter
 * @param def the "default" query parameter
 * @param chunked the "chunked" query parameter
 * @param in HTTP body as {@link InputStream}
 * @return "204 No Content", if operation was successful
 */
@PUT
@Consumes({
    RDFMediaType.RDF_TURTLE,
    RDFMediaType.RDF_YARS,
    RDFMediaType.RDF_XML,
    RDFMediaType.RDF_NTRIPLES,
    RDFMediaType.RDF_XML
})
public Response graphIndirectPut(
        @Context UriInfo uriInfo,
        @HeaderParam("Content-Type") MediaType type,
        @QueryParam("graph") String graphString,
        @QueryParam("default") String def,
        @QueryParam("chunked") String chunked,
        InputStream in) {
    return handleAdd(uriInfo, type, graphString, def, in, chunked, true);
}
项目:ctsms    文件:ProbandListEntryResource.java   
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("{id}/tagvalues")
public JsValuesOutVOPage<ProbandListEntryTagValueOutVO, ProbandListEntryTagValueJsonVO> getProbandListEntryTagValues(@PathParam("id") Long id,
        @QueryParam("sort") Boolean sort, @QueryParam("load_all_js_values") Boolean loadAllJsValues, @Context UriInfo uriInfo)
                throws AuthenticationException, AuthorisationException, ServiceException {
    PSFUriPart psf = new PSFUriPart(uriInfo, "sort", "load_all_js_values");
    ProbandListEntryTagValuesOutVO values = WebUtil.getServiceLocator().getTrialService()
            .getProbandListEntryTagValues(auth, id, sort, loadAllJsValues, psf);
    return new JsValuesOutVOPage<ProbandListEntryTagValueOutVO, ProbandListEntryTagValueJsonVO>(values.getPageValues(), values.getJsValues(), psf);
    // PSFUriPart psf;
    // return new ProbandListEntryTagValuesOutVOPage(WebUtil.getServiceLocator().getTrialService()
    // .getProbandListEntryTagValues(auth, id, false, false, psf = new PSFUriPart(uriInfo)),
    // psf);
    // return WebUtil.getServiceLocator().getTrialService().getProbandListEntryTagValues(auth, id, false, false, new PSFUriPart(uriInfo));
}
项目:presto-manager    文件:ControllerConnectorAPI.java   
@DELETE
@Path("/{file}/{property}")
@ApiOperation(value = "Delete a certain property of connector file")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response deleteConnectorProperty(
        @PathParam("file") String file,
        @PathParam("property") String property,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester apiRequester = requesterBuilder(ControllerConnectorAPI.class)
            .pathMethod("deleteConnectorProperty")
            .httpMethod(DELETE)
            .resolveTemplate("file", file)
            .resolveTemplate("property", property)
            .accept(MediaType.TEXT_PLAIN)
            .build();

    return forwardRequest(scope, apiRequester, nodeId);
}
项目:https-github.com-apache-zookeeper    文件:ZNodeResource.java   
@PUT
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public void setZNodeAsOctet(@PathParam("path") String path,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @DefaultValue("false") @QueryParam("null") String setNull,
        @Context UriInfo ui, byte[] data) throws InterruptedException,
        KeeperException {
    ensurePathNotNull(path);

    int version;
    try {
        version = Integer.parseInt(versionParam);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.status(
                Response.Status.BAD_REQUEST).entity(
                new ZError(ui.getRequestUri().toString(), path
                        + " bad version " + versionParam)).build());
    }

    if (setNull.equals("true")) {
        data = null;
    }

    zk.setData(path, data, version);
}
项目:Equella    文件:TaskResource.java   
@GET
@Path("/")
@ApiOperation(value = "Search tasks")
public Response tasksSearch(
    // @formatter:off
    @Context UriInfo uriInfo,
    @ApiParam(value="The filtering to apply to the task list", allowableValues = "all,assignedme,assignedothers,assignednone,mustmoderate", required = false, defaultValue=DEFAULT_FILTER) @QueryParam("filter")
        String filtering,
    @ApiParam(value="Query string", required = false) @QueryParam("q")
        String q,
    @ApiParam(value="The first record of the search results to return", required = false, defaultValue="0") @QueryParam("start")
        int start,
    @ApiParam(value="The number of results to return", required = false, defaultValue = "10", allowableValues = "range[1,100]") @QueryParam("length")
        int length,
    @ApiParam(value="List of collections", required = false) @QueryParam("collections")
        CsvList collections,
    @ApiParam(value="The order of the search results", allowableValues="priority,duedate,waiting, name", required = false) @QueryParam("order")
        String order,
    @ApiParam(value="Reverse the order of the search results", allowableValues = ",true,false", defaultValue = "false", required = false)
    @QueryParam("reverse")
        String reverse
    );
项目:CommonInformationSpace    文件:CISAdaptorConnectorRestController.java   
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
       @ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
       @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
     })
@ApiResponses(value = { 
           @ApiResponse(code = 200, message = "Success", response = Participant.class),
           @ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
           @ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
    log.info("--> getParticipantFromCGOR: " + cgorName);

    Participant participant;

    try {
        participant = connector.getParticipantFromCGOR(cgorName, organisation);
    } catch (CISCommunicationException e) {
        log.error("Error executing the request: Communication Error" , e);
        participant = null;
    }

    HttpHeaders responseHeaders = new HttpHeaders();

    log.info("getParticipantFromCGOR -->");
    return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
项目:microprofile-jwt-auth    文件:PrimitiveInjectionEndpoint.java   
@GET
@Path("/verifyInjectedCustomString")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedCustomString(@QueryParam("value") String value) {
    boolean pass = false;
    String msg;
    // iat
    String customValue = this.customString;
    if (customValue == null || customValue.length() == 0) {
        msg = "customString value is null or empty, FAIL";
    }
    else if (customValue.equals(value)) {
        msg = "customString PASS";
        pass = true;
    }
    else {
        msg = String.format("customString: %s != %s", customValue, value);
    }
    JsonObject result = Json.createObjectBuilder()
            .add("pass", pass)
            .add("msg", msg)
            .build();
    return result;
}
项目:hadoop    文件:HsWebServices.java   
@GET
@Path("/mapreduce/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@Context HttpServletRequest hsr,
    @PathParam("jobid") String jid, @QueryParam("type") String type) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  TasksInfo allTasks = new TasksInfo();
  for (Task task : job.getTasks().values()) {
    TaskType ttype = null;
    if (type != null && !type.isEmpty()) {
      try {
        ttype = MRApps.taskType(type);
      } catch (YarnRuntimeException e) {
        throw new BadRequestException("tasktype must be either m or r");
      }
    }
    if (ttype != null && task.getType() != ttype) {
      continue;
    }
    allTasks.add(new TaskInfo(task));
  }
  return allTasks;
}
项目:presto-manager    文件:ControllerConfigAPI.java   
@GET
@Path("/{file}/{property}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Get specific configuration property")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response getConfigProperty(
        @PathParam("file") String file,
        @PathParam("property") String property,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester apiRequester = requesterBuilder(ControllerConfigAPI.class)
            .pathMethod("getConfigProperty")
            .httpMethod(GET)
            .resolveTemplate("file", file)
            .resolveTemplate("property", property)
            .accept(MediaType.TEXT_PLAIN)
            .build();

    return forwardRequest(scope, apiRequester, nodeId);
}
项目:message-broker    文件:QueuesApi.java   
@DELETE
@Path("/{queueName}")
@Produces({"application/json"})
@ApiOperation(value = "Delete the specified queue.", notes = "Delete the specified queue if the queue exists in "
        + "the broker and the query param properties ifUnused and ifEmpty are satisfied.",
              response = Void.class, tags = {})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Queue deleted", response = Void.class),
        @ApiResponse(code = 400, message = "Bad request. Invalid request or validation error.",
                     response = Error.class),
        @ApiResponse(code = 404, message = "Queue not found", response = Error.class)})
public Response deleteQueue(
        @PathParam("queueName") @ApiParam("Name of the queue") String queueName, @QueryParam("ifUnused")
@ApiParam("If set to true, queue will be deleted only if the queue has no active consumers.") Boolean ifUnused,
         @QueryParam("ifEmpty") @ApiParam("If set to true, queue will be deleted only if the queue is empty.")
                Boolean ifEmpty) {
    return delegate.deleteQueue(queueName, ifUnused, ifEmpty);
}
项目:rebase-server    文件:AuthorizationResource.java   
@GET @Path("{username}")
@Produces(MediaType.APPLICATION_JSON)
public Response authorize(
    @Username @PathParam("username") String username,
    @NotEmpty @QueryParam("password") String password) {

    Bson filter = and(eq(User.USERNAME, username), eq(User.PASSWORD, Hashes.sha1(password)));
    Document newAuth = Authorizations.newInstance(username);
    Document user = MongoDBs.users().findOneAndUpdate(filter, set(User.AUTHORIZATION, newAuth));
    if (user == null) {
        return Response.status(FORBIDDEN)
            .entity(new Failure("The username or password is incorrect"))
            .build();
    } else {
        return Response.ok(newAuth).build();
    }
}
项目:presto-manager    文件:ControllerPackageAPI.java   
@DELETE
@ApiOperation(value = "Uninstall Presto")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response uninstall(
        @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies,
        @QueryParam("forceUninstall") @DefaultValue("false") boolean forceUninstall,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class)
            .httpMethod(DELETE);

    optionalQueryParam(apiRequester, "forceUninstall", forceUninstall);
    optionalQueryParam(apiRequester, "checkDependencies", checkDependencies);

    return forwardRequest(scope, apiRequester.build(), nodeId);
}
项目:hadoop-oss    文件:KMS.java   
@GET
@Path(KMSRESTConstants.KEYS_METADATA_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeysMetadata(@QueryParam(KMSRESTConstants.KEY)
    List<String> keyNamesList) throws Exception {
  KMSWebApp.getAdminCallsMeter().mark();
  UserGroupInformation user = HttpUserGroupInformation.get();
  final String[] keyNames = keyNamesList.toArray(
      new String[keyNamesList.size()]);
  assertAccess(KMSACLs.Type.GET_METADATA, user, KMSOp.GET_KEYS_METADATA);

  KeyProvider.Metadata[] keysMeta = user.doAs(
      new PrivilegedExceptionAction<KeyProvider.Metadata[]>() {
        @Override
        public KeyProvider.Metadata[] run() throws Exception {
          return provider.getKeysMetadata(keyNames);
        }
      }
  );

  Object json = KMSServerJSONUtils.toJSON(keyNames, keysMeta);
  kmsAudit.ok(user, KMSOp.GET_KEYS_METADATA, "");
  return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build();
}
项目:microprofile-jwt-auth    文件:ClaimValueInjectionEndpoint.java   
@GET
@Path("/verifyInjectedAudience")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedAudience(@QueryParam("aud") String audience) {
    boolean pass = false;
    String msg;
    // aud
    Set<String> audValue = aud.getValue();
    if(audValue == null || audValue.size() == 0) {
        msg = Claims.aud.name()+"value is null or empty, FAIL";
    }
    else if(audValue.contains(audience)) {
        msg = Claims.aud.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.aud.name(), audValue, audience);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
项目:neo4j-sparql-extension-yars    文件:SPARQLQuery.java   
/**
 * Query via GET (with inference).
 *
 * @see <a href="http://www.w3.org/TR/sparql11-protocol/#query-operation">
 * SPARQL 1.1 Protocol
 * </a>
 * @param req JAX-RS {@link Request} object
 * @param uriInfo JAX-RS {@link UriInfo} object
 * @param queryString the "query" query parameter
 * @param defgraphs the "default-graph-uri" query parameter
 * @param namedgraphs the "named-graph-uri" query parameter
 * @return the result of the SPARQL query
 */
@GET
@Path("/inference")
@Produces({
    RDFMediaType.SPARQL_RESULTS_JSON,
    RDFMediaType.SPARQL_RESULTS_XML,
    RDFMediaType.SPARQL_RESULTS_CSV,
    RDFMediaType.SPARQL_RESULTS_TSV,
    RDFMediaType.RDF_TURTLE,
    RDFMediaType.RDF_YARS,
    RDFMediaType.RDF_NTRIPLES,
    RDFMediaType.RDF_XML,
    RDFMediaType.RDF_JSON
})
public Response queryInference(
        @Context Request req,
        @Context UriInfo uriInfo,
        @QueryParam("query") String queryString,
        @QueryParam("default-graph-uri") List<String> defgraphs,
        @QueryParam("named-graph-uri") List<String> namedgraphs) {
    return handleQuery(
            req, uriInfo, queryString, defgraphs, namedgraphs, "true");
}
项目:hadoop    文件:KMS.java   
@GET
@Path(KMSRESTConstants.KEYS_METADATA_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeysMetadata(@QueryParam(KMSRESTConstants.KEY)
    List<String> keyNamesList) throws Exception {
  KMSWebApp.getAdminCallsMeter().mark();
  UserGroupInformation user = HttpUserGroupInformation.get();
  final String[] keyNames = keyNamesList.toArray(
      new String[keyNamesList.size()]);
  assertAccess(KMSACLs.Type.GET_METADATA, user, KMSOp.GET_KEYS_METADATA);

  KeyProvider.Metadata[] keysMeta = user.doAs(
      new PrivilegedExceptionAction<KeyProvider.Metadata[]>() {
        @Override
        public KeyProvider.Metadata[] run() throws Exception {
          return provider.getKeysMetadata(keyNames);
        }
      }
  );

  Object json = KMSServerJSONUtils.toJSON(keyNames, keysMeta);
  kmsAudit.ok(user, KMSOp.GET_KEYS_METADATA, "");
  return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build();
}
项目:microprofile-jwt-auth    文件:ClaimValueInjectionEndpoint.java   
@GET
@Path("/verifyInjectedAudienceStandard")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedAudienceStandard(@QueryParam("aud") String audience) {
    boolean pass = false;
    String msg;
    // aud
    Set<String> audValue = audStandard.getValue();
    if(audValue == null || audValue.size() == 0) {
        msg = Claims.aud.name()+"value is null or empty, FAIL";
    }
    else if(audValue.contains(audience)) {
        msg = Claims.aud.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.aud.name(), audValue, audience);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
项目:agilion    文件:OffsetDateTimeProvider.java   
@Override
public Injectable<OffsetDateTime> getInjectable(final ComponentContext cc, final QueryParam a) {
    return new Injectable<OffsetDateTime>() {
        @Override
        public OffsetDateTime getValue() {
            final List<String> values = uriInfo.getQueryParameters().get(a.value());

            if (values == null || values.isEmpty())
                return null;
            if (values.size() > 1) {
                throw new WebApplicationException(Response.status(Status.BAD_REQUEST).
                        entity(a.value() + " cannot contain multiple values").build());
            }

            return OffsetDateTime.parse(values.get(0));
        }
    };
}
项目:neo4j-sparql-extension-yars    文件:GraphStore.java   
/**
 * Direct HTTP POST
 *
 * @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-post">
 * Section 5.5 "HTTP POST"
 * </a>
 * @param uriInfo JAX-RS {@link UriInfo} object
 * @param type Content-Type HTTP header field
 * @param chunked the "chunked" query parameter
 * @param in HTTP body as {@link InputStream}
 * @return "204 No Content", if operation was successful
 */
@POST
@Consumes({
    RDFMediaType.RDF_TURTLE,
    RDFMediaType.RDF_YARS,
    RDFMediaType.RDF_XML,
    RDFMediaType.RDF_NTRIPLES,
    RDFMediaType.RDF_XML
})
@Path("/{graph}")
public Response graphDirectPost(
        @Context UriInfo uriInfo,
        @HeaderParam("Content-Type") MediaType type,
        @QueryParam("chunked") String chunked,
        InputStream in) {
    String graphuri = uriInfo.getAbsolutePath().toASCIIString();
    return handleAdd(uriInfo, type, graphuri, null, in, chunked, false);
}
项目:emr-nlp-server    文件:WSInterface.java   
@GET
    @Path("getVarGridObj/{fn_modelFnList}/{fn_reportIDList}")
//  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    @Produces(MediaType.APPLICATION_JSON)   
    public Map<String, Object> getReportFromList(
            @PathParam("fn_reportIDList") String fn_reportIDList,
            @PathParam("fn_modelFnList") String fn_modelFnList,
            @QueryParam("callback") String callback) throws Exception {
        int topKwords = 5;
        boolean biasFeature = true;
        Map<String, Object> gridVarObj = 
//              GridVar_Controller.instance.getPrediction(fn_reportIDList,
//                      fn_modelFnList, topKwords, biasFeature);
                new GridVar_Controller().getPrediction(fn_reportIDList,
                        fn_modelFnList, topKwords, biasFeature);
        return gridVarObj;
    }
项目:MaximoForgeViewerPlugin    文件:ForgeRS.java   
@GET
   @Produces(MediaType.APPLICATION_JSON)
   @Path("bucket")
   public Response bucketList(
        @Context HttpServletRequest request,
        @QueryParam("region") String region
) 
    throws IOException, 
           URISyntaxException 
   {
    APIImpl impl = getAPIImpl( request );
    if( impl == null )
    {
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
    }

    ResultBucketList result = impl.bucketList( region );

    return formatReturn( result );
   }
项目:microprofile-jwt-auth    文件:ProviderInjectionEndpoint.java   
@GET
@Path("/verifyInjectedJTI")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedJTI(@QueryParam("jti") String jwtID) {
    boolean pass = false;
    String msg;
    // jti
    String jtiValue = jti.get();
    if(jtiValue == null || jtiValue.length() == 0) {
        msg = Claims.jti.name()+"value is null or empty, FAIL";
    }
    else if(jtiValue.equals(jwtID)) {
        msg = Claims.jti.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.jti.name(), jtiValue, jwtID);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
项目:MaximoForgeViewerPlugin    文件:ForgeRS.java   
@PUT
   @Produces(MediaType.APPLICATION_JSON)
   @Path("bucket/{bucketKey}/rights/{serviceId}")
   public Response bucketGrant(
        @Context HttpServletRequest request,
    @PathParam("bucketKey") String bucketKey,
    @PathParam("serviceId") String serviceId,
    @QueryParam("access")   String access
) 
    throws IOException, 
           URISyntaxException 
   {
    APIImpl impl = getAPIImpl( request );
    if( impl == null )
    {
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
    }
    Result result = impl.bucketGrantRightsV2( bucketKey, serviceId, access );
    return formatReturn( result );
   }
项目:MaximoForgeViewerPlugin    文件:ForgeRS.java   
@GET
   @Produces(MediaType.APPLICATION_JSON)
   @Path("model/{bucketKey}")
   public Response modelList(
        @Context HttpServletRequest request,
    @PathParam("bucketKey") String bucketKey,
    @QueryParam("name") String name,
    @QueryParam("start") String start,
    @QueryParam("pagesize") String pagesize
) 
    throws IOException, 
           URISyntaxException 
   {
    APIImpl impl = getAPIImpl( request );
    if( impl == null )
    {
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
    }
    Result result = impl.objectListPaged( bucketKey, name, start, pagesize );
    return formatReturn( result );
   }
项目:neo4j-sparql-extension-yars    文件:GraphStore.java   
/**
 * Indirect HTTP POST
 *
 * @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-post">
 * Section 5.5 "HTTP POST"
 * </a>
 * @param uriInfo JAX-RS {@link UriInfo} object
 * @param type Content-Type HTTP header field
 * @param graphString the "graph" query parameter
 * @param def the "default" query parameter
 * @param chunked the "chunked" query parameter
 * @param in HTTP body as {@link InputStream}
 * @return "204 No Content", if operation was successful
 */
@POST
@Consumes({
    RDFMediaType.RDF_TURTLE,
    RDFMediaType.RDF_YARS,
    RDFMediaType.RDF_XML,
    RDFMediaType.RDF_NTRIPLES,
    RDFMediaType.RDF_XML
})
public Response graphIndirectPost(
        @Context UriInfo uriInfo,
        @HeaderParam("Content-Type") MediaType type,
        @QueryParam("graph") String graphString,
        @QueryParam("default") String def,
        @QueryParam("chunked") String chunked,
        InputStream in) {
    return handleAdd(uriInfo, type, graphString, def, in, chunked, false);
}
项目:microprofile-jwt-auth    文件:ClaimValueInjectionEndpoint.java   
@GET
@Path("/verifyInjectedIssuer")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyInjectedIssuer(@QueryParam("iss") String iss) {
    boolean pass = false;
    String msg;
    String issValue = issuer.getValue();
    if(issValue == null || issValue.length() == 0) {
        msg = Claims.iss.name()+"value is null or empty, FAIL";
    }
    else if(issValue.equals(iss)) {
        msg = Claims.iss.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.iss.name(), issValue, iss);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
项目:soapbox-race-core    文件:Powerups.java   
@POST
@Secured
@Path("/activated/{powerupHash}")
@Produces(MediaType.APPLICATION_XML)
public String activated(@HeaderParam("securityToken") String securityToken, @PathParam(value = "powerupHash") Integer powerupHash, @QueryParam("targetId") Long targetId,
        @QueryParam("receivers") String receivers, @QueryParam("eventSessionId") Long eventSessionId) {
    XMPP_ResponseTypePowerupActivated powerupActivatedResponse = new XMPP_ResponseTypePowerupActivated();
    XMPP_PowerupActivatedType powerupActivated = new XMPP_PowerupActivatedType();
    powerupActivated.setId(Long.valueOf(powerupHash));
    powerupActivated.setTargetPersonaId(targetId);
    Long activePersonaId = tokenBO.getActivePersonaId(securityToken);
    powerupActivated.setPersonaId(activePersonaId);
    powerupActivatedResponse.setPowerupActivated(powerupActivated);
    for (String receiver : receivers.split("-")) {
        Long receiverPersonaId = Long.valueOf(receiver);
        if (receiverPersonaId > 10) {
            openFireSoapBoxCli.send(powerupActivatedResponse, receiverPersonaId);
        }
    }
    return "";
}
项目:athena    文件:ApplicationResource.java   
@Path("upload")
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response upload(@QueryParam("activate") @DefaultValue("false") String activate,
                       @FormDataParam("file") InputStream stream) throws IOException {
    ApplicationAdminService service = get(ApplicationAdminService.class);
    Application app = service.install(stream);
    lastInstalledAppName = app.id().name();
    if (Objects.equals(activate, "true")) {
        service.activate(app.id());
    }
    return Response.ok().build();
}
项目:alvisnlp    文件:RunResource.java   
@GET
@Path("/{id}/output/{path:.*}")
public Response output(
        @PathParam("id") String id,
        @PathParam("path") String path,
        @DefaultValue("false") @QueryParam("recdir") boolean recdir
        ) throws IOException, SAXException, ClassNotFoundException, InstantiationException, IllegalAccessException {
    return output(id, path, recdir ? Integer.MAX_VALUE : 1);
}
项目:task-app    文件:TaskDaoResource.java   
@POST
@RolesAllowed(value = "TASK_APP_CLIENT")
@Path("/getTaskProperties")
@Produces(MediaType.APPLICATION_JSON)
public List<TaskProperty> getTaskProperties(
        @QueryParam("taskId") Long taskId) {
    List<TaskProperty> result = new ArrayList<>();
    List<JmdTaskProperty> list = taskDao.getProperties(taskId);
    list.forEach((jmdTaskProperty) -> {
        TaskProperty taskProperty = new TaskProperty();
        new Dto().objToObj(jmdTaskProperty, taskProperty);
        result.add(taskProperty);
    });
    return result;
}
项目:dremio-oss    文件:DataGraphResource.java   
@GET
@Produces(APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{version}")
public DataGraph getDataGraph(@PathParam("version") DatasetVersion version,
                              @QueryParam("currentView") DatasetPath currentView,
                              @QueryParam("searchParents") String parentFilter,
                              @QueryParam("searchChildren") String childrenFilter) throws NamespaceException {
  return datasetService.getDataGraph(datasetPath, version, currentView, parentFilter, childrenFilter);
}
项目:crnk-framework    文件:QueryParamProvider.java   
@Override
public Object provideValue(Parameter parameter, ContainerRequestContext requestContext, ObjectMapper objectMapper) {
    Object returnValue;
    List<String> value =
            requestContext.getUriInfo().getQueryParameters().get(parameter.getAnnotation(QueryParam.class).value());
    if (value == null || value.isEmpty()) {
        return null;
    }
    else {
        if (String.class.isAssignableFrom(parameter.getType())) {
            // Given a query string: ?x=y&x=z, JAX-RS will return a value of y.
            returnValue = value.get(0);
        }
        else if (Iterable.class.isAssignableFrom(parameter.getType())) {
            returnValue = value;
        }
        else {
            try {
                returnValue = objectMapper.readValue(value.get(0), parameter.getType());
            }
            catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
    }
    return returnValue;
}
项目:message-broker    文件:QueuesApi.java   
@GET
@Produces({"application/json"})
@ApiOperation(value = "Get all queues", notes = "Gets metadata of all the queues in the broker. This includes "
        + "durable  and non durable queues.  ", response = QueueMetadata.class, responseContainer = "List", tags
        = {})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "List of queues", response = QueueMetadata.class, responseContainer =
                "List")})
public Response getAllQueues(@QueryParam("durable") @ApiParam("filter queues by durability") Boolean durable) {
    return delegate.getAllQueues(durable);
}
项目:jboot    文件:UserServiceImpl.java   
@Override
@GET
@Path("hello")
@Consumes({MediaType.APPLICATION_JSON})
public String test(@QueryParam("name") String name) {

    System.out.println("UserServiceImpl test() invoked!!!");
    return Ret.ok().set("name",name).toJson();
}
项目:fuck_zookeeper    文件:ZNodeResource.java   
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getZNodeList(
        @PathParam("path") String path,
        @QueryParam("callback") String callback,
        @DefaultValue("data") @QueryParam("view") String view,
        @DefaultValue("base64") @QueryParam("dataformat") String dataformat,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    return getZNodeList(false, path, callback, view, dataformat, ui);
}