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


Java HEAD类代码示例

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


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

示例1: verb

import javax.ws.rs.HEAD; //导入依赖的package包/类
private String verb(Method m) {
    if (m.getAnnotation(DELETE.class) != null) {
        return "DELETE  ";
    } else if (m.getAnnotation(GET.class) != null) {
        return "GET     ";
    } else if (m.getAnnotation(HEAD.class) != null) {
        return "HEAD    ";
    } else if (m.getAnnotation(OPTIONS.class) != null) {
        return "OPTIONS ";
    } else if (m.getAnnotation(POST.class) != null) {
        return "POST    ";
    } else if (m.getAnnotation(PUT.class) != null) {
        return "PUT     ";
    } else {
        return null;
    }

}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:19,代码来源:RestfulHelpEndpoints.java

示例2: documentOperations

import javax.ws.rs.HEAD; //导入依赖的package包/类
public static List<SwaggerOperation> documentOperations(SwaggerModel models, Method method) {
    List<SwaggerOperation> ops = new ArrayList<SwaggerOperation>();

    Annotation[] annotations = method.getAnnotations();
    if (annotationPresent(GET.class, annotations)) {
        ops.add(createOperation(models, GET, method, annotations));
    }
    if (annotationPresent(PUT.class, annotations)) {
        ops.add(createOperation(models, PUT, method, annotations));
    }
    if (annotationPresent(POST.class, annotations)) {
        ops.add(createOperation(models, POST, method, annotations));
    }
    if (annotationPresent(DELETE.class, annotations)) {
        ops.add(createOperation(models, DELETE, method, annotations));
    }
    if (annotationPresent(HEAD.class, annotations)) {
        ops.add(createOperation(models, HEAD, method, annotations));
    }
    if (annotationPresent(OPTIONS.class, annotations)) {
        ops.add(createOperation(models, OPTIONS, method, annotations));
    }

    return ops;
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:26,代码来源:SwaggerUtil.java

示例3: countAssets

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Path("/assets")
public Response countAssets(@Context UriInfo info, @Context SecurityContext sc) throws InvalidParameterException {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("countAssets called with query parameters: " + info.getRequestUri().getRawQuery());
    }

    AssetQueryParameters params = AssetQueryParameters.create(info);

    Collection<AssetFilter> filters = params.getFilters();
    if (!sc.isUserInRole(ADMIN_ROLE)) {
        filters.add(ASSET_IS_PUBLISHED);
    }

    int count = assetService.countAllAssets(filters, params.getSearchTerm());
    return Response.noContent().header("count", count).build();
}
 
开发者ID:WASdev,项目名称:tool.lars,代码行数:18,代码来源:RepositoryRESTResource.java

示例4: getHttpMethod

import javax.ws.rs.HEAD; //导入依赖的package包/类
public static String getHttpMethod(Method method){
	if (method.getAnnotation(GET.class)!=null){
		return HttpMethod.GET;
	}
	if (method.getAnnotation(POST.class)!=null){
		return HttpMethod.POST;
	}
	if (method.getAnnotation(DELETE.class)!=null){
		return HttpMethod.DELETE;
	}
	if (method.getAnnotation(PUT.class)!=null){
		return HttpMethod.PUT;
	}
	if (method.getAnnotation(OPTIONS.class)!=null){
		return HttpMethod.OPTIONS;
	}
	if (method.getAnnotation(HEAD.class)!=null){
		return HttpMethod.HEAD;
	}		
	return null;
}
 
开发者ID:jerolba,项目名称:funsteroid,代码行数:22,代码来源:ReflectionUtil.java

示例5: headConsumer

import javax.ws.rs.HEAD; //导入依赖的package包/类
@Path("attributes-{attributes}/{consumer-id}")
@HEAD
public Response headConsumer(@PathParam("attributes") int attributes,
                             @PathParam("consumer-id") String consumerId,
                             @Context UriInfo uriInfo) throws Exception {
   ActiveMQRestLogger.LOGGER.debug("Handling HEAD request for \"" + uriInfo.getPath() + "\"");

   QueueConsumer consumer = findConsumer(attributes, consumerId, uriInfo);
   Response.ResponseBuilder builder = Response.noContent();
   // we synchronize just in case a failed request is still processing
   synchronized (consumer) {
      if ((attributes & ACKNOWLEDGED) > 0) {
         AcknowledgedQueueConsumer ackedConsumer = (AcknowledgedQueueConsumer) consumer;
         Acknowledgement ack = ackedConsumer.getAck();
         if (ack == null || ack.wasSet()) {
            AcknowledgedQueueConsumer.setAcknowledgeNextLink(serviceManager.getLinkStrategy(), builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/attributes-" + attributes + "/" + consumer.getId(), Long.toString(consumer.getConsumeIndex()));
         } else {
            ackedConsumer.setAcknowledgementLink(builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/attributes-" + attributes + "/" + consumer.getId());
         }

      } else {
         QueueConsumer.setConsumeNextLink(serviceManager.getLinkStrategy(), builder, uriInfo, uriInfo.getMatchedURIs().get(1) + "/attributes-" + attributes + "/" + consumer.getId(), Long.toString(consumer.getConsumeIndex()));
      }
   }
   return builder.build();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:ConsumersResource.java

示例6: getHttpMethod

import javax.ws.rs.HEAD; //导入依赖的package包/类
private HTTPMethod getHttpMethod(Method m) {
    if (m.isAnnotationPresent(GET.class)) {
        return HTTPMethod.GET;
    }
    if (m.isAnnotationPresent(POST.class)) {
        return HTTPMethod.POST;
    }
    if (m.isAnnotationPresent(PUT.class)) {
        return HTTPMethod.PUT;
    }
    if (m.isAnnotationPresent(DELETE.class)) {
        return HTTPMethod.DELETE;
    }
    if (m.isAnnotationPresent(HEAD.class)) {
        return HTTPMethod.HEAD;
    }
    return HTTPMethod.OPTIONS;
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:19,代码来源:RESTMetrics.java

示例7: addHTTPMethodToMethodModel

import javax.ws.rs.HEAD; //导入依赖的package包/类
/**
 * add value of the HTTPMethod to the jaxrs-method model. axis2 only supports POST,GET,PUT,DELETE.
  * it doesnt support HEAD. if HEAD is given it resolves to the default method (POST)
  * @param annotation
  * @param methodModel
  */

private static void addHTTPMethodToMethodModel(Annotation annotation,JAXRSModel methodModel){


        if (annotation instanceof POST) {
            methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_POST);
        } else if (annotation instanceof GET) {
            methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_GET);
        } else if (annotation instanceof PUT) {
           methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_PUT);
        } else if (annotation instanceof DELETE) {
            methodModel.setHTTPMethod(Constants.Configuration.HTTP_METHOD_DELETE);
        }  else if (annotation instanceof HEAD) {
             log.warn("HTTP Method HEAD is not supported by AXIS2");
        }

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:JAXRSUtils.java

示例8: head

import javax.ws.rs.HEAD; //导入依赖的package包/类
/**
 * LDP 1.0 - 4.2.6.1 LDP servers must support the HTTP HEAD method.
 * @param uriInfo the full URL details of the resource
 * @param path the path of the resource
 * @param headers the headers included in the request
 * @param request the request itself
 * @return an LDP compliant response to the HEAD request
 */
@HEAD
@Path(ENDPOINT_PATH)
public Response head(
	@Context UriInfo uriInfo,
	@PathParam(ENDPOINT_PATH_PARAM) String path,
	@Context HttpHeaders headers,
	@Context Request request) {
	OperationContext context =
		newOperationBuilder(HttpMethod.HEAD).
			withEndpointPath(path).
			withUriInfo(uriInfo).
			withHeaders(headers).
			withRequest(request).
			build();
	return
		EndpointControllerFactory.
			newController().
				head(context);
}
 
开发者ID:ldp4j,项目名称:ldp4j,代码行数:28,代码来源:ServerFrontend.java

示例9: repositoryExists

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Path("/repository/{repo}")
public Response repositoryExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                                 @NotNull @PathParam("repo") String repository) {
    Identity identity = identities.getGitHubIdentity(authorization);
    GitHubService gitHubService = gitHubServiceFactory.create(identity);
    if (gitHubService.repositoryExists(gitHubService.getLoggedUser().getLogin() + "/" + repository)) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:13,代码来源:ValidationResource.java

示例10: openShiftProjectExists

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Path("/project/{project}")
public Response openShiftProjectExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                                       @NotNull @PathParam("project") String project,
                                       @QueryParam("cluster") String cluster) {

    Identity identity = identities.getOpenShiftIdentity(authorization, cluster);
    OpenShiftCluster openShiftCluster = clusterRegistry.findClusterById(cluster)
            .orElseThrow(() -> new IllegalStateException("Cluster not found"));
    OpenShiftService openShiftService = openShiftServiceFactory.create(openShiftCluster, identity);
    if (openShiftService.projectExists(project)) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:17,代码来源:ValidationResource.java

示例11: openShiftTokenExists

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Path("/token/openshift")
public Response openShiftTokenExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                                     @QueryParam("cluster") String cluster) {
    Identity identity = identities.getOpenShiftIdentity(authorization, cluster);
    boolean tokenExists = (identity != null);
    if (tokenExists) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:13,代码来源:ValidationResource.java

示例12: gitHubTokenExists

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Path("/token/github")
public Response gitHubTokenExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization) {
    Identity identity = identities.getGitHubIdentity(authorization);
    boolean tokenExists = (identity != null);
    if (tokenExists) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:12,代码来源:ValidationResource.java

示例13: head

import javax.ws.rs.HEAD; //导入依赖的package包/类
/**
 * Retrieve the resource headers
 *
 * @return response
 */
@HEAD
@Produces({TURTLE_WITH_CHARSET + ";qs=1.0", JSON_LD + ";qs=0.8",
    N3_WITH_CHARSET, N3_ALT2_WITH_CHARSET, RDF_XML, NTRIPLES, TEXT_PLAIN_WITH_CHARSET,
    TURTLE_X, TEXT_HTML_WITH_CHARSET})
public Response head() throws UnsupportedAlgorithmException {
    LOGGER.info("HEAD for: {}", externalPath);

    final URI internalUri = createFromPath(externalPath);

    final Container container = getContainerService().find(internalUri);

    if (container == null) {
        if (!isRoot(internalUri)) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
    }
    return ok().build();
}
 
开发者ID:duraspace,项目名称:lambdora,代码行数:24,代码来源:LambdoraLdp.java

示例14: existsZNode

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML })
public Response existsZNode(@PathParam("path") String path,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    Stat stat = zk.exists(path, false);
    if (stat == null) {
        throwNotFound(path, ui);
    }
    return Response.status(Response.Status.OK).build();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:12,代码来源:ZNodeResource.java

示例15: existsZNodeAsOctet

import javax.ws.rs.HEAD; //导入依赖的package包/类
@HEAD
@Produces( { MediaType.APPLICATION_OCTET_STREAM })
public Response existsZNodeAsOctet(@PathParam("path") String path,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    Stat stat = zk.exists(path, false);
    if (stat == null) {
        throwNotFound(path, ui);
    }
    return Response.status(Response.Status.NO_CONTENT).build();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:11,代码来源:ZNodeResource.java


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