本文整理汇总了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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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());
}