Search in sources :

Example 11 with SunWebAppImpl

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);
}
Also used : SunWebAppImpl(org.glassfish.web.deployment.runtime.SunWebAppImpl)

Example 12 with SunWebAppImpl

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");
                }
            }
        }
    }
}
Also used : SunWebAppImpl(org.glassfish.web.deployment.runtime.SunWebAppImpl) DeploymentContext(org.glassfish.api.deployment.DeploymentContext) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) LoginConfiguration(com.sun.enterprise.deployment.web.LoginConfiguration) Application(com.sun.enterprise.deployment.Application)

Aggregations

SunWebAppImpl (org.glassfish.web.deployment.runtime.SunWebAppImpl)12 Cache (org.glassfish.web.deployment.runtime.Cache)5 WebProperty (org.glassfish.web.deployment.runtime.WebProperty)5 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)3 Application (com.sun.enterprise.deployment.Application)2 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)2 SecurityRoleMapping (com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping)2 IdempotentUrlPattern (com.sun.enterprise.deployment.runtime.web.IdempotentUrlPattern)2 Result (com.sun.enterprise.tools.verifier.Result)2 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)2 CacheMapping (org.glassfish.web.deployment.runtime.CacheMapping)2 ClassLoader (org.glassfish.web.deployment.runtime.ClassLoader)2 JspConfig (org.glassfish.web.deployment.runtime.JspConfig)2 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)1 ResourceEnvReferenceDescriptor (com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor)1 ResourceReferenceDescriptor (com.sun.enterprise.deployment.ResourceReferenceDescriptor)1 XMLElement (com.sun.enterprise.deployment.node.XMLElement)1 EjbRefNode (com.sun.enterprise.deployment.node.runtime.EjbRefNode)1 MessageDestinationRefNode (com.sun.enterprise.deployment.node.runtime.MessageDestinationRefNode)1