当前位置: 首页>>代码示例>>Java>>正文


Java ResourceContext类代码示例

本文整理汇总了Java中javax.ws.rs.container.ResourceContext的典型用法代码示例。如果您正苦于以下问题:Java ResourceContext类的具体用法?Java ResourceContext怎么用?Java ResourceContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceContext类属于javax.ws.rs.container包,在下文中一共展示了ResourceContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUris

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@GET
@Timed
public Response getUris(@Context UriInfo uriInfo, @Context ResourceContext rc) {
    URI fibonacciNosURI = uriInfo.getBaseUriBuilder().path(FibonacciResource.class).build();
    Object fibonacciNosResponse = rc.getResource(FibonacciResource.class).getFibNos(Optional.of(100L)).getEntity();
    return Response.created(fibonacciNosURI).entity(fibonacciNosResponse).build();
}
 
开发者ID:kishaningithub,项目名称:infinitestreams,代码行数:8,代码来源:ExampleResource.java

示例2: getListingJsonBare

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/swagger")
@ApiOperation(value = "The swagger definition in JSON", hidden = true)
public Response getListingJsonBare(
        @Context Application app,
        @Context ServletConfig sc,
        @Context HttpHeaders headers,
        @Context UriInfo uriInfo,
        @Context ResourceContext rc) {
    ApiListingResource apiListingResource = rc.getResource(ApiListingResource.class);
    return apiListingResource.getListingJson(app, sc, headers, uriInfo);
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:14,代码来源:SwaggerJsonBareService.java

示例3: TemplateModelProcessor

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
/**
 * Create a {@code TemplateModelProcessor} instance.
 *
 * @param resourceContext         (injected) resource context.
 * @param extendedUriInfoProvider (injected) extended uri info provider.
 */
@Inject
TemplateModelProcessor(final ResourceContext resourceContext,
                       final Provider<ConfiguredValidator> validatorProvider,
                       final Provider<ExtendedUriInfo> extendedUriInfoProvider) {
    this.resourceContext = resourceContext;
    this.validatorProvider = validatorProvider;
    this.extendedUriInfoProvider = extendedUriInfoProvider;
}
 
开发者ID:icode,项目名称:ameba,代码行数:15,代码来源:TemplateModelProcessor.java

示例4: findThreadLocal

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public static Object findThreadLocal(final Class<?> type) {
    if (Request.class.equals(type)) {
        return REQUEST;
    } else if (UriInfo.class.equals(type)) {
        return URI_INFO;
    } else if (HttpHeaders.class.equals(type)) {
        return HTTP_HEADERS;
    } else if (SecurityContext.class.equals(type)) {
        return SECURITY_CONTEXT;
    } else if (ContextResolver.class.equals(type)) {
        return CONTEXT_RESOLVER;
    } else if (Providers.class.equals(type)) {
        return PROVIDERS;
    } else if (ServletRequest.class.equals(type)) {
        return SERVLET_REQUEST;
    } else if (HttpServletRequest.class.equals(type)) {
        return HTTP_SERVLET_REQUEST;
    } else if (HttpServletResponse.class.equals(type)) {
        return HTTP_SERVLET_RESPONSE;
    } else if (ServletConfig.class.equals(type)) {
        return SERVLET_CONFIG;
    } else if (ServletContext.class.equals(type)) {
        return SERVLET_CONTEXT;
    } else if (ResourceInfo.class.equals(type)) {
        return RESOURCE_INFO;
    } else if (ResourceContext.class.equals(type)) {
        return RESOURCE_CONTEXT;
    } else if (Application.class.equals(type)) {
        return APPLICATION;
    } else if (Configuration.class.equals(type)) {
        return CONFIGURATION;
    }
    return null;
}
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:ThreadLocalContextManager.java

示例5: getById

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@GET
@Path("/{cartId:[0-9]*}")
public Customer getById(@Context ResourceContext rc) {

    //Customer customer = new Customer(cartId);
    //return customer;
    return rc.getResource(Customer.class);

}
 
开发者ID:smysnk,项目名称:dockyard-controller,代码行数:10,代码来源:ShoppingStore.java

示例6: getContext

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T getContext(final Class<?> c) {
    final MinijaxRequestContext context = MinijaxRequestContext.getThreadLocal();

    // 9.2.1
    if (c == Application.class) {
        return (T) context.getApplication();
    }

    // 9.2.2
    if (c == UriInfo.class) {
        return (T) context.getUriInfo();
    }

    // 9.2.3
    if (c == HttpHeaders.class) {
        return (T) context.getHttpHeaders();
    }

    // 9.2.4
    if (c == Request.class) {
        return null;
    }

    // 9.2.5
    if (c == SecurityContext.class) {
        return (T) context.getSecurityContext();
    }

    // 9.2.6
    if (c == Providers.class) {
        return (T) context.getApplication().getProviders();
    }

    // 9.2.7
    if (c == ResourceContext.class) {
        return null;
    }

    // 9.2.8
    if (c == Configuration.class) {
        return (T) context.getApplication().getConfiguration();
    }

    // 10.1
    if (c == ServletConfig.class) {
        return null;
    }

    // 10.1
    if (c == ServletContext.class) {
        return (T) context.getServletRequest().getServletContext();
    }

    // 10.1
    if (c == HttpServletRequest.class) {
        return (T) context.getServletRequest();
    }

    // 10.1
    if (c == HttpServletResponse.class) {
        return (T) context.getServletResponse();
    }

    throw new IllegalArgumentException("Unrecognized @Context parameter: " + c);
}
 
开发者ID:minijax,项目名称:minijax,代码行数:68,代码来源:MinijaxContextResolver.java

示例7: getResourceContext

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@GET
@Path("/resourcecontext")
public static String getResourceContext(@Context final ResourceContext resourceContext) {
    return "ok";
}
 
开发者ID:minijax,项目名称:minijax,代码行数:6,代码来源:ContextParamTest.java

示例8: ValidationConfigurationContextResolver

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Inject
public ValidationConfigurationContextResolver(ResourceContext resourceContext) {
  this.resourceContext = resourceContext;
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:5,代码来源:ValidationConfigurationContextResolver.java

示例9: method

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public Object method() {
    ResourceContext rc = null;
    if ("".equals(""))
        return rc.getResource(AnotherSubResource.class);
    return rc.getResource(SubResource.class);
}
 
开发者ID:sdaschner,项目名称:jaxrs-analyzer,代码行数:7,代码来源:TestClass5.java

示例10: method

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public SubResource method() {
    ResourceContext rc = null;
    return rc.getResource(SubResource.class);
}
 
开发者ID:sdaschner,项目名称:jaxrs-analyzer,代码行数:5,代码来源:TestClass1.java

示例11: method

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public Object method() {
    ResourceContext rc = null;
    final Object resource = rc.getResource(SubResource.class);
    return resource;
}
 
开发者ID:sdaschner,项目名称:jaxrs-analyzer,代码行数:6,代码来源:TestClass3.java

示例12: method

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public Object method() {
    ResourceContext rc = null;
    return rc.getResource(SubResource.class);
}
 
开发者ID:sdaschner,项目名称:jaxrs-analyzer,代码行数:5,代码来源:TestClass2.java

示例13: providesResourceContext

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Provides
@RequestScoped
public ResourceContext providesResourceContext()
{
    return filter.getResourceContext();
}
 
开发者ID:soabase,项目名称:soabase,代码行数:7,代码来源:JerseyGuiceModule.java

示例14: getResourceContext

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Provides
@RequestScoped
public ResourceContext getResourceContext() {
	return ResteasyProviderFactory.getContextData(ResourceContext.class);
}
 
开发者ID:devhub-tud,项目名称:git-server,代码行数:6,代码来源:GitServerModule.java

示例15: contextCDIIntegration

import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
private void contextCDIIntegration(final WebBeansContext wbc) {
    if (!enabled) {
        return;
    }

    final BeanManagerImpl beanManagerImpl = wbc.getBeanManagerImpl();
    if (!beanManagerImpl.getAdditionalQualifiers().contains(Context.class)) {
        beanManagerImpl.addAdditionalQualifier(Context.class);
    }
    if (!hasBean(beanManagerImpl, SecurityContext.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(SecurityContext.class, ThreadLocalContextManager.SECURITY_CONTEXT));
    }
    if (!hasBean(beanManagerImpl, UriInfo.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(UriInfo.class, ThreadLocalContextManager.URI_INFO));
    }
    if (!hasBean(beanManagerImpl, HttpServletResponse.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(HttpServletResponse.class, ThreadLocalContextManager.HTTP_SERVLET_RESPONSE));
    }
    if (!hasBean(beanManagerImpl, HttpHeaders.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(HttpHeaders.class, ThreadLocalContextManager.HTTP_HEADERS));
    }
    if (!hasBean(beanManagerImpl, Request.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(Request.class, ThreadLocalContextManager.REQUEST));
    }
    if (!hasBean(beanManagerImpl, ServletConfig.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ServletConfig.class, ThreadLocalContextManager.SERVLET_CONFIG));
    }
    if (!hasBean(beanManagerImpl, Providers.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(Providers.class, ThreadLocalContextManager.PROVIDERS));
    }
    if (!hasBean(beanManagerImpl, ContextResolver.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ContextResolver.class, ThreadLocalContextManager.CONTEXT_RESOLVER));
    }
    if (!hasBean(beanManagerImpl, ResourceInfo.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ResourceInfo.class, ThreadLocalContextManager.RESOURCE_INFO));
    }
    if (!hasBean(beanManagerImpl, ResourceContext.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ResourceContext.class, ThreadLocalContextManager.RESOURCE_CONTEXT));
    }
    if (!hasBean(beanManagerImpl, HttpServletRequest.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(HttpServletRequest.class, ThreadLocalContextManager.HTTP_SERVLET_REQUEST));
    }
    if (!hasBean(beanManagerImpl, ServletRequest.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ServletRequest.class, ThreadLocalContextManager.SERVLET_REQUEST));
    }
    if (!hasBean(beanManagerImpl, ServletContext.class)) {
        beanManagerImpl.addInternalBean(new ContextBean<>(ServletContext.class, ThreadLocalContextManager.SERVLET_CONTEXT));
    }
    beanManagerImpl.getInjectionResolver().clearCaches(); // hasBean() usage can have cached several things
}
 
开发者ID:apache,项目名称:tomee,代码行数:51,代码来源:CxfRSService.java


注:本文中的javax.ws.rs.container.ResourceContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。