當前位置: 首頁>>代碼示例>>Java>>正文


Java OPTIONS類代碼示例

本文整理匯總了Java中javax.ws.rs.OPTIONS的典型用法代碼示例。如果您正苦於以下問題:Java OPTIONS類的具體用法?Java OPTIONS怎麽用?Java OPTIONS使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OPTIONS類屬於javax.ws.rs包,在下文中一共展示了OPTIONS類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: verb

import javax.ws.rs.OPTIONS; //導入依賴的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: options

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
/**
 * Perform an OPTIONS operation on an LDP Resource.
 *
 * @param req the request
 * @return the response
 */
@OPTIONS
@Timed
public Response options(@BeanParam final LdpRequest req) {

    final String urlBase = getBaseUrl(req);
    final IRI identifier = rdf.createIRI(TRELLIS_PREFIX + req.getPath());
    final OptionsHandler optionsHandler = new OptionsHandler(req, resourceService, urlBase);

    if (nonNull(req.getVersion())) {
        return resourceService.get(identifier, req.getVersion().getInstant()).map(optionsHandler::ldpOptions)
            .orElseGet(() -> status(NOT_FOUND)).build();
    }

    return resourceService.get(identifier).map(optionsHandler::ldpOptions)
        .orElseGet(() -> status(NOT_FOUND)).build();
}
 
開發者ID:trellis-ldp,項目名稱:trellis,代碼行數:23,代碼來源:LdpResource.java

示例3: options

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
/**
 * OPTIONS Method.
 * @return JAX-RS Response
 */
@OPTIONS
public Response options() {
    // AccessControl
    this.checkAccessContext(this.getAccessContext(), BoxPrivilege.READ);

    return PersoniumCoreUtils.responseBuilderForOptions(
            HttpMethod.GET,
            HttpMethod.PUT,
            HttpMethod.DELETE,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.MKCOL,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPFIND,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPPATCH,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.ACL
            ).build();
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:20,代碼來源:DavRsCmp.java

示例4: options

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
/**
 * OPTIONSメソッド.
 * @return JAX-RS Response
 */
@OPTIONS
public Response options() {
    // アクセス製禦
    this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ);

    return PersoniumCoreUtils.responseBuilderForOptions(
            HttpMethod.GET,
            HttpMethod.PUT,
            HttpMethod.DELETE,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.MKCOL,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.MOVE,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPFIND,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPPATCH,
            io.personium.common.utils.PersoniumCoreUtils.HttpMethod.ACL
            ).build();
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:21,代碼來源:DavCollectionResource.java

示例5: configure

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@Override
protected Application configure() {
	CorsFilter corsFilter = new CorsFilter.Builder()
			.allowMethod(HttpMethod.DELETE)
			.allowMethod(HttpMethod.OPTIONS)
			.allowHeader("ah0")
			.allowHeader("ah1")
			.allowOrigin(DEFAULT_ORIGIN)
			.allowOrigin("http://test.com")
			.exposeHeader("eh0")
			.exposeHeader("eh1")
			.build();
	ResourceConfig application = new ResourceConfig();
	application.register(corsFilter);
	application.register(TestResource.class);
	return application;
}
 
開發者ID:bbilger,項目名稱:jrestless,代碼行數:18,代碼來源:CorsFilterIntTest.java

示例6: isHttpMethodAvailable

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
private boolean isHttpMethodAvailable(Annotation[] annotations) {
    for (Annotation annotation : annotations) {
        if (annotation.annotationType().getName().equals(GET.class.getName())) {
            return true;
        } else if (annotation.annotationType().getName().equals(POST.class.getName())) {
            return true;
        } else if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) {
            return true;
        } else if (annotation.annotationType().getName().equals(DELETE.class.getName())) {
            return true;
        } else if (annotation.annotationType().getName().equals(PUT.class.getName())) {
            return true;
        }
    }
    return false;
}
 
開發者ID:wso2,項目名稱:carbon-device-mgt,代碼行數:17,代碼來源:AnnotationProcessor.java

示例7: processHTTPMethodAnnotation

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
/**
 * Read Method annotations indicating HTTP Methods
 *
 * @param resource
 * @param annotation
 */
private void processHTTPMethodAnnotation(APIResource resource, Annotation annotation) {
    if (annotation.annotationType().getName().equals(GET.class.getName())) {
        resource.setHttpVerb(HttpMethod.GET);
    }
    if (annotation.annotationType().getName().equals(POST.class.getName())) {
        resource.setHttpVerb(HttpMethod.POST);
    }
    if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) {
        resource.setHttpVerb(HttpMethod.OPTIONS);
    }
    if (annotation.annotationType().getName().equals(DELETE.class.getName())) {
        resource.setHttpVerb(HttpMethod.DELETE);
    }
    if (annotation.annotationType().getName().equals(PUT.class.getName())) {
        resource.setHttpVerb(HttpMethod.PUT);
    }
}
 
開發者ID:wso2,項目名稱:carbon-device-mgt,代碼行數:24,代碼來源:AnnotationProcessor.java

示例8: documentOperations

import javax.ws.rs.OPTIONS; //導入依賴的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

示例9: initHttpOptions

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
private static void initHttpOptions(
    VxmsShared vxmsShared,
    Router router,
    Object service,
    Method restMethod,
    Path path,
    Stream<Method> errorMethodStream,
    Optional<Consumes> consumes) {
  final Route route = router.options(URIUtil.cleanPath(path.value()));
  final Vertx vertx = vxmsShared.getVertx();
  final Context context = vertx.getOrCreateContext();
  final String methodId =
      path.value()
          + OPTIONS.class.getName()
          + ConfigurationUtil.getCircuitBreakerIDPostfix(context.config());
  initHttpOperation(
      methodId,
      vxmsShared,
      service,
      restMethod,
      route,
      errorMethodStream,
      consumes,
      OPTIONS.class);
}
 
開發者ID:amoAHCP,項目名稱:vxms,代碼行數:26,代碼來源:RESTInitializer.java

示例10: getHttpMethod

import javax.ws.rs.OPTIONS; //導入依賴的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

示例11: handleCorsPreflightOntology

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@OPTIONS
@Path("/{id}")
public Response handleCorsPreflightOntology(@PathParam(value = "id") String id,
        @Context HttpHeaders headers){
    ResponseBuilder res = Response.ok();
    return res.build();
}
 
開發者ID:teamdigitale,項目名稱:ontonethub,代碼行數:8,代碼來源:OntonethubIndexingResource.java

示例12: handleCorsPreflightOntologySource

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@OPTIONS
@Path("/{id}/source")
public Response handleCorsPreflightOntologySource(@PathParam(value = "id") String id,
        @Context HttpHeaders headers){
    ResponseBuilder res = Response.ok();
    return res.build();
}
 
開發者ID:teamdigitale,項目名稱:ontonethub,代碼行數:8,代碼來源:OntonethubIndexingResource.java

示例13: handleCorsPreflightOntologyFind

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@OPTIONS
@Path("/{id}/find")
public Response handleCorsPreflightOntologyFind(@PathParam(value = "id") String id,
        @Context HttpHeaders headers){
    ResponseBuilder res = Response.ok();
    return res.build();
}
 
開發者ID:teamdigitale,項目名稱:ontonethub,代碼行數:8,代碼來源:OntonethubIndexingResource.java

示例14: corsPreflightVersion

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@OPTIONS
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
@Path("/version")
public Response corsPreflightVersion(@HeaderParam("Access-Control-Request-Headers") final String requestHeaders,
		@HeaderParam("Access-Control-Request-Method") final String requestMethod)
{
	ResponseBuilder responseBuilder = getCorsPreflightResponseBuilder(requestHeaders, requestMethod);
	return (responseBuilder.build());
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:10,代碼來源:MetricsResource.java

示例15: corsPreflightMetricNames

import javax.ws.rs.OPTIONS; //導入依賴的package包/類
@OPTIONS
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
@Path("/metricnames")
public Response corsPreflightMetricNames(@HeaderParam("Access-Control-Request-Headers") final String requestHeaders,
		@HeaderParam("Access-Control-Request-Method") final String requestMethod)
{
	ResponseBuilder responseBuilder = getCorsPreflightResponseBuilder(requestHeaders, requestMethod);
	return (responseBuilder.build());
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:10,代碼來源:MetricsResource.java


注:本文中的javax.ws.rs.OPTIONS類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。