Java 类javax.ws.rs.HEAD 实例源码

项目:Zoo    文件:SwaggerUtil.java   
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;
}
项目:routing-bird    文件:RestfulHelpEndpoints.java   
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;
    }

}
项目:tool.lars    文件:RepositoryRESTResource.java   
@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();
}
项目:funsteroid    文件:ReflectionUtil.java   
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;
}
项目:activemq-artemis    文件:ConsumersResource.java   
@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();
}
项目:hawkular-metrics    文件:RESTMetrics.java   
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;
}
项目:wso2-axis2    文件:JAXRSUtils.java   
/**
 * 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");
        }

}
项目:ldp4j    文件:ServerFrontend.java   
/**
 * 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);
}
项目:launcher-backend    文件:ValidationResource.java   
@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();
    }
}
项目:launcher-backend    文件:ValidationResource.java   
@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();
    }
}
项目:launcher-backend    文件:ValidationResource.java   
@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();
    }
}
项目:launcher-backend    文件:ValidationResource.java   
@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();
    }
}
项目:lambdora    文件:LambdoraLdp.java   
/**
 * 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();
}
项目:fuck_zookeeper    文件:ZNodeResource.java   
@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();
}
项目:fuck_zookeeper    文件:ZNodeResource.java   
@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();
}
项目:Equella    文件:ItemResource.java   
@HEAD
@Path("/{uuid}/{version}/file/{path:(.*)}")
@ApiOperation(value = "Get file metadata")
@Produces(MediaType.WILDCARD)
public Response headFile(@Context HttpHeaders headers,
    // @formatter:off
    @ApiParam(APIDOC_ITEMUUID) @PathParam("uuid") String uuid,
    @ApiParam(APIDOC_ITEMVERSION) @PathParam("version") int version,  
    @ApiParam("File path") @PathParam("path") String path);
项目:https-github.com-apache-zookeeper    文件:ZNodeResource.java   
@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();
}
项目:https-github.com-apache-zookeeper    文件:ZNodeResource.java   
@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();
}
项目:ZooKeeper    文件:ZNodeResource.java   
@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();
}
项目:ZooKeeper    文件:ZNodeResource.java   
@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();
}
项目:ctsms    文件:EcrfStatusEntryResource.java   
@HEAD
@Produces({ MediaType.APPLICATION_JSON })
@Path("{listEntryId}/ecrfpdf/{ecrfId}")
public ECRFPDFVO renderEcrfHead(@PathParam("listEntryId") Long listEntryId, @PathParam("ecrfId") Long ecrfId,
        @QueryParam("blank") Boolean blank) throws AuthenticationException, AuthorisationException, ServiceException {
    ECRFPDFVO result = WebUtil.getServiceLocator().getTrialService().renderEcrf(auth, ecrfId, null, listEntryId, blank);
    result.setDocumentDatas(null);
    return result;
}
项目:ctsms    文件:EcrfStatusEntryResource.java   
@HEAD
@Produces({ MediaType.APPLICATION_JSON })
@Path("{listEntryId}/ecrfpdf")
public ECRFPDFVO renderEcrfsHead(@PathParam("listEntryId") Long listEntryId,
        @QueryParam("blank") Boolean blank) throws AuthenticationException, AuthorisationException, ServiceException {
    ECRFPDFVO result = WebUtil.getServiceLocator().getTrialService().renderEcrfs(auth, null, listEntryId, null, blank);
    result.setDocumentDatas(null);
    return result;
}
项目:ctsms    文件:ProbandAddressResource.java   
@HEAD
@Produces({ MediaType.APPLICATION_JSON })
@Path("{id}/probandletterpdf")
public ProbandLetterPDFVO renderProbandLetterPDFHead(@PathParam("id") Long id)
        throws AuthenticationException, AuthorisationException, ServiceException {
    ProbandLetterPDFVO result = WebUtil.getServiceLocator().getProbandService().renderProbandLetterPDF(auth, id);
    result.setDocumentDatas(null);
    return result;
}
项目:geeMVC-Java-MVC-Framework    文件:DefaultRequestHandler.java   
@Override
public Request controllerRequestMapping() {
    if (controllerClass.isAnnotationPresent(Request.class)
            || controllerClass.isAnnotationPresent(Path.class)
            || controllerClass.isAnnotationPresent(GET.class)
            || controllerClass.isAnnotationPresent(POST.class)
            || controllerClass.isAnnotationPresent(PUT.class)
            || controllerClass.isAnnotationPresent(DELETE.class)
            || controllerClass.isAnnotationPresent(HEAD.class)
            || controllerClass.isAnnotationPresent(OPTIONS.class)) {
        return injector.getInstance(Annotations.class).requestMapping(controllerClass);
    }

    return null;
}
项目:geeMVC-Java-MVC-Framework    文件:DefaultRequestHandler.java   
@Override
public Request handlerRequestMapping() {
    if (method.isAnnotationPresent(Request.class)
            || method.isAnnotationPresent(Path.class)
            || method.isAnnotationPresent(GET.class)
            || method.isAnnotationPresent(POST.class)
            || method.isAnnotationPresent(PUT.class)
            || method.isAnnotationPresent(DELETE.class)
            || method.isAnnotationPresent(HEAD.class)
            || method.isAnnotationPresent(OPTIONS.class)) {
        return injector.getInstance(Annotations.class).requestMapping(method);
    }

    return null;
}
项目:geeMVC-Java-MVC-Framework    文件:BaseTest.java   
protected Request requestMapping(Class<?> controllerClass) {
    if (controllerClass.isAnnotationPresent(Request.class)) {
        return controllerClass.getAnnotation(Request.class);
    } else if (controllerClass.isAnnotationPresent(Path.class) || controllerClass.isAnnotationPresent(GET.class) || controllerClass.isAnnotationPresent(POST.class) || controllerClass.isAnnotationPresent(PUT.class)
            || controllerClass.isAnnotationPresent(DELETE.class) || controllerClass.isAnnotationPresent(HEAD.class) || controllerClass.isAnnotationPresent(OPTIONS.class)) {
        return injector.getInstance(Annotations.class).requestMapping(controllerClass);
    }

    return null;
}
项目:geeMVC-Java-MVC-Framework    文件:BaseTest.java   
protected Request requestMapping(Method method) {
    if (method.isAnnotationPresent(Request.class)) {
        return method.getAnnotation(Request.class);
    } else if (method.isAnnotationPresent(Path.class) || method.isAnnotationPresent(GET.class) || method.isAnnotationPresent(POST.class) || method.isAnnotationPresent(PUT.class) || method.isAnnotationPresent(DELETE.class)
            || method.isAnnotationPresent(HEAD.class) || method.isAnnotationPresent(OPTIONS.class)) {
        return injector.getInstance(Annotations.class).requestMapping(method);
    }

    return null;
}
项目:StreamProcessingInfrastructure    文件:ZNodeResource.java   
@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();
}
项目:StreamProcessingInfrastructure    文件:ZNodeResource.java   
@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();
}
项目:bigstreams    文件:ZNodeResource.java   
@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();
}
项目:bigstreams    文件:ZNodeResource.java   
@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();
}
项目:bigstreams    文件:ZNodeResource.java   
@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();
}
项目:bigstreams    文件:ZNodeResource.java   
@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();
}
项目:rdapit    文件:TypingRESTResource.java   
/**
 * Simple HEAD method to check whether a particular pid is registered.
 * 
 * @param identifier
 *            an identifier string
 * @return either 200 or 404, indicating whether the PID is registered or
 *         not registered
 * @throws IOException
 */
@HEAD
@Path("/pid/{identifier}")
@ApiOperation(value = "Identifier registered?", notes = "Check to see if identifier is registered")
@ApiResponses(value = {
  @ApiResponse(code = 200, message = "Found"),
  @ApiResponse(code = 404, message = "Not found")
})
public Response isPidRegistered(@PathParam("identifier") String identifier) throws IOException {
    boolean b = typingService.isIdentifierRegistered(identifier);
    if (b)
        return Response.status(200).build();
    else
        return Response.status(404).build();
}
项目:rdapit    文件:TypingRESTResource.java   
/**
 * Similar to {@link #isPidRegistered(String)} but supports native slashes
 * in the identifier path.
 * 
 * @see #isPidRegistered(String)
 */
@HEAD
@Path("/pid/{prefix}/{suffix}")
@ApiOperation(value = "Identifier registered?", notes = "Check to see if identifier is registered")
@ApiResponses(value = {
  @ApiResponse(code = 200, message = "Found"),
  @ApiResponse(code = 404, message = "Not found")
})
public Response isPidRegistered(@PathParam("prefix") String prefix, @PathParam("suffix") String suffix) throws IOException {
    return isPidRegistered(prefix + "/" + suffix);
}
项目:emodb    文件:BlobStoreShadedClientTest.java   
@HEAD
@Path("test:table/blob1")
public Response getBlobMetadata(@HeaderParam("X-BV-API-Key") String apiKey) {
    assertEquals(apiKey, API_KEY);

    return Response.ok()
            .type(MediaType.APPLICATION_OCTET_STREAM)
            .header(HttpHeaders.CONTENT_LENGTH, 12)
            .header(HttpHeaders.ETAG, "etag")
            .header("X-BV-Length", 12)
            .header("X-BVA-size", "medium")
            .lastModified(new Date(1444937753000L))
            .build();
}
项目:product-ei    文件:StockQuoteService.java   
/**
 * Retrieve metainformation about the entity implied by the request.
 * curl -i -X HEAD http://localhost:9090/stockquote/IBM
 *
 * @return Response
 */
@HEAD
@Path("/{symbol}")
@Produces({"application/json", "text/xml"})
@ApiOperation(
        value = "Returns headers of corresponding GET request ",
        notes = "Returns metainformation contained in the HTTP header identical to the corresponding GET Request")
public Response getMetaInformationForQuote(@ApiParam(value = "Symbol", required = true)
                                           @PathParam("symbol") String symbol) throws SymbolNotFoundException {
    Stock stock = stockQuotes.get(symbol);
    if (stock == null) {
        throw new SymbolNotFoundException();
    }
    return Response.ok().build();
}
项目:launchpad-missioncontrol    文件:ValidationResource.java   
@HEAD
@Path("/repository/{repo}")
public Response repositoryExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                                 @NotNull @PathParam("repo") String repository) {
    Identity githubIdentity = getGitHubIdentity(authorization);
    GitHubService gitHubService = gitHubServiceFactory.create(githubIdentity);
    if (gitHubService.repositoryExists(gitHubService.getLoggedUser().getLogin() + "/" + repository)) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
项目:launchpad-missioncontrol    文件:ValidationResource.java   
@HEAD
@Path("/project/{project}")
public Response projectExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                              @NotNull @PathParam("project") String project,
                              @QueryParam("cluster") String cluster) {
    Identity openShiftIdentity = getOpenShiftIdentity(authorization, cluster);
    Optional<OpenShiftCluster> openShiftCluster = clusterRegistry.findClusterById(cluster);
    assert openShiftCluster.isPresent() : "Cluster not found: " + cluster;
    OpenShiftService openShiftService = openShiftServiceFactory.create(openShiftCluster.get(), openShiftIdentity);
    if (openShiftService.projectExists(project)) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
项目:launchpad-missioncontrol    文件:ValidationResource.java   
@HEAD
@Path("/token/openshift")
public Response openShiftTokenExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
                                     @QueryParam("cluster") String cluster) {
    boolean tokenExists;
    try {
        tokenExists = getOpenShiftIdentity(authorization, cluster) != null;
    } catch (IllegalArgumentException | IllegalStateException e) {
        tokenExists = false;
    }
    if (tokenExists) {
        return Response.ok().build();
    } else {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}