Search in sources :

Example 1 with ContextParam

use of org.glassfish.web.config.serverbeans.ContextParam in project Payara by payara.

the class ListWebContextParamCommand method execute.

public void execute(AdminCommandContext context) {
    ActionReport report = context.getActionReport();
    WebModuleConfig config = webModuleConfig(report);
    if (config == null) {
        return;
    }
    ActionReport.MessagePart part = report.getTopMessagePart();
    final String format = localStrings.getLocalString("listWebContextParamFormat", "{0} = {1} ignoreDescriptorItem={2} //{3}");
    int reported = 0;
    for (ContextParam param : config.contextParamsMatching(name)) {
        ActionReport.MessagePart childPart = part.addChild();
        childPart.setMessage(MessageFormat.format(format, param.getParamName(), param.getParamValue(), param.getIgnoreDescriptorItem(), descriptionValueOrNotSpecified(param.getDescription())));
        reported++;
    }
    succeed(report, "listSummary", "Reported {0,choice,0#no {1} settings|1#one {1} setting|1<{0,number,integer} {1} settings}", reported, "context-param");
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) ActionReport(org.glassfish.api.ActionReport) ContextParam(org.glassfish.web.config.serverbeans.ContextParam)

Example 2 with ContextParam

use of org.glassfish.web.config.serverbeans.ContextParam in project Payara by payara.

the class SetWebContextParamCommand method setContextParam.

private void setContextParam(final Engine owningEngine, final String paramName, final String paramValue, final String description, final Boolean ignoreDescriptorItem, final ActionReport report) throws PropertyVetoException, TransactionFailure {
    WebModuleConfig config = WebModuleConfig.Duck.webModuleConfig(owningEngine);
    if (config == null) {
        createContextParamOnNewWMC(owningEngine, paramName, paramValue, description, ignoreDescriptorItem);
    } else {
        ContextParam cp = config.getContextParam(paramName);
        if (cp == null) {
            createContextParamOnExistingWMC(config, paramName, paramValue, description, ignoreDescriptorItem);
        } else {
            modifyContextParam(cp, paramValue, description, ignoreDescriptorItem);
            succeed(report, "setWebContextParamOverride", "Previous context-param setting of {0} for application/module {1} was overridden.", name, appNameAndOptionalModuleName());
        }
    }
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) ContextParam(org.glassfish.web.config.serverbeans.ContextParam)

Aggregations

ContextParam (org.glassfish.web.config.serverbeans.ContextParam)2 WebModuleConfig (org.glassfish.web.config.serverbeans.WebModuleConfig)2 ActionReport (org.glassfish.api.ActionReport)1