Search in sources :

Example 6 with Dispatcher

use of org.apache.struts2.dispatcher.Dispatcher in project dhis2-core by dhis2.

the class DetectingSystemAuthoritiesProvider method getSystemAuthorities.

// -------------------------------------------------------------------------
// SystemAuthoritiesProvider implementation
// -------------------------------------------------------------------------
@Override
public Collection<String> getSystemAuthorities() {
    Dispatcher instance = Dispatcher.getInstance();
    if (instance == null) {
        return emptyList();
    }
    HashSet<String> authorities = new HashSet<>();
    Configuration configuration = instance.getConfigurationManager().getConfiguration();
    for (PackageConfig packageConfig : configuration.getPackageConfigs().values()) {
        for (ActionConfig actionConfig : packageConfig.getActionConfigs().values()) {
            authorities.addAll(requiredAuthoritiesProvider.getAllAuthorities(actionConfig));
        }
    }
    return authorities;
}
Also used : ActionConfig(com.opensymphony.xwork2.config.entities.ActionConfig) Configuration(com.opensymphony.xwork2.config.Configuration) Dispatcher(org.apache.struts2.dispatcher.Dispatcher) PackageConfig(com.opensymphony.xwork2.config.entities.PackageConfig) HashSet(java.util.HashSet)

Example 7 with Dispatcher

use of org.apache.struts2.dispatcher.Dispatcher in project entando-core by entando.

the class InitOperations method initDispatcher.

@Override
public Dispatcher initDispatcher(HostConfig filterConfig) {
    Map<String, String> params = new HashMap<String, String>();
    for (Iterator<String> e = filterConfig.getInitParameterNames(); e.hasNext(); ) {
        String name = (String) e.next();
        String value = filterConfig.getInitParameter(name);
        params.put(name, value);
    }
    String struts2Config = filterConfig.getServletContext().getInitParameter(ApsAdminSystemConstants.STRUTS2_CONFIG_INIT_PARAM_NAME);
    if (null != struts2Config) {
        params.put("config", struts2Config);
    }
    Dispatcher dispatcher = new Dispatcher(filterConfig.getServletContext(), params);
    dispatcher.init();
    return dispatcher;
}
Also used : HashMap(java.util.HashMap) Dispatcher(org.apache.struts2.dispatcher.Dispatcher)

Example 8 with Dispatcher

use of org.apache.struts2.dispatcher.Dispatcher in project entando-core by entando.

the class StrutsPrepareAndExecuteFilter method init.

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    InitOperations init = new InitOperations();
    Dispatcher dispatcher = null;
    try {
        FilterHostConfig config = new FilterHostConfig(filterConfig);
        init.initLogging(config);
        dispatcher = init.initDispatcher(config);
        init.initStaticContentLoader(config, dispatcher);
        this.prepare = new PrepareOperations(dispatcher);
        this.execute = new ExecuteOperations(dispatcher);
        this.excludedPatterns = init.buildExcludedPatternsList(dispatcher);
        this.postInit(dispatcher, filterConfig);
    } finally {
        if (dispatcher != null) {
            dispatcher.cleanUpAfterInit();
        }
        init.cleanup();
    }
}
Also used : FilterHostConfig(org.apache.struts2.dispatcher.filter.FilterHostConfig) ExecuteOperations(org.apache.struts2.dispatcher.ExecuteOperations) Dispatcher(org.apache.struts2.dispatcher.Dispatcher)

Example 9 with Dispatcher

use of org.apache.struts2.dispatcher.Dispatcher in project onebusaway-application-modules by camsys.

the class ConfigurationValueFunction method configValue.

public static String configValue(String key) {
    Dispatcher instance = Dispatcher.getInstance();
    if (instance == null)
        return null;
    Container container = instance.getContainer();
    ConfigurationValueFunction cv = new ConfigurationValueFunction();
    container.inject(cv);
    return cv.lookup(key);
}
Also used : Container(com.opensymphony.xwork2.inject.Container) Dispatcher(org.apache.struts2.dispatcher.Dispatcher)

Example 10 with Dispatcher

use of org.apache.struts2.dispatcher.Dispatcher in project qi4j-sdk by Qi4j.

the class Qi4jFilterDispatcher method createDispatcher.

@Override
protected Dispatcher createDispatcher(final FilterConfig filterConfig) {
    Dispatcher dispatcher = super.createDispatcher(filterConfig);
    ConfigurationManager configurationManager = createConfigurationManager(filterConfig);
    dispatcher.setConfigurationManager(configurationManager);
    return dispatcher;
}
Also used : Dispatcher(org.apache.struts2.dispatcher.Dispatcher) FilterDispatcher(org.apache.struts2.dispatcher.FilterDispatcher) ConfigurationManager(com.opensymphony.xwork2.config.ConfigurationManager)

Aggregations

Dispatcher (org.apache.struts2.dispatcher.Dispatcher)10 Container (com.opensymphony.xwork2.inject.Container)3 RequestContext (com.agiletec.aps.system.RequestContext)2 HashMap (java.util.HashMap)2 ExecuteOperations (org.apache.struts2.dispatcher.ExecuteOperations)2 InitOperations (com.agiletec.apsadmin.system.dispatcher.InitOperations)1 PrepareOperations (com.agiletec.apsadmin.system.dispatcher.PrepareOperations)1 Configuration (com.opensymphony.xwork2.config.Configuration)1 ConfigurationManager (com.opensymphony.xwork2.config.ConfigurationManager)1 ActionConfig (com.opensymphony.xwork2.config.entities.ActionConfig)1 PackageConfig (com.opensymphony.xwork2.config.entities.PackageConfig)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Properties (java.util.Properties)1 ServletException (javax.servlet.ServletException)1 FilterDispatcher (org.apache.struts2.dispatcher.FilterDispatcher)1 FilterHostConfig (org.apache.struts2.dispatcher.filter.FilterHostConfig)1 ActionMapper (org.apache.struts2.dispatcher.mapper.ActionMapper)1 ActionMapping (org.apache.struts2.dispatcher.mapper.ActionMapping)1 ServletHostConfig (org.apache.struts2.dispatcher.servlet.ServletHostConfig)1