Search in sources :

Example 11 with WebProperty

use of org.glassfish.web.deployment.runtime.WebProperty in project Payara by payara.

the class DynamicWebServletRegistrationImpl method configureLoaderProperties.

/**
 * Configures the given classloader with its properties specified in
 * sun-web.xml.
 *
 * @param loader The classloader to configure
 * @param clBean The class-loader info from sun-web.xml
 */
private void configureLoaderProperties(Loader loader, org.glassfish.web.deployment.runtime.ClassLoader clBean) {
    String name = null;
    String value = null;
    WebProperty[] props = clBean.getWebProperty();
    if (props == null || props.length == 0) {
        return;
    }
    for (WebProperty prop : props) {
        name = prop.getAttributeValue(WebProperty.NAME);
        value = prop.getAttributeValue(WebProperty.VALUE);
        if (name == null || value == null) {
            throw new IllegalArgumentException(rb.getString(LogFacade.NULL_WEB_MODULE_PROPERTY));
        }
        if ("ignoreHiddenJarFiles".equalsIgnoreCase(name)) {
            loader.setIgnoreHiddenJarFiles(ConfigBeansUtilities.toBoolean(value));
        } else {
            Object[] params = { name, value };
            logger.log(Level.WARNING, LogFacade.INVALID_PROPERTY, params);
        }
    }
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty)

Example 12 with WebProperty

use of org.glassfish.web.deployment.runtime.WebProperty in project Payara by payara.

the class DynamicWebServletRegistrationImpl method configureMiscSettings.

/**
 * Configure miscellaneous settings such as the pool size for
 * single threaded servlets, specifying a temporary directory other
 * than the default etc.
 *
 * Since the work directory is used when configuring the session manager
 * persistence settings, this method must be invoked prior to
 * <code>configureSessionSettings</code>.
 */
void configureMiscSettings(SunWebAppImpl bean, VirtualServer vs, String contextPath) {
    /*
         * Web app inherits setting of allowLinking property from vs on which
         * it is being deployed, but may override it using allowLinking
         * property in its sun-web.xml
         */
    boolean allowLinking = vs.getAllowLinking();
    if ((bean != null) && (bean.sizeWebProperty() > 0)) {
        WebProperty[] props = bean.getWebProperty();
        for (WebProperty prop : props) {
            String name = prop.getAttributeValue("name");
            String value = prop.getAttributeValue("value");
            if (name == null || value == null) {
                throw new IllegalArgumentException(rb.getString(LogFacade.NULL_WEB_MODULE_PROPERTY));
            }
            if ("singleThreadedServletPoolSize".equalsIgnoreCase(name)) {
                int poolSize = getSTMPoolSize();
                try {
                    poolSize = Integer.parseInt(value);
                } catch (NumberFormatException e) {
                    String msg = rb.getString(LogFacade.INVALID_SERVLET_POOL_SIZE);
                    msg = MessageFormat.format(msg, value, contextPath, Integer.toString(poolSize));
                    logger.log(Level.WARNING, msg, e);
                }
                if (poolSize > 0) {
                    setSTMPoolSize(poolSize);
                }
            } else if ("tempdir".equalsIgnoreCase(name)) {
                setWorkDir(value);
            } else if ("crossContextAllowed".equalsIgnoreCase(name)) {
                boolean crossContext = Boolean.parseBoolean(value);
                setCrossContext(crossContext);
            } else if ("allowLinking".equalsIgnoreCase(name)) {
                allowLinking = ConfigBeansUtilities.toBoolean(value);
            // START S1AS8PE 4817642
            } else if ("reuseSessionID".equalsIgnoreCase(name)) {
                boolean reuse = ConfigBeansUtilities.toBoolean(value);
                setReuseSessionID(reuse);
                if (reuse) {
                    String msg = rb.getString(LogFacade.SESSION_IDS_REUSED);
                    msg = MessageFormat.format(msg, contextPath, vs.getID());
                    logger.log(Level.WARNING, msg);
                }
            // END S1AS8PE 4817642
            } else if ("useResponseCTForHeaders".equalsIgnoreCase(name)) {
                if ("true".equalsIgnoreCase(value)) {
                    setResponseCTForHeaders();
                }
            } else if ("encodeCookies".equalsIgnoreCase(name)) {
                boolean flag = ConfigBeansUtilities.toBoolean(value);
                setEncodeCookies(flag);
            // START RIMOD 4642650
            } else if ("relativeRedirectAllowed".equalsIgnoreCase(name)) {
                boolean relativeRedirect = ConfigBeansUtilities.toBoolean(value);
                setAllowRelativeRedirect(relativeRedirect);
            // END RIMOD 4642650
            } else if ("fileEncoding".equalsIgnoreCase(name)) {
                setFileEncoding(value);
            } else if ("enableTldValidation".equalsIgnoreCase(name) && ConfigBeansUtilities.toBoolean(value)) {
                setTldValidation(true);
            } else if ("enableTldNamespaceAware".equalsIgnoreCase(name) && ConfigBeansUtilities.toBoolean(value)) {
                setTldNamespaceAware(true);
            } else if ("securePagesWithPragma".equalsIgnoreCase(name)) {
                boolean securePagesWithPragma = ConfigBeansUtilities.toBoolean(value);
                setSecurePagesWithPragma(securePagesWithPragma);
            } else if ("useMyFaces".equalsIgnoreCase(name)) {
                setUseMyFaces(ConfigBeansUtilities.toBoolean(value));
            } else if ("useBundledJsf".equalsIgnoreCase(name)) {
                setUseMyFaces(ConfigBeansUtilities.toBoolean(value));
            } else if ("default-role-mapping".equalsIgnoreCase(name)) {
                wmInfo.getDescriptor().setDefaultGroupPrincipalMapping(ConfigBeansUtilities.toBoolean(value));
            } else if (name.startsWith("alternatedocroot_")) {
                parseAlternateDocBase(name, value);
            } else if (name.startsWith("valve_") || name.startsWith("listener_")) {
            // do nothing; these properties are dealt with
            // in configureCatalinaProperties()
            } else {
                Object[] params = { name, value };
                logger.log(Level.WARNING, LogFacade.INVALID_PROPERTY, params);
            }
        }
    }
    setAllowLinking(allowLinking);
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty) UserDataConstraint(com.sun.enterprise.deployment.web.UserDataConstraint) SecurityConstraint(com.sun.enterprise.deployment.web.SecurityConstraint) WebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint)

Example 13 with WebProperty

use of org.glassfish.web.deployment.runtime.WebProperty in project Payara by payara.

the class DynamicWebServletRegistrationImpl method configureCatalinaProperties.

/**
 * Configure the <code>WebModule</code< properties.
 */
protected void configureCatalinaProperties() {
    String propName = null;
    String propValue = null;
    if (bean != null) {
        List<Property> props = bean.getProperty();
        if (props != null) {
            for (Property prop : props) {
                propName = prop.getName();
                propValue = prop.getValue();
                configureCatalinaProperties(propName, propValue);
            }
        }
    }
    if (iasBean != null && iasBean.sizeWebProperty() > 0) {
        WebProperty[] wprops = iasBean.getWebProperty();
        for (WebProperty wprop : wprops) {
            propName = wprop.getAttributeValue("name");
            propValue = wprop.getAttributeValue("value");
            configureCatalinaProperties(propName, propValue);
        }
    }
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty) Property(org.jvnet.hk2.config.types.Property) WebProperty(org.glassfish.web.deployment.runtime.WebProperty)

Example 14 with WebProperty

use of org.glassfish.web.deployment.runtime.WebProperty in project Payara by payara.

the class CacheHelperNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param nodeName node name
 * @param descriptor the descriptor to write
 * @return the DOM tree top node
 */
@Override
public Node writeDescriptor(Node parent, String nodeName, CacheHelper descriptor) {
    Element cacheHelper = (Element) super.writeDescriptor(parent, nodeName, descriptor);
    // property*
    WebProperty[] properties = descriptor.getWebProperty();
    if (properties.length > 0) {
        WebPropertyNode wpn = new WebPropertyNode();
        wpn.writeDescriptor(cacheHelper, RuntimeTagNames.PROPERTY, properties);
    }
    // name, class-name attribute
    setAttribute(cacheHelper, RuntimeTagNames.NAME, (String) descriptor.getAttributeValue(CacheHelper.NAME));
    setAttribute(cacheHelper, RuntimeTagNames.CLASS_NAME, (String) descriptor.getAttributeValue(CacheHelper.CLASS_NAME));
    return cacheHelper;
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty) Element(org.w3c.dom.Element) XMLElement(com.sun.enterprise.deployment.node.XMLElement)

Example 15 with WebProperty

use of org.glassfish.web.deployment.runtime.WebProperty in project Payara by payara.

the class ClassLoaderNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param nodeName node name
 * @param descriptor the descriptor to write
 * @return the DOM tree top node
 */
@Override
public Node writeDescriptor(Node parent, String nodeName, ClassLoader descriptor) {
    Element classLoader = (Element) super.writeDescriptor(parent, nodeName, descriptor);
    // property*
    WebProperty[] properties = descriptor.getWebProperty();
    if (properties != null && properties.length > 0) {
        WebPropertyNode wpn = new WebPropertyNode();
        wpn.writeDescriptor(classLoader, RuntimeTagNames.PROPERTY, properties);
    }
    // extra-class-path, delegate, dynamic-reload-interval
    setAttribute(classLoader, RuntimeTagNames.EXTRA_CLASS_PATH, (String) descriptor.getAttributeValue(ClassLoader.EXTRA_CLASS_PATH));
    setAttribute(classLoader, RuntimeTagNames.DELEGATE, (String) descriptor.getAttributeValue(ClassLoader.DELEGATE));
    setAttribute(classLoader, RuntimeTagNames.DYNAMIC_RELOAD_INTERVAL, (String) descriptor.getAttributeValue(ClassLoader.DYNAMIC_RELOAD_INTERVAL));
    return classLoader;
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty) Element(org.w3c.dom.Element) XMLElement(com.sun.enterprise.deployment.node.XMLElement)

Aggregations

WebProperty (org.glassfish.web.deployment.runtime.WebProperty)16 SunWebAppImpl (org.glassfish.web.deployment.runtime.SunWebAppImpl)4 XMLElement (com.sun.enterprise.deployment.node.XMLElement)3 Element (org.w3c.dom.Element)3 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)2 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)2 SecurityConstraint (com.sun.enterprise.deployment.web.SecurityConstraint)2 UserDataConstraint (com.sun.enterprise.deployment.web.UserDataConstraint)2 Cache (org.glassfish.web.deployment.runtime.Cache)2 JspConfig (org.glassfish.web.deployment.runtime.JspConfig)2 ManagerProperties (org.glassfish.web.deployment.runtime.ManagerProperties)2 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)1 Application (com.sun.enterprise.deployment.Application)1 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)1 PrincipalNameDescriptor (com.sun.enterprise.deployment.runtime.common.PrincipalNameDescriptor)1 SecurityRoleMapping (com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping)1 IdempotentUrlPattern (com.sun.enterprise.deployment.runtime.web.IdempotentUrlPattern)1 InitializationParameter (com.sun.enterprise.deployment.web.InitializationParameter)1 Result (com.sun.enterprise.tools.verifier.Result)1 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)1