本文整理匯總了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());
}