當前位置: 首頁>>代碼示例>>Java>>正文


Java PUT類代碼示例

本文整理匯總了Java中javax.ws.rs.PUT的典型用法代碼示例。如果您正苦於以下問題:Java PUT類的具體用法?Java PUT怎麽用?Java PUT使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PUT類屬於javax.ws.rs包,在下文中一共展示了PUT類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: install

import javax.ws.rs.PUT; //導入依賴的package包/類
@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);
}
 
開發者ID:prestodb,項目名稱:presto-manager,代碼行數:22,代碼來源:ControllerPackageAPI.java

示例2: updateDistributedAppliance

import javax.ws.rs.PUT; //導入依賴的package包/類
@ApiOperation(value = "Updates a Distributed Appliance",
        notes = "Updates a Distributed Appliance and sync's it immediately.",
        response = BaseJobResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{distributedApplianceId}")
@PUT
public Response updateDistributedAppliance(@Context HttpHeaders headers,
                                           @ApiParam(value = "The Id of the Distributed Appliance",
                                                   required = true) @PathParam("distributedApplianceId") Long distributedApplianceId,
                                           @ApiParam(required = true) DistributedApplianceDto daDto) {
    logger.info("Updating Distributed Appliance " + distributedApplianceId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    this.apiUtil.setIdOrThrow(daDto, distributedApplianceId, "DistributedAppliance");
    return this.apiUtil.getResponseForBaseRequest(this.updateDistributedApplianceService,
            new BaseRequest<DistributedApplianceDto>(daDto));
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:18,代碼來源:DistributedApplianceApis.java

示例3: update

import javax.ws.rs.PUT; //導入依賴的package包/類
@PUT
@Path("/{id:[0-9][0-9]*}")
@Consumes("application/json")
public Response update(@PathParam("id") Long id, Person entity) {
	if (entity == null) {
		return Response.status(Status.BAD_REQUEST).build();
	}
	if (id == null) {
		return Response.status(Status.BAD_REQUEST).build();
	}
	if (!id.equals(entity.getId())) {
		return Response.status(Status.CONFLICT).entity(entity).build();
	}
	if (em.find(Person.class, id) == null) {
		return Response.status(Status.NOT_FOUND).build();
	}
	try {
		entity = em.merge(entity);
	} catch (OptimisticLockException e) {
		return Response.status(Response.Status.CONFLICT)
				.entity(e.getEntity()).build();
	}

	return Response.noContent().build();
}
 
開發者ID:gastaldi,項目名稱:demo-ang2,代碼行數:26,代碼來源:PersonEndpoint.java

示例4: putConnectorConfig

import javax.ws.rs.PUT; //導入依賴的package包/類
@PUT
@Path("/{connector}/config")
public Response putConnectorConfig(final @PathParam("connector") String connector,
                                   final @QueryParam("forward") Boolean forward,
                                   final Map<String, String> connectorConfig) throws Throwable {
    FutureCallback<Herder.Created<ConnectorInfo>> cb = new FutureCallback<>();
    String includedName = connectorConfig.get(ConnectorConfig.NAME_CONFIG);
    if (includedName != null) {
        if (!includedName.equals(connector))
            throw new BadRequestException("Connector name configuration (" + includedName + ") doesn't match connector name in the URL (" + connector + ")");
    } else {
        connectorConfig.put(ConnectorConfig.NAME_CONFIG, connector);
    }

    herder.putConnectorConfig(connector, connectorConfig, true, cb);
    Herder.Created<ConnectorInfo> createdInfo = completeOrForwardRequest(cb, "/connectors/" + connector + "/config",
            "PUT", connectorConfig, new TypeReference<ConnectorInfo>() { }, new CreatedConnectorInfoTranslator(), forward);
    Response.ResponseBuilder response;
    if (createdInfo.created())
        response = Response.created(URI.create("/connectors/" + connector));
    else
        response = Response.ok();
    return response.entity(createdInfo.result()).build();
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:25,代碼來源:ConnectorsResource.java

示例5: updateProduct

import javax.ws.rs.PUT; //導入依賴的package包/類
@ApiOperation("Update a product")
@ApiResponses({ @ApiResponse(code = 204, message = "Product updated"),
		@ApiResponse(code = 404, message = "Product not found") })
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public Response updateProduct(@ProductModel PropertyBox product) {
	if (product == null) {
		return Response.status(Status.BAD_REQUEST).entity("Missing product").build();
	}
	if (!product.getValueIfPresent(MProduct.ID).isPresent()) {
		return Response.status(Status.BAD_REQUEST).entity("Missing product id").build();
	}
	return getProductStore().get(product.getValue(MProduct.ID)).map(p -> {
		getProductStore().put(product);
		return Response.noContent().build();
	}).orElse(Response.status(Status.NOT_FOUND).build());
}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:19,代碼來源:ProductEndpoint.java

示例6: updatePaymentFileApprovalNoAttachment

import javax.ws.rs.PUT; //導入依賴的package包/類
@PUT
@Path("/{id}/payments/{referenceUid}/approval/noattachment")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@ApiOperation(value = "Update PaymentFile")
@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 updatePaymentFileApprovalNoAttachment(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid,
		@BeanParam PaymentFileInputModel input);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:17,代碼來源:PaymentFileManagement.java

示例7: updateRouter

import javax.ws.rs.PUT; //導入依賴的package包/類
@PUT
@Path("{routerUUID}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response updateRouter(@PathParam("routerUUID") String id,
                             final InputStream input) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode subnode = mapper.readTree(input);
        Collection<Router> routers = changeUpdateJsonToSub(subnode, id);
        Boolean result = nullIsNotFound(get(RouterService.class)
                .updateRouters(routers), UPDATE_FAIL);
        if (!result) {
            return Response.status(CONFLICT).entity(UPDATE_FAIL).build();
        }
        return ok(result.toString()).build();
    } catch (Exception e) {
        return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
    }
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:21,代碼來源:RouterWebResource.java

示例8: logEvent

import javax.ws.rs.PUT; //導入依賴的package包/類
@PUT
	@Path("logEvent/{fn_event}")
	public void logEvent(@HeaderParam("uid") String uid,
			String message,
			@PathParam("fn_event") String event)
			throws Exception {
				File dir = new File(Storage_Controller.getBaseFolder());
				File log = new File(dir, "log.txt");
				
				if(!log.exists()){
	    			log.createNewFile();
	    		}
				
				SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
				String time  = dateFormat.format(new Date());
				
				BufferedWriter output = new BufferedWriter(new FileWriter(log, true));
				
//				System.out.println("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n");
				output.write("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n");
	            output.flush();
	}
 
開發者ID:NLPReViz,項目名稱:emr-nlp-server,代碼行數:23,代碼來源:WSInterface.java

示例9: saveOrUpdate

import javax.ws.rs.PUT; //導入依賴的package包/類
/**
 * Create a setting for current user, and assign as a cookie the hash value.
 * 
 * @param newPreferred
 *            The new preferred URL.
 * @return The response containing the cookie.
 */
@POST
@PUT
public Response saveOrUpdate(final String newPreferred) {

	// Save the new URL
	userSettingResource.saveOrUpdate(PREFERRED_URL, newPreferred);

	// Check the current hash
	SystemUserSetting setting = repository.findByLoginAndName(securityHelper.getLogin(), PREFERRED_HASH);
	if (setting == null) {

		// No hash generated for this user, create a new one
		setting = new SystemUserSetting();
		setting.setLogin(SecurityContextHolder.getContext().getAuthentication().getName());
		setting.setName(PREFERRED_HASH);
		setting.setValue(GENERATOR.generate(100));
		repository.saveAndFlush(setting);
	}

	// Send back to the user the cookie
	return addCookie(Response.noContent(), securityHelper.getLogin(), setting.getValue()).build();
}
 
開發者ID:ligoj,項目名稱:plugin-redirect,代碼行數:30,代碼來源:RedirectResource.java

示例10: updateDomain

import javax.ws.rs.PUT; //導入依賴的package包/類
/**
 * Updates the Domain for a given domain Id
 *
 * @return - updated Domain
 */
@Path("/{domainId}")
@PUT
public DomainEntity updateDomain(@PathParam("domainId") Long domainId, DomainEntity entity) {

    LOG.info("Updating Domain Entity ID...:" + domainId);

    return this.txControl.required(new Callable<DomainEntity>() {

        @Override
        public DomainEntity call() throws Exception {

            DomainEntity result = DomainApis.this.em.find(DomainEntity.class, domainId);
            if (result == null) {
                throw new Exception("Domain Entity does not exists...");
                //TODO - to add RETURN 404 error:Sudhir
            }
            result.setName(entity.getName());
            DomainApis.this.em.persist(result);
            return result;
        }
    });
}
 
開發者ID:opensecuritycontroller,項目名稱:security-mgr-sample-plugin,代碼行數:28,代碼來源:DomainApis.java

示例11: updateSecurityGroupInterface

import javax.ws.rs.PUT; //導入依賴的package包/類
@Path("/{sgiId}")
@PUT
public SecurityGroupInterfaceEntity updateSecurityGroupInterface(@PathParam("sgiId") Long sgiId,
        @PathParam("deviceId") Long deviceId, SecurityGroupInterfaceEntity entity) throws Exception {
    LOG.info(String.format("Updating the security group interface with sginterfaceid %s", Long.toString(sgiId)));

    DeviceEntity device = this.validationUtil.getDeviceOrThrow(Long.toString(deviceId));
    this.validationUtil.validateIdMatches(device, Long.parseLong(entity.getDevice().getId()),
            "SecurityGroupInterface");

    VirtualSystemElementImpl vs = new VirtualSystemElementImpl(deviceId, null);
    this.sgiApi = new IsmSecurityGroupInterfaceApi(vs, null, this.txControl, this.em);
    entity.setId(sgiId);

    this.sgiApi.updateSecurityGroupInterface(new SecurityGroupInterfaceElementImpl(entity));

    return entity;
}
 
開發者ID:opensecuritycontroller,項目名稱:security-mgr-sample-plugin,代碼行數:19,代碼來源:SecurityGroupInterfaceApis.java

示例12: update

import javax.ws.rs.PUT; //導入依賴的package包/類
@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);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:17,代碼來源:OAuthAppHandler.java

示例13: getDistributedApplianceInstanceStatus

import javax.ws.rs.PUT; //導入依賴的package包/類
@ApiOperation(value = "Retrieves the Distributed Appliance Instances status",
        notes = "Retrieves the Distributed Appliance Instances statuses specified by the Ids",
        response = GetAgentStatusResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/status")
@PUT
public GetAgentStatusResponse getDistributedApplianceInstanceStatus(@Context HttpHeaders headers,
                                                                       @ApiParam(value = "The Ids of the Distributed Appliance Instances to get status for",
                                                                               required = true) DistributedApplianceInstancesRequest req) {

    logger.info("Getting Distributed Appliance Instance Status " + req);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));

    return this.apiUtil.submitRequestToService(this.getAgentStatusService, req);
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:DistributedApplianceInstanceApis.java

示例14: update

import javax.ws.rs.PUT; //導入依賴的package包/類
/**
 * Update a named token with a new generated one.
 * 
 * @param name
 *            Token to update.
 * @return the new generated token.
 */
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("{name:[\\w\\-\\.]+}")
public String update(@PathParam("name") final String name) throws GeneralSecurityException {
	final SystemApiToken entity = repository.findByUserAndName(securityHelper.getLogin(), name);
	if (entity == null) {
		// No token with given name
		throw new EntityNotFoundException();
	}

	// Token has been found, update it
	final String token = newToken(entity);
	repository.saveAndFlush(entity);
	return token;
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:23,代碼來源:ApiTokenResource.java

示例15: update

import javax.ws.rs.PUT; //導入依賴的package包/類
@PermitAll
@PUT
@Path("/")
@Produces("application/json")
@Consumes("application/json")
public Response update(AirConditioning air) {
	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {
		AirConditioningDao.getInstance().update(air);
		builder.status(Response.Status.OK).entity(air);

	} catch (SQLException exception) {
		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}
	return builder.build();

}
 
開發者ID:mrh3nry,項目名稱:Celebino,代碼行數:20,代碼來源:AirConditioningController.java


注:本文中的javax.ws.rs.PUT類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。