当前位置: 首页>>代码示例>>Java>>正文


Java DefaultValue类代码示例

本文整理汇总了Java中javax.ws.rs.DefaultValue的典型用法代码示例。如果您正苦于以下问题:Java DefaultValue类的具体用法?Java DefaultValue怎么用?Java DefaultValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultValue类属于javax.ws.rs包,在下文中一共展示了DefaultValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJobSnapshot

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@Path("snapshot")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getJobSnapshot(
        @DefaultValue("1") @QueryParam("depth") int maximumDepth,
        @DefaultValue("true") @QueryParam("static") boolean includeStaticAttributes)
        throws StreamsTrackerException, WebApplicationException {

    StreamsInstanceTracker jobTracker = StreamsInstanceTracker
            .getInstance();

    String snapshot = null;
    snapshot = jobTracker.getJobSnapshot(ji.getId().intValue(),
            maximumDepth, includeStaticAttributes);

    if (snapshot == null) {
        throw new WebApplicationException("Job " + ji.getId()
                + " returned an empty snapshot.",
                Response.Status.NO_CONTENT); // 204
    }

    return Response.status(200).entity(snapshot).build();
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:24,代码来源:JobResource.java

示例2: get

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T get() {
    final MinijaxRequestContext context = MinijaxRequestContext.getThreadLocal();
    final Class<?> c = key.getType();
    final MinijaxForm form = context.getForm();
    final String name = key.getName();

    if (c == InputStream.class) {
        return form == null ? null : (T) form.getInputStream(name);
    }

    if (c == Part.class) {
        return form == null ? null : (T) form.getPart(name);
    }

    String value = form == null ? null : form.getString(name);

    final DefaultValue defaultValue = key.getDefaultValue();
    if (value == null && defaultValue != null) {
        value = defaultValue.value();
    }

    return (T) context.getApplication().convertParamToType(value, c, key.getAnnotations());
}
 
开发者ID:minijax,项目名称:minijax,代码行数:26,代码来源:FormParamProvider.java

示例3: install

import javax.ws.rs.DefaultValue; //导入依赖的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

示例4: upgrade

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@POST
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Upgrade Presto")
@ApiResponses(value = {
        @ApiResponse(code = 207, message = "Multiple responses available"),
        @ApiResponse(code = 400, message = "Request contains invalid parameters")})
public Response upgrade(String urlToFetchPackage,
        @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies,
        @QueryParam("forceUpgrade") @DefaultValue("false") boolean forceUpgrade,
        @QueryParam("preserveConfig") @DefaultValue("true") boolean preserveConfig,
        @QueryParam("scope") String scope,
        @QueryParam("nodeId") List<String> nodeId)
{
    ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class)
            .httpMethod(POST)
            .accept(MediaType.TEXT_PLAIN)
            .entity(Entity.entity(urlToFetchPackage, MediaType.TEXT_PLAIN));

    optionalQueryParam(apiRequester, "checkDependencies", checkDependencies);
    optionalQueryParam(apiRequester, "preserveConfig", preserveConfig);
    optionalQueryParam(apiRequester, "forceUpgrade", forceUpgrade);

    return forwardRequest(scope, apiRequester.build(), nodeId);
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:26,代码来源:ControllerPackageAPI.java

示例5: getSource

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_JSON)
public SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents)
    throws Exception {
  try {
    final SourceConfig config = namespaceService.get().getSource(sourcePath.toNamespaceKey());
    final SourceState sourceState = sourceService.getSourceState(sourcePath.getSourceName().getName());
    if (sourceState == null) {
      throw new SourceNotFoundException(sourcePath.getSourceName().getName());
    }

    final SourceUI source = newSource(config)
        .setNumberOfDatasets(namespaceService.get().getAllDatasetsCount(new NamespaceKey(config.getName())));

    source.setState(sourceState);
    if (includeContents) {
      source.setContents(sourceService.listSource(sourcePath.getSourceName(),
        namespaceService.get().getSource(sourcePath.toNamespaceKey()), securityContext.getUserPrincipal().getName()));
    }
    return source;
  } catch (NamespaceNotFoundException nfe) {
    throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:25,代码来源:SourceResource.java

示例6: setZNodeAsOctet

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:27,代码来源:ZNodeResource.java

示例7: deleteZNode

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@DELETE
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM })
public void deleteZNode(@PathParam("path") String path,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @Context UriInfo ui) 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());
    }

    zk.delete(path, version);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:21,代码来源:ZNodeResource.java

示例8: annotate_POST_MULTIPART

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@POST
@Path("/plans/{plan}/{sync:sync|async}")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
public Response annotate_POST_MULTIPART(
		@Context ServletContext servletContext,
		@Context HttpContext httpContext,
		@PathParam("plan") String planName,
		@PathParam("sync") String sync,
		@FormDataParam("text") @DefaultValue("") String text,
		@FormDataParam("sourcedb") @DefaultValue("") String sourcedb,
		@FormDataParam("sourceid") @DefaultValue("") String sourceid,
		FormDataMultiPart formData
		) throws Exception {
	return annotate(servletContext, httpContext, planName, text, sourcedb, sourceid, null, formData, sync.equals("async"));
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:16,代码来源:PubAnnotation.java

示例9: getFolder

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@GET
@Path("/folder/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
public Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents) throws Exception {
  FolderPath folderPath = FolderPath.fromURLPath(homeName, path);
  try {
    final FolderConfig folderConfig = namespaceService.getFolder(folderPath.toNamespaceKey());
    final List<NamespaceKey> datasetPaths = namespaceService.getAllDatasets(folderPath.toNamespaceKey());
    final ExtendedConfig extendedConfig = new ExtendedConfig().setDatasetCount((long)datasetPaths.size())
      .setJobCount(datasetService.getJobsCount(datasetPaths));
    folderConfig.setExtendedConfig(extendedConfig);

    NamespaceTree contents = includeContents ? newNamespaceTree(namespaceService.list(folderPath.toNamespaceKey())) : null;
    return newFolder(folderPath, folderConfig, contents);
  } catch (NamespaceNotFoundException nfe) {
    throw new FolderNotFoundException(folderPath, nfe);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:HomeResource.java

示例10: getLog

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@GET
@Path("/{file}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get Presto log file")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Retrieved logs"),
        @ApiResponse(code = 400, message = "Invalid parameters"),
        @ApiResponse(code = 404, message = "Resource not found")})
public Response getLog(
        @PathParam("file") @ApiParam("The name of a file") String file,
        @QueryParam("from") @ApiParam("Ignore logs before this date") Instant fromDate,
        @QueryParam("to") @ApiParam("Ignore logs after this date") Instant toDate,
        @QueryParam("level") @ApiParam("Only get logs of this level") @DefaultValue(LogsHandler.DEFAULT_LOG_LEVEL) String level,
        @QueryParam("n") @ApiParam("The maximum number of log entries to get") Integer maxEntries)
{
    return logsHandler.getLogs(file, fromDate, toDate, level, maxEntries);
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:18,代码来源:LogsAPI.java

示例11: Space

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@JsonCreator
public Space(
  @JsonProperty("id") @DefaultValue("null") String id, // default is null for new spaces
  @JsonProperty("name") String name,
  @JsonProperty("description") String description,
  @JsonProperty("version") Long version,
  @JsonProperty("contents") NamespaceTree contents,
  @JsonProperty("datasetCount") int datasetCount,
  @JsonProperty("ctime") Long ctime
) {
  checkArgument(!isNullOrEmpty(name), "space name can not be empty");
  this.id = id;
  this.name = name;
  this.description = description;
  this.version = version;
  this.contents = contents;
  this.datasetCount = datasetCount;
  this.ctime = ctime;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:Space.java

示例12: deleteRoot

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive,
    @QueryParam(SnapshotNameParam.NAME) @DefaultValue(SnapshotNameParam.DEFAULT)
        final SnapshotNameParam snapshotName
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive,
      snapshotName);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:NamenodeWebHdfsMethods.java

示例13: deleteGroup

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@DELETE
@Path("/{uuid}")
@ApiOperation("Delete a group")
public Response deleteGroup(
	// @formatter:off
		@ApiParam(APIDOC_GROUPUUID)
			@PathParam("uuid") String uuid,
		@ApiParam(value = "also delete subgroups", allowableValues = "true,false", defaultValue = "true", required = false)
			@QueryParam("cascade")
			@DefaultValue("false")
			Boolean deleteSubgroups
		// @formatter:on
)
{
	boolean deleteSub = (deleteSubgroups == null ? false : deleteSubgroups);
	// ensure group exists, else throw 404
	TLEGroup tleGroup = tleGroupService.get(uuid);
	if( tleGroup == null )
	{
		return Response.status(Status.NOT_FOUND).build();
	}
	tleGroupService.delete(uuid, deleteSub);
	return Response.status(Status.NO_CONTENT).build();
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:GroupManagementResourceImpl.java

示例14: ZNodeResource

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
public ZNodeResource(@DefaultValue("") @QueryParam("session") String session,
        @Context UriInfo ui,
        @Context HttpServletRequest request
        )
        throws IOException {

    String contextPath = request.getContextPath();
    if (contextPath.equals("")) {
        contextPath = "/";
    }
    if (session.equals("")) {
        session = null;
    } else if (!ZooKeeperService.isConnected(contextPath, session)) {
        throw new WebApplicationException(Response.status(
                Response.Status.UNAUTHORIZED).build());
    }
    zk = ZooKeeperService.getClient(contextPath, session);
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:19,代码来源:ZNodeResource.java

示例15: upgrade

import javax.ws.rs.DefaultValue; //导入依赖的package包/类
@POST
@Consumes(TEXT_PLAIN)
@Produces(TEXT_PLAIN)
@ApiOperation(value = "Upgrade Presto")
@ApiResponses(value = {
        @ApiResponse(code = 202, message = "Acknowledged request"),
        @ApiResponse(code = 400, message = "Invalid url"),
        @ApiResponse(code = 409, message = "Presto is running. Please stop Presto before beginning upgrade.")
})
public synchronized Response upgrade(@ApiParam("Url to fetch package") String packageUrl,
        @QueryParam("checkDependencies") @DefaultValue("true") @ApiParam("If false, disables dependency checking") boolean checkDependencies,
        @QueryParam("preserveConfig") @DefaultValue("true") @ApiParam("If false, config files are not preserved") boolean preserveConfig,
        @QueryParam("forceUpgrade") @DefaultValue("false") @ApiParam("If true, warnings are ignored during upgrade") boolean forceUpgrade)
{
    return controller.upgrade(packageUrl, checkDependencies, preserveConfig, forceUpgrade);
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:17,代码来源:PackageAPI.java


注:本文中的javax.ws.rs.DefaultValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。