本文整理汇总了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();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例7: getResourceContext
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@GET
@Path("/resourcecontext")
public static String getResourceContext(@Context final ResourceContext resourceContext) {
return "ok";
}
示例8: ValidationConfigurationContextResolver
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Inject
public ValidationConfigurationContextResolver(ResourceContext resourceContext) {
this.resourceContext = resourceContext;
}
示例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);
}
示例10: method
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public SubResource method() {
ResourceContext rc = null;
return rc.getResource(SubResource.class);
}
示例11: method
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public Object method() {
ResourceContext rc = null;
final Object resource = rc.getResource(SubResource.class);
return resource;
}
示例12: method
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
public Object method() {
ResourceContext rc = null;
return rc.getResource(SubResource.class);
}
示例13: providesResourceContext
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Provides
@RequestScoped
public ResourceContext providesResourceContext()
{
return filter.getResourceContext();
}
示例14: getResourceContext
import javax.ws.rs.container.ResourceContext; //导入依赖的package包/类
@Provides
@RequestScoped
public ResourceContext getResourceContext() {
return ResteasyProviderFactory.getContextData(ResourceContext.class);
}
示例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
}