use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class ModuleConfigImpl method freeze.
/**
* <p> Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return an
* IllegalStateException. </p>
*/
public void freeze() {
super.freeze();
ActionConfig[] aconfigs = findActionConfigs();
for (int i = 0; i < aconfigs.length; i++) {
aconfigs[i].freeze();
}
matcher = new ActionConfigMatcher(aconfigs);
getControllerConfig().freeze();
ExceptionConfig[] econfigs = findExceptionConfigs();
for (int i = 0; i < econfigs.length; i++) {
econfigs[i].freeze();
}
FormBeanConfig[] fbconfigs = findFormBeanConfigs();
for (int i = 0; i < fbconfigs.length; i++) {
fbconfigs[i].freeze();
}
ForwardConfig[] fconfigs = findForwardConfigs();
for (int i = 0; i < fconfigs.length; i++) {
fconfigs[i].freeze();
}
MessageResourcesConfig[] mrconfigs = findMessageResourcesConfigs();
for (int i = 0; i < mrconfigs.length; i++) {
mrconfigs[i].freeze();
}
PlugInConfig[] piconfigs = findPlugInConfigs();
for (int i = 0; i < piconfigs.length; i++) {
piconfigs[i].freeze();
}
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class ModuleConfigImpl method addActionConfig.
/**
* </p> Ad d a new <code>ActionConfig</code> instance to the set
* associated with this module. </p>
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
public void addActionConfig(ActionConfig config) {
throwIfConfigured();
config.setModuleConfig(this);
String path = config.getPath();
if (actionConfigs.containsKey(path)) {
log.warn("Overriding ActionConfig of path " + path);
}
String actionId = config.getActionId();
if ((actionId != null) && !actionId.equals("")) {
if (actionConfigIds.containsKey(actionId)) {
if (log.isWarnEnabled()) {
ActionConfig otherConfig = (ActionConfig) actionConfigIds.get(actionId);
StringBuffer msg = new StringBuffer("Overriding actionId[");
msg.append(actionId);
msg.append("] for path[");
msg.append(otherConfig.getPath());
msg.append("] with path[");
msg.append(path);
msg.append("]");
log.warn(msg);
}
}
actionConfigIds.put(actionId, config);
}
actionConfigs.put(path, config);
actionConfigList.add(config);
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestActionServlet method testProcessActionConfigClassOverriddenSubConfigClass.
/**
* Test the case where the subconfig has already specified its own config
* class. If the code still attempts to create a new instance, an error
* will be thrown.
*/
public void testProcessActionConfigClassOverriddenSubConfigClass() throws Exception {
moduleConfig.addActionConfig(baseAction);
ActionConfig customSub = new CustomActionConfigArg("/sub");
customSub.setExtends("/index");
moduleConfig.addActionConfig(customSub);
try {
actionServlet.processActionConfigClass(customSub, moduleConfig);
} catch (Exception e) {
fail("Exception should not be thrown");
}
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestAuthorizeAction method testNotAuthorizedOneOfManyRoles.
public void testNotAuthorizedOneOfManyRoles() throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testNotAuthorizedOneOfManyRoles");
config.setRoles("roustabout,memory");
this.saContext.setActionConfig(config);
try {
boolean result = command.execute(saContext);
} catch (UnauthorizedActionException ex) {
}
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean5.
// use servlet mapping (path mapping)
// -- with params
public void testString_getActionMappingURL_String_String_PageContext_boolean5() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "/myapp/*");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/mycontext", "/baz?foo=bar", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/foo?foo=bar", pageContext), "/mycontext/myapp/foo?foo=bar");
}
Aggregations