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

项目:gitplex-mit    文件:CommitStatusResource.java   
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{projectName}/statuses/{commit}")
   @POST
   public Response save(@PathParam("projectName") String projectName, @PathParam("commit") String commit, 
        Map<String, String> commitStatus, @Context UriInfo uriInfo) {

    Project project = getProject(projectName);
    if (!SecurityUtils.canWrite(project))
        throw new UnauthorizedException();

    String state = commitStatus.get("state").toUpperCase();
    if (state.equals("PENDING"))
        state = "RUNNING";
    Verification verification = new Verification(Verification.Status.valueOf(state), 
            new Date(), commitStatus.get("description"), commitStatus.get("target_url"));
    String context = commitStatus.get("context");
    if (context == null)
        context = "default";
    verificationManager.saveVerification(project, commit, context, verification);
    UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
    uriBuilder.path(context);
    commitStatus.put("id", "1");

    return Response.created(uriBuilder.build()).entity(commitStatus).type(RestConstants.JSON_UTF8).build();
   }
项目:bluemix-liberty-microprofile-demo    文件:MeetingBookingService.java   
@POST
@Path("/meeting")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
public Reservation make(Reservation reservation) {
    if (reservation.getId() != null)
        throw new BadRequestException(MessageFormat.format(ERROR_RESERVATION_IS_EXISTS_FMT, reservation.getId()));
    Set<Reservation> alreadyMadeReservations = reservationDao.getReservations(
            reservation.getVenue(), 
            reservation.getDate(), 
            reservation.getStartTime(),
            reservation.getDuration());
    if (alreadyMadeReservations != null && !alreadyMadeReservations.isEmpty())
        throw new BadRequestException(MessageFormat.format(ERROR_RESERVATION_CONFLICT_FMT, reservation.getVenue()));

    return reservationDao.createNew(reservation);
}
项目:lra-service    文件:InvoiceEndpoint.java   
@POST
@Path(LRAOperationAPI.REQUEST)
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_JSON)
@LRA(value = LRA.Type.REQUIRED)
public Response requestInvoice(@HeaderParam(LRAClient.LRA_HTTP_HEADER) String lraUri, OrderInfo orderInfo) {
    String lraId = LRAClient.getLRAId(lraUri);
    log.info("processing request for LRA " + lraId);

    invoiceService.computeInvoice(lraId, orderInfo);

    //stub for compensation scenario
    if ("failInvoice".equals(orderInfo.getProduct().getProductId())) {
        return Response
                .status(Response.Status.BAD_REQUEST)
                .entity("Invoice for order " + orderInfo.getOrderId() + " failure")
                .build();
    }

    return Response
            .ok()
            .entity(String.format("Invoice for order %s processed", orderInfo.getOrderId()))
            .build();
}
项目:athena    文件:FlowClassifierWebResource.java   
/**
 * Update details of a flow classifier.
 *
 * @param id
 *            flow classifier id
 * @param stream
 *            InputStream
 * @return 200 OK, 404 if given identifier does not exist
 */
@PUT
@Path("{flow_id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response updateFlowClassifier(@PathParam("flow_id") String id, final InputStream stream) {
    try {

        JsonNode jsonTree = mapper().readTree(stream);
        JsonNode flow = jsonTree.get("flow_classifier");
        FlowClassifier flowClassifier = codec(FlowClassifier.class).decode((ObjectNode) flow, this);
        Boolean result = nullIsNotFound(get(FlowClassifierService.class).updateFlowClassifier(flowClassifier),
                                        FLOW_CLASSIFIER_NOT_FOUND);
        return Response.status(OK).entity(result.toString()).build();
    } catch (IOException e) {
        log.error("Update flow classifier failed because of exception {}.", e.toString());
        throw new IllegalArgumentException(e);
    }
}
项目:clemon    文件:UserResource.java   
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
@Path("/save")
public Object saveUser(@FormParam("userName") String userName,@FormParam("userPass") String userPass){
    String jsonData = "";
    User u = new User();
    u.setUserName(userName);
    u.setUserPass(userPass);
    try {
        userService.save(u);
    } catch (Exception e) {
        //-- 统一在过滤器中添加跨域访问的header信息,所以这里就不添加了
        jsonData = JsonUtil.toJsonByProperty("addUser","failure");
        return Response.ok(jsonData).status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR ).build();
    }
    jsonData = JsonUtil.toJsonByProperty("id", u.getId());
    return Response.ok(jsonData).status(HttpServletResponse.SC_OK).build();
}
项目:microservices-transactions-tcc    文件:CompositeTransactionParticipantController.java   
@DELETE
@Path("/tcc/{txid}")
@Consumes("application/tcc")
   @ApiOperation(
        code = 204,
        response = String.class,
           value = "Rollback a given composite transaction",
           notes = "See https://www.atomikos.com/Blog/TransactionManagementAPIForRESTTCC",
           consumes = "application/tcc"
       )
public void cancel(
        @ApiParam(value = "Id of the composite transaction to rollback", required = true) @PathParam("txid") String txid
        ){
    LOG.info("Trying to rollback transaction [{}]", txid);

    getCompositeTransactionParticipantService().cancel(txid);

    LOG.info("Transaction [{}] rolled back", txid);
}
项目:ctsms    文件:FileResource.java   
@PUT
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_JSON })
public FileOutVO updateFile(@FormDataParam("json") FormDataBodyPart json,
        @FormDataParam("data") FormDataBodyPart content,
        @FormDataParam("data") FormDataContentDisposition contentDisposition,
        @FormDataParam("data") final InputStream input) throws AuthenticationException, AuthorisationException, ServiceException {
    // in.setId(fileId);
    json.setMediaType(MediaType.APPLICATION_JSON_TYPE);
    FileInVO in = json.getValueAs(FileInVO.class);
    FileStreamInVO stream = new FileStreamInVO();
    stream.setStream(input);
    stream.setMimeType(content.getMediaType().toString()); // .getType());
    stream.setSize(contentDisposition.getSize());
    stream.setFileName(contentDisposition.getFileName());
    return WebUtil.getServiceLocator().getFileService().updateFile(auth, in, stream);
}
项目:athena    文件:OpenstackPortWebResource.java   
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createPorts(InputStream input) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode portNode = (ObjectNode) mapper.readTree(input);

        OpenstackPort openstackPort = PORT_CODEC.decode(portNode, this);
        OpenstackSwitchingService switchingService =
                getService(OpenstackSwitchingService.class);
        switchingService.createPorts(openstackPort);

        log.debug("REST API ports is called with {}", portNode.toString());
        return Response.status(Response.Status.OK).build();

    } catch (Exception e) {
        log.error("Creates Port failed because of exception {}",
                e.toString());
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
项目:syndesis    文件:OAuthAppHandler.java   
@PUT
@Path(value = "/{id}")
@Consumes("application/json")
public void update(@NotNull @PathParam("id") String id, @NotNull @Valid OAuthApp app) {
    final Connector connector = dataMgr.fetch(Connector.class, id);
    if (connector == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }

    final Connector updated = new Connector.Builder().createFrom(connector)
        .putOrRemoveConfiguredPropertyTaggedWith(Credentials.CLIENT_ID_TAG, app.clientId)
        .putOrRemoveConfiguredPropertyTaggedWith(Credentials.CLIENT_SECRET_TAG, app.clientSecret)
        .build();

    dataMgr.update(updated);
}
项目:athena    文件:RegionsWebResource.java   
/**
 * Updates the specified region using the supplied JSON input stream.
 *
 * @param regionId region identifier
 * @param stream region JSON stream
 * @return status of the request - UPDATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 * @onos.rsModel RegionPost
 */
@PUT
@Path("{regionId}")
@Consumes(MediaType.APPLICATION_JSON)
public Response updateRegion(@PathParam("regionId") String regionId,
                             InputStream stream) {
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        JsonNode specifiedRegionId = jsonTree.get("id");

        if (specifiedRegionId != null &&
                !specifiedRegionId.asText().equals(regionId)) {
            throw new IllegalArgumentException(REGION_INVALID);
        }

        final Region region = codec(Region.class).decode(jsonTree, this);
        regionAdminService.updateRegion(region.id(),
                            region.name(), region.type(), region.masters());
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }

    return Response.ok().build();
}
项目:opencps-v2    文件:RegistrationLogManagement.java   
@POST
@Path("/registrations/{id}/logs")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addRegistrationByRegistrationId)", response = RegistrationLogModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the RegistrationgModel was updated", response = RegistrationResultsModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addRegistrationByRegistrationId(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext,
        @ApiParam(value = "id of registration", required = true) @PathParam("id") long id,
        @ApiParam(value = "Metadata of RegistrationLog") @Multipart("author") String author,
        @ApiParam(value = "Metadata of RegistrationLog") @Multipart("payload") String payload,
        @ApiParam(value = "Metadata of RegistrationLog") @Multipart("content") String content);
项目:osc-core    文件:ServerMgmtApis.java   
@ApiOperation(value = "Upload a private/public certificate zip file. ",
        notes = "Overwrites the entry marked &quot;internal&quot; in the truststore. "
        + "That is a private/public keypair used for secure connections by OSC. "
        + "The zip file should contain a  &quot;key.pem&quot; in PKCS8+PEM format (private key) and "
        + "certchain.pem or certchain.pkipath (the certificate chain). This results in the server restart ! ! !",
        response = BaseResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/internalkeypair")
@POST
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response uploadKeypair(@Context HttpHeaders headers,
        @ApiParam(value = "The imported keypair zip file name",
        required = true) @PathParam("fileName") String fileName,
        @ApiParam(required = true) InputStream uploadedInputStream) {
    logger.info("Started uploading file " + fileName);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    return this.apiUtil.getResponseForBaseRequest(this.replaceInternalKeypairServiceApi,
            new UploadRequest(fileName, uploadedInputStream));
}
项目:opencps-v2    文件:PaymentFileManagement.java   
@POST
@Path("/{id}/payments/{referenceUid}/epaymentprofile")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add epaymentprofile", response = JSONObject.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns epaymentprofile was update", response = JSONObject.class),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class) })
public Response updateEpaymentProfile(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext,
        @ApiParam(value = "id of Payment", required = true) @PathParam("id") String id,
        @ApiParam (value = "referenceUid of Payment", required = true) @PathParam("referenceUid") String referenceUid,
        @BeanParam PaymentFileInputModel input);
项目:nifi-registry    文件:BucketFlowResource.java   
@DELETE
@Path("{flowId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Deletes a flow.",
        response = VersionedFlow.class
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response deleteFlow(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    authorizeBucketAccess(RequestAction.DELETE, bucketId);
    final VersionedFlow deletedFlow = registryService.deleteFlow(bucketId, flowId);
    return Response.status(Response.Status.OK).entity(deletedFlow).build();
}
项目:opencps-v2    文件:RegistrationFormManagement.java   
@PUT
@Path("/registrations/{id}/forms/{referenceUid}/formdata")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update RegistrationForm")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateRegFormFormData(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext,
        @ApiParam(value = "registrationId", required = true) @PathParam("id") long id,
        @ApiParam(value = "referenceUid", required = true) @PathParam("referenceUid") String referenceUid,
        @ApiParam(value = "formdata of registrationForm", required = true) @FormParam("formdata") String formdata)
        throws PortalException;
项目:E-Clinic    文件:ContactRestEndPoint.java   
@POST
@Path("create")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response create(@Valid Contact value) {
    try {
        contactService.create(value);
    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity("Data is saved").build();
}
项目:E-Clinic    文件:GuardianRestEndPoint.java   
@PUT
@Path("update")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response update(@Valid Guardian value) throws Throwable {
    try {
        guardianService.update(value);
    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity("Date is updated").build();
}
项目:syndesis    文件:JsonDBResource.java   
@Path("/{path: .*}.json")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@POST
public HashMap<String, String> push(@PathParam("path") String path, InputStream body) {
    HashMap<String, String> result = new HashMap<>();
    result.put("name", jsondb.push(path, body));
    return result;
}
项目:elastic-job-cloud    文件:CloudJobRestfulApi.java   
/**
 * 更新作业配置.
 *
 * @param jobConfig 作业配置
 */
@PUT
@Path("/update")
@Consumes(MediaType.APPLICATION_JSON)
public void update(final CloudJobConfiguration jobConfig) {
    producerManager.update(jobConfig);
}
项目:opencps-v2    文件:DeliverablesLogManagement.java   
@GET
@Path("/deliverables/{id}/logs")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get info log for deliverable id")
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access defined", response = ExceptionModel.class) })
public Response getDeliverableLog(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
        @ApiParam(value = "id for Deliverable Log", required = true) @PathParam("id") Long id);
项目:message-broker    文件:QueuesApi.java   
@POST
@Consumes({"application/json"})
@Produces({"application/json"})
@ApiOperation(value = "Creates a queue", notes = "", response = QueueCreateResponse.class, tags = {})
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Queue created.", response = QueueCreateResponse.class),
        @ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.",
                     response = Error.class),
        @ApiResponse(code = 415, message = "Unsupported media type. The entity of the request was in a not "
                + "supported format.", response = Error.class)})
public Response createQueue(@Valid QueueCreateRequest body) {
    return delegate.createQueue(body);
}
项目:java-ml-projects    文件:DataSetResource.java   
@POST
@Path("{label}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void receiveFile(MultipartInput input, @PathParam("label") String label) {
    List<InputPart> parts = input.getParts();
    parts.stream().filter(p -> p.getMediaType().getType().startsWith("image"))
            .forEach(p -> this.saveImage(p, label));
    input.close();
}
项目:GitHub    文件:Resource.java   
@Path("/doubleInMapTest")
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public MapTest getDoubleInMapTest() {

  return ImmutableMapTest.builder()
      .putMapDouble("double", 5.0)
      .build();
}
项目:nifi-registry    文件:BucketFlowResource.java   
@GET
@Path("{flowId}/versions/{versionNumber: \\d+}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Gets the given version of a flow",
        response = VersionedFlowSnapshot.class
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlowVersion(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId,
        @PathParam("versionNumber")
        @ApiParam("The version number")
            final Integer versionNumber) {
    authorizeBucketAccess(RequestAction.READ, bucketId);

    final VersionedFlowSnapshot snapshot = registryService.getFlowSnapshot(bucketId, flowId, versionNumber);
    populateLinksAndPermissions(snapshot);

    return Response.status(Response.Status.OK).entity(snapshot).build();
}
项目:opencps-v2    文件:ServiceInfoManagement.java   
@GET
@Path("/statistics/domains")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get StatisticByLevel", response = StatisticsLevelResultsModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of ServiceInfo", response = StatisticsLevelResultsModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response getStatisticByDomain(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext);
项目:jersey-jwt    文件:AuthenticationResource.java   
/**
 * Validate user credentials and issue a token for the user.
 *
 * @param credentials
 * @return
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@PermitAll
public Response authenticate(UserCredentials credentials) {

    User user = usernamePasswordValidator.validateCredentials(credentials.getUsername(), credentials.getPassword());
    String token = authenticationTokenService.issueToken(user.getUsername(), user.getAuthorities());
    AuthenticationToken authenticationToken = new AuthenticationToken();
    authenticationToken.setToken(token);
    return Response.ok(authenticationToken).build();
}
项目:opencps-v2    文件:FileAttachManagement.java   
@GET
@Path("/{className}/{classPK}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getFileAttachs(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, 
        @PathParam("className") String className, @PathParam("classPK") String classPK,
        @BeanParam DataSearchModel query);
项目:opencps-v2    文件:EmployeeManagement.java   
@DELETE
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response delete(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company,
        @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
        @DefaultValue("0") @PathParam("id") long id);
项目:opencps-v2    文件:ServiceInfoManagement.java   
@GET
@Path("/{id}/filetemplates")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get FileTemplate list of ServiceInfo by its id)", response = FileTemplateResultsModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the list of FileTemplate of ServiceInfo", response = FileTemplateResultsModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response getFileTemplatesOfServiceInfo(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext,
        @ApiParam(value = "id of ServiceInfo that need to be get the list of FileTemplates", required = true) @PathParam("id") String id);
项目:opencps-v2    文件:ServiceProcessManagement.java   
@PUT
@Path("/{id}/roles/{roleid}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update the ServiceProcessRole of a ServiceProcess by its id", response = RoleInputModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceProcessRole was update", response = RoleInputModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response updateServiceProcessRole(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("roleid") long roleid,
        @BeanParam RoleInputModel input);
项目:nifi-registry    文件:BucketResource.java   
@GET
@Path("fields")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Retrieves field names for searching or sorting on buckets.",
        response = Fields.class
)
public Response getAvailableBucketFields() {
    final Set<String> bucketFields = registryService.getBucketFields();
    final Fields fields = new Fields(bucketFields);
    return Response.status(Response.Status.OK).entity(fields).build();
}
项目:presto-manager    文件:PackageAPI.java   
@PUT
@Consumes(TEXT_PLAIN)
@Produces(TEXT_PLAIN)
@ApiOperation(value = "Install Presto using rpm or tarball")
@ApiResponses(value = {
        @ApiResponse(code = 202, message = "Acknowledged request"),
        @ApiResponse(code = 400, message = "Invalid url"),
        @ApiResponse(code = 409, message = "Presto is already installed.")
})
public synchronized Response install(@ApiParam("Url to fetch package") String packageUrl,
        @QueryParam("checkDependencies") @DefaultValue("true") @ApiParam("If false, disables dependency checking") boolean checkDependencies)
{
    return controller.install(packageUrl, checkDependencies);
}
项目:dremio-oss    文件:SourceResource.java   
@POST
@Path("new_untitled_from_file/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public InitialPreviewResponse createUntitledFromSourceFile(@PathParam("path") String path)
  throws DatasetNotFoundException, DatasetVersionNotFoundException, NamespaceException, NewDatasetQueryException {
  return datasetsResource.createUntitledFromSourceFile(sourceName, path);
}
项目:opencps-v2    文件:DataManagement.java   
@POST
@Path("/{code}/dictgroups")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addDictgroups(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
        @PathParam("code") String code, @BeanParam DictGroupInputModel input);
项目:elastic-job-cloud    文件:CloudJobRestfulApi.java   
/**
 * 获取作业执行类型统计数据.
 * 
 * @return 作业执行类型统计数据
 */
@GET
@Path("/statistics/jobs/executionType")
@Consumes(MediaType.APPLICATION_JSON)
public JobExecutionTypeStatistics getJobExecutionTypeStatistics() {
    return statisticManager.getJobExecutionTypeStatistics();
}
项目:opencps-v2    文件:ServerConfigManagement.java   
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a ServerConfig", response = ServerConfigDetailModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the ServerConfig was created", response = ServerConfigDetailModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response addServerConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, @BeanParam ServerConfigInputModel input);
项目:verify-hub    文件:RpAuthnResponseGeneratorResource.java   
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Timed
public Response generate(ResponseFromHubDto responseFromHub) throws JsonProcessingException {
    return Response.ok().entity(service.generate(responseFromHub)).type(MediaType.APPLICATION_JSON_TYPE).build();
}
项目:SistemaAlmoxarifado    文件:UsuarioResource.java   
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Path("/getid")
public Response  getId(@HeaderParam("token") String token, 
        @QueryParam("id") int id) throws SQLException, Exception {

    if(!Verify(token, "admin")) 
        return Response.status(Response.Status.UNAUTHORIZED).build();

    Gson gson = new Gson();
    Usuario u = UsuarioDAO.retreave(id);

    return Response.status(Response.Status.OK)
            .entity(gson.toJson(u)).build();
}
项目:opencps-v2    文件:UserManagement.java   
@POST
@Path("/{id}/changepass")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addChangepass(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, @PathParam("id") long id,
        @FormParam("oldPassword") String oldPassword, @FormParam("newPassword") String newPassword);
项目:Hybrid-Cloud-Applications-and-Services    文件:BookingResource.java   
@POST
@ApiOperation("Create a booking")
@Consumes("application/json")
@Produces("application/json")
@ApiResponses({
    @ApiResponse(code = 201, message= "Booking created", response=String.class)})
public Response createBooking(Booking task){
    return Controller.createBooking(task);
}