当前位置: 首页>>代码示例>>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;未经允许,请勿转载。