當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。