本文整理了Java中org.jboss.resteasy.core.Dispatcher.getProviderFactory()
方法的一些代码示例,展示了Dispatcher.getProviderFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dispatcher.getProviderFactory()
方法的具体详情如下:
包路径:org.jboss.resteasy.core.Dispatcher
类名称:Dispatcher
方法名:getProviderFactory
暂无
代码示例来源:origin: atomix/atomix
deployment.getDispatcher().getProviderFactory().register(new JacksonProvider(createObjectMapper()));
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
@Override
public HttpResponse createResteasyHttpResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory()) {
@Override
public void addNewCookie(NewCookie cookie)
{
outputHeaders.add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, cookie);
}
};
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
@Override
protected HttpResponse createServletResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory()) {
@Override
public void addNewCookie(NewCookie cookie)
{
outputHeaders.add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, cookie);
}
};
}
}
代码示例来源:origin: org.jboss.resteasy/async-http-servlet-3.0
@Override
public HttpResponse createResteasyHttpResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory()) {
@Override
public void addNewCookie(NewCookie cookie)
{
Cookie cook = new Cookie(cookie.getName(), cookie.getValue());
cook.setMaxAge(cookie.getMaxAge());
cook.setVersion(cookie.getVersion());
if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain());
if (cookie.getPath() != null) cook.setPath(cookie.getPath());
cook.setSecure(cookie.isSecure());
if (cookie.getComment() != null) cook.setComment(cookie.getComment());
if (cookie.isHttpOnly()) cook.setHttpOnly(true);
this.response.addCookie(cook);
}
};
}
代码示例来源:origin: org.jboss.resteasy/async-http-servlet-3.0
@Override
protected HttpResponse createServletResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory()) {
@Override
public void addNewCookie(NewCookie cookie)
{
Cookie cook = new Cookie(cookie.getName(), cookie.getValue());
cook.setMaxAge(cookie.getMaxAge());
cook.setVersion(cookie.getVersion());
if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain());
if (cookie.getPath() != null) cook.setPath(cookie.getPath());
cook.setSecure(cookie.isSecure());
if (cookie.getComment() != null) cook.setComment(cookie.getComment());
if (cookie.isHttpOnly()) cook.setHttpOnly(true);
this.response.addCookie(cook);
}
};
}
}
代码示例来源:origin: com.peterphi.std.guice/stdlib-guice-webapp
@Override
public HttpResponse createResteasyHttpResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, dispatcher.getDispatcher().getProviderFactory());
}
}
代码示例来源:origin: org.jboss.resteasy/resteasy-test-tjws
public HttpResponse createResteasyHttpResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory());
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
public HttpResponse createResteasyHttpResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory());
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
protected HttpResponse createServletResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory());
}
代码示例来源:origin: org.jboss.resteasy/resteasy-test-tjws
protected HttpResponse createServletResponse(HttpServletResponse response)
{
return new HttpServletResponseWrapper(response, getDispatcher().getProviderFactory());
}
代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20
public static Dispatcher createDispatcher()
{
Dispatcher dispatcher = new SynchronousDispatcher(new ResteasyProviderFactory());
ResteasyProviderFactory.setInstance(dispatcher.getProviderFactory());
RegisterBuiltin.register(dispatcher.getProviderFactory());
return dispatcher;
}
}
代码示例来源:origin: io.takari.siesta/siesta-server
@Override
public void removeComponent(final BeanEntry<?, ?> entry) throws Exception {
Class<?> type = entry.getImplementationClass();
if (isResource(type)) {
getDispatcher().getRegistry().removeRegistrations(type);
String path = resourcePath(type);
log.debug("Removed resource: {} with path: {}", type.getName(), path);
}
else {
ResteasyProviderFactory providerFactory = getDispatcher().getProviderFactory();
if (providerFactory instanceof SisuResteasyProviderFactory) {
((SisuResteasyProviderFactory) providerFactory).removeRegistrations(type);
log.debug("Removed component: {}", type.getName());
}
else {
log.warn("Component removal not supported; Unable to remove component: {}", type.getName());
}
}
}
}
代码示例来源:origin: io.takari.siesta/siesta-server
private void doInit(final ServletConfig servletConfig) throws ServletException {
deployment.start();
servletConfig.getServletContext().setAttribute(ResteasyDeployment.class.getName(), deployment);
super.init(servletConfig);
if (log.isDebugEnabled()) {
ResteasyProviderFactory providerFactory = getDispatcher().getProviderFactory();
log.debug("Provider factory: {}", providerFactory);
log.debug("Configuration: {}", providerFactory.getConfiguration());
log.debug("Runtime type: {}", providerFactory.getRuntimeType());
log.debug("Built-ins registered: {}", providerFactory.isBuiltinsRegistered());
log.debug("Properties: {}", providerFactory.getProperties());
log.debug("Dynamic features: {}", providerFactory.getServerDynamicFeatures());
log.debug("Enabled features: {}", providerFactory.getEnabledFeatures());
log.debug("Class contracts: {}", providerFactory.getClassContracts());
log.debug("Reader interceptor registry: {}", providerFactory.getServerReaderInterceptorRegistry());
log.debug("Writer interceptor registry: {}", providerFactory.getServerWriterInterceptorRegistry());
log.debug("Injector factory: {}", providerFactory.getInjectorFactory());
log.debug("Instances: {}", providerFactory.getInstances());
log.debug("Exception mappers: {}", providerFactory.getExceptionMappers());
}
}
代码示例来源:origin: io.takari.siesta/siesta-server
@Override
public void addComponent(final BeanEntry<?, ?> entry) throws Exception {
Class<?> type = entry.getImplementationClass();
if (isResource(type)) {
getDispatcher().getRegistry().addResourceFactory(new SisuResourceFactory(entry));
String path = resourcePath(type);
if (path == null) {
log.warn("Found resource implementation missing @Path: {}", type.getName());
}
else {
log.debug("Added resource: {} with path: {}", type.getName(), path);
}
}
else {
// TODO: Doesn't seem to be a late-biding/factory here so we create the object early
getDispatcher().getProviderFactory().register(entry.getValue());
log.debug("Added component: {}", type.getName());
}
}
代码示例来源:origin: org.jboss.seam/jboss-seam-resteasy
protected void registerInterfaceSeamComponentResource(Component seamComponent, Class resourceInterface)
{
log.debug(
"registering resource, annotated interface {1}, as Seam component: {0}",
seamComponent.getName(),
resourceInterface.getName()
);
ResourceFactory factory = new SeamResteasyResourceFactory(
resourceInterface,
seamComponent,
getDispatcher().getProviderFactory()
);
getDispatcher().getRegistry().addResourceFactory(factory);
}
代码示例来源:origin: org.jboss.seam/jboss-seam-resteasy
protected void registerSeamComponentProvider(Component seamComponent)
{
log.debug("registering provider as Seam component: {0}", seamComponent.getName());
getDispatcher().getProviderFactory().registerProviderInstance(
Component.getInstance(seamComponent.getName())
);
}
代码示例来源:origin: info.magnolia.rest/magnolia-rest-integration
@Override
public void init(ServletConfig servletConfig) throws ServletException {
this.servletConfig = servletConfig;
// Initialise the ServletContainerDispatcher
servletContainerDispatcher = new ServletContainerDispatcher();
ConfigurationBootstrap bootstrap = createBootstrap(servletConfig);
servletContainerDispatcher.init(servletConfig.getServletContext(), bootstrap, this, this);
servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
// Register additional providers that have been configured
for (AdditionalProviderDefinition provider : restIntegrationModule.getAdditionalProviders()) {
log.debug("Registering additional provider [{}]", provider.getProviderClass());
super.getDispatcher().getProviderFactory().registerProvider(provider.getProviderClass());
}
// Register all currently registered endpoints
for (DefinitionProvider<EndpointDefinition> provider : endpointRegistry.getAllProviders()) {
try {
registerEndpoint(provider);
} catch (Exception e) {
log.error("Failed to register endpoint [{}]", provider.getMetadata().getReferenceId(), e);
// Others should continue to be registered.
}
}
// Listen for changes to the registry to observe endpoints being added or removed
registerHandler = systemEventBus.addHandler(EndpointDefinitionRegistryEvent.class, this);
}
代码示例来源:origin: org.jboss.seam/jboss-seam-resteasy
protected void registerSeamComponentResource(Component seamComponent)
{
log.debug("registering resource as Seam component: {0}", seamComponent.getName());
ResourceFactory factory = new SeamResteasyResourceFactory(
seamComponent.getBeanClass(),
seamComponent,
getDispatcher().getProviderFactory()
);
getDispatcher().getRegistry().addResourceFactory(factory);
}
代码示例来源:origin: com.arcbees/guicy-resteasy
@Override
public void init(FilterConfig servletConfig) throws ServletException {
super.init(servletConfig);
Registry registry = getDispatcher().getRegistry();
ResteasyProviderFactory providerFactory = getDispatcher().getProviderFactory();
for (final Binding<?> binding : injector.getBindings().values()) {
Type type = binding.getKey().getTypeLiteral().getType();
if (type instanceof Class) {
Class<?> beanClass = (Class) type;
if (GetRestful.isRootResource(beanClass)) {
ResourceFactory resourceFactory = new GuiceResourceFactory(binding.getProvider(), beanClass);
registry.addResourceFactory(resourceFactory);
}
if (beanClass.isAnnotationPresent(Provider.class)) {
providerFactory.registerProviderInstance(binding.getProvider().get());
}
}
}
}
}
代码示例来源:origin: org.jboss.seam/jboss-seam-resteasy
protected void registerHomeQueryResources(Component seamComponent)
{
// We can always instantiate this safely here because it can't have dependencies!
AbstractResource instance = (AbstractResource) seamComponent.newInstance();
String path = instance.getPath();
if (path != null)
{
if (!path.startsWith("/")) {
path = "/" + path;
}
log.debug(
"registering resource, configured ResourceHome/Query on path {1}, as Seam component: {0}",
seamComponent.getName(),
path
);
ResourceFactory factory = new SeamResteasyResourceFactory(
seamComponent.getBeanClass(),
seamComponent,
getDispatcher().getProviderFactory()
);
getDispatcher().getRegistry().addResourceFactory(factory, path);
}
else
{
log.error("Unable to register {0} resource on null path, check components.xml", seamComponent.getName());
}
}
内容来源于网络,如有侵权,请联系作者删除!