當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。