use of org.glassfish.web.deployment.runtime.SunWebAppImpl in project Payara by payara.
the class WebBundleRuntimeNode method startElement.
@Override
public void startElement(XMLElement element, Attributes attributes) {
if (element.getQName().equals(RuntimeTagNames.PARAMETER_ENCODING)) {
SunWebAppImpl sunWebApp = (SunWebAppImpl) getSunDescriptor();
sunWebApp.setParameterEncoding(true);
for (int i = 0; i < attributes.getLength(); i++) {
if (RuntimeTagNames.DEFAULT_CHARSET.equals(attributes.getQName(i))) {
sunWebApp.setAttributeValue(SunWebApp.PARAMETER_ENCODING, SunWebApp.DEFAULT_CHARSET, attributes.getValue(i));
}
if (RuntimeTagNames.FORM_HINT_FIELD.equals(attributes.getQName(i))) {
sunWebApp.setAttributeValue(SunWebApp.PARAMETER_ENCODING, SunWebApp.FORM_HINT_FIELD, attributes.getValue(i));
}
}
} else
super.startElement(element, attributes);
}
use of org.glassfish.web.deployment.runtime.SunWebAppImpl in project Payara by payara.
the class EjbInvokerService method event.
@Override
public void event(EventListener.Event event) {
if (event.is(Deployment.APPLICATION_PREPARED)) {
DeploymentContext context = (DeploymentContext) event.hook();
Application app = context.getModuleMetaData(Application.class);
if (app != null && EJB_INVOKER_APP.equals(app.getAppName()) && Boolean.parseBoolean(config.getSecurityEnabled())) {
for (WebBundleDescriptor descriptor : app.getBundleDescriptors(WebBundleDescriptor.class)) {
SunWebAppImpl webApp = (SunWebAppImpl) descriptor.getSunDescriptor();
String moduleName;
if (StringUtils.ok(config.getAuthModuleClass()) && config.getAuthModuleClass().indexOf('.') != -1) {
moduleName = config.getAuthModuleClass().substring(config.getAuthModuleClass().lastIndexOf('.') + 1);
webApp.setAttributeValue(HTTPSERVLET_SECURITY_PROVIDER, moduleName);
} else if (StringUtils.ok(config.getAuthModule())) {
moduleName = config.getAuthModule();
webApp.setAttributeValue(HTTPSERVLET_SECURITY_PROVIDER, moduleName);
}
LoginConfiguration loginConf = descriptor.getLoginConfiguration();
String authType = config.getAuthType();
String realmName = config.getRealmName();
if (StringUtils.ok(authType)) {
loginConf.setAuthenticationMethod(authType);
}
if (StringUtils.ok(realmName)) {
loginConf.setRealmName(realmName);
}
if (FORM_AUTH.equals(config.getAuthType())) {
loginConf.setFormErrorPage("/error.xhtml");
loginConf.setFormLoginPage("/login.xhtml");
}
}
}
}
}
Aggregations