DeviceResource.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:devicehive-java-server 作者:
/**
 * Implementation of <a href="http://www.devicehive.com/restful#Reference/Device/register">DeviceHive RESTful API:
 * Device: register</a> Registers a device. If device with specified identifier has already been registered, it gets
 * updated in case when valid key is provided in the authorization header.
 *
 * @param deviceUpdate In the request body, supply a Device resource. See <a href="http://www.devicehive
 *                     .com/restful#Reference/Device/register">
 * @param deviceId   Device unique identifier.
 * @return response code 201, if successful
 */
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@PreAuthorize("isAuthenticated() and hasPermission(null, 'REGISTER_DEVICE')")
@ApiOperation(value = "Register device", notes = "Registers or updates a device. For initial device registration, only 'name' property is required.")
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "Authorization token", required = true, dataType = "string", paramType = "header")
})
@ApiResponses({
        @ApiResponse(code = 204, message = "If successful, this method returns an empty response body."),
        @ApiResponse(code = 400, message = "If request is malformed"),
        @ApiResponse(code = 401, message = "If request is not authorized"),
        @ApiResponse(code = 403, message = "If principal doesn't have permissions")
})
Response register(
        @ApiParam(value = "Device body", required = true, defaultValue = "{}")
        @JsonPolicyApply(JsonPolicyDef.Policy.DEVICE_SUBMITTED)
        DeviceUpdate deviceUpdate,
        @ApiParam(name = "id", value = "Device unique identifier.", required = true)
        @PathParam("id")
        @Pattern(regexp = "[a-zA-Z0-9-]+", message = DEVICE_ID_CONTAINS_INVALID_CHARACTERS)
        String deviceId);
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号