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


Java ResteasyProviderFactory.removeContextDataLevel方法代码示例

本文整理汇总了Java中org.jboss.resteasy.spi.ResteasyProviderFactory.removeContextDataLevel方法的典型用法代码示例。如果您正苦于以下问题:Java ResteasyProviderFactory.removeContextDataLevel方法的具体用法?Java ResteasyProviderFactory.removeContextDataLevel怎么用?Java ResteasyProviderFactory.removeContextDataLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.resteasy.spi.ResteasyProviderFactory的用法示例。


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

示例1: onError

import org.jboss.resteasy.spi.ResteasyProviderFactory; //导入方法依赖的package包/类
@Override
     public void onError(Throwable e) {
ResteasyProviderFactory.pushContextDataMap(contextDataMap);
AppGlobals previous = AppGlobals.set(appGlobals);
try {
	actual.onError(e);
}finally {
	AppGlobals.set(previous);
	ResteasyProviderFactory.removeContextDataLevel();
}
     }
 
开发者ID:FroMage,项目名称:redpipe,代码行数:12,代码来源:ResteasyContextPropagatingOnSingleCreateAction.java

示例2: onSuccess

import org.jboss.resteasy.spi.ResteasyProviderFactory; //导入方法依赖的package包/类
@Override
     public void onSuccess(T t) {
ResteasyProviderFactory.pushContextDataMap(contextDataMap);
AppGlobals previous = AppGlobals.set(appGlobals);
try {
	actual.onSuccess(t);
}finally {
	AppGlobals.set(previous);
	ResteasyProviderFactory.removeContextDataLevel();
}
     }
 
开发者ID:FroMage,项目名称:redpipe,代码行数:12,代码来源:ResteasyContextPropagatingOnSingleCreateAction.java

示例3: init

import org.jboss.resteasy.spi.ResteasyProviderFactory; //导入方法依赖的package包/类
public void init(ServletContext servletContext, ConfigurationBootstrap bootstrap, HttpRequestFactory requestFactory,
        HttpResponseFactory responseFactory) throws ServletException {
    this.requestFactory = requestFactory;
    this.responseFactory = responseFactory;
    ResteasyProviderFactory globalFactory = (ResteasyProviderFactory) servletContext
            .getAttribute(ResteasyProviderFactory.class.getName());
    Dispatcher globalDispatcher = (Dispatcher) servletContext.getAttribute(Dispatcher.class.getName());
    
    String application = bootstrap.getInitParameter("javax.ws.rs.Application");
    String useGlobalStr = bootstrap.getInitParameter("resteasy.servlet.context.deployment");
    boolean useGlobal = globalFactory != null;
    if (useGlobalStr != null) {
        useGlobal = Boolean.parseBoolean(useGlobalStr);
    }
    
    // use global is backward compatible with 2.3.x and earlier and will store and/or use the
    // dispatcher and provider factory
    // in the servlet context
    if (useGlobal) {
        this.providerFactory = globalFactory;
        this.dispatcher = globalDispatcher;
        if (((this.providerFactory != null) && (this.dispatcher == null))
                || ((this.providerFactory == null) && (this.dispatcher != null))) { throw new ServletException(
                "Unknown state.  You have a Listener messing up what resteasy expects"); }
        // We haven't been initialized by an external entity so bootstrap ourselves
        if (this.providerFactory == null) {
            this.deployment = bootstrap.createDeployment();
            this.deployment.start();
            
            servletContext.setAttribute(ResteasyProviderFactory.class.getName(), this.deployment.getProviderFactory());
            servletContext.setAttribute(Dispatcher.class.getName(), this.deployment.getDispatcher());
            servletContext.setAttribute(Registry.class.getName(), this.deployment.getRegistry());
            
            this.dispatcher = this.deployment.getDispatcher();
            this.providerFactory = this.deployment.getProviderFactory();
            
        } else {
            // ResteasyBootstrap inited us. Check to see if the servlet defines an Application
            // class
            if (application != null) {
                try {
                    Map contextDataMap = ResteasyProviderFactory.getContextDataMap();
                    contextDataMap.putAll(this.dispatcher.getDefaultContextObjects());
                    Application app = ResteasyDeployment.createApplication(application.trim(), this.dispatcher,
                            this.providerFactory);
                    // push context data so we can inject it
                    processApplication(app);
                } finally {
                    ResteasyProviderFactory.removeContextDataLevel();
                }
            }
        }
        this.servletMappingPrefix = bootstrap.getParameter(ResteasyContextParameters.RESTEASY_SERVLET_MAPPING_PREFIX);
        if (this.servletMappingPrefix == null) {
            this.servletMappingPrefix = "";
        }
        this.servletMappingPrefix = this.servletMappingPrefix.trim();
    } else {
        this.deployment = bootstrap.createDeployment();
        this.deployment.start();
        this.dispatcher = this.deployment.getDispatcher();
        this.providerFactory = this.deployment.getProviderFactory();
        
        this.servletMappingPrefix = bootstrap.getParameter(ResteasyContextParameters.RESTEASY_SERVLET_MAPPING_PREFIX);
        if (this.servletMappingPrefix == null) {
            this.servletMappingPrefix = "";
        }
        this.servletMappingPrefix = this.servletMappingPrefix.trim();
    }
}
 
开发者ID:trein,项目名称:gtfs-java,代码行数:71,代码来源:MultipleServletContainerDispatcher.java


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