当前位置: 首页>>代码示例>>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;未经允许,请勿转载。