Search in sources :

Example 1 with ServletFilter

use of com.sun.enterprise.deployment.web.ServletFilter in project Payara by payara.

the class WebBundleDescriptorImpl method combineServletFilters.

@Override
protected void combineServletFilters(WebBundleDescriptor webBundleDescriptor) {
    for (ServletFilter servletFilter : webBundleDescriptor.getServletFilters()) {
        ServletFilterDescriptor servletFilterDesc = (ServletFilterDescriptor) servletFilter;
        String name = servletFilter.getName();
        ServletFilterDescriptor aServletFilterDesc = null;
        for (ServletFilter sf : getServletFilters()) {
            if (name.equals(sf.getName())) {
                aServletFilterDesc = (ServletFilterDescriptor) sf;
                break;
            }
        }
        if (aServletFilterDesc != null) {
            if (!aServletFilterDesc.isConflict(servletFilterDesc)) {
                if (aServletFilterDesc.getClassName().length() == 0) {
                    aServletFilterDesc.setClassName(servletFilter.getClassName());
                }
                if (aServletFilterDesc.isAsyncSupported() == null) {
                    aServletFilterDesc.setAsyncSupported(servletFilter.isAsyncSupported());
                }
            }
            String className = aServletFilterDesc.getClassName();
            if (servletFilterDesc.isConflict() && (className == null || className.length() == 0)) {
                throw new IllegalArgumentException(localStrings.getLocalString("web.deployment.exceptionconflictfilterwithoutimpl", "Two or more web fragments define the same Filter with conflicting implementation class names that are not overridden by the web.xml"));
            }
        } else {
            if (servletFilterDesc.isConflict()) {
                throw new IllegalArgumentException(localStrings.getLocalString("web.deployment.exceptionconflictfilter", "One or more web fragments define the same Filter in a conflicting way, and the Filter is not defined in web.xml"));
            } else {
                getServletFilters().add(servletFilterDesc);
            }
        }
    }
}
Also used : ServletFilter(com.sun.enterprise.deployment.web.ServletFilter)

Example 2 with ServletFilter

use of com.sun.enterprise.deployment.web.ServletFilter in project Payara by payara.

the class WebBundleDescriptorImpl method addServletFilter.

/**
 * Adds a servlet filter to this web component.
 * @param ref
 */
@Override
public void addServletFilter(ServletFilter ref) {
    String name = ref.getName();
    boolean found = false;
    for (ServletFilter servletFilter : getServletFilters()) {
        if (name.equals(servletFilter.getName())) {
            found = true;
            break;
        }
    }
    if (!found) {
        getServletFilters().addElement(ref);
    }
}
Also used : ServletFilter(com.sun.enterprise.deployment.web.ServletFilter)

Example 3 with ServletFilter

use of com.sun.enterprise.deployment.web.ServletFilter in project Payara by payara.

the class WebFragmentDescriptor method combineServletFilters.

@Override
protected void combineServletFilters(WebBundleDescriptor webBundleDescriptor) {
    for (ServletFilter servletFilter : webBundleDescriptor.getServletFilters()) {
        ServletFilterDescriptor servletFilterDesc = (ServletFilterDescriptor) servletFilter;
        String name = servletFilter.getName();
        ServletFilterDescriptor aServletFilterDesc = null;
        for (ServletFilter sf : getServletFilters()) {
            if (name.equals(sf.getName())) {
                aServletFilterDesc = (ServletFilterDescriptor) sf;
                break;
            }
        }
        if (aServletFilterDesc != null) {
            if (aServletFilterDesc.isConflict(servletFilterDesc)) {
                aServletFilterDesc.setConflict(true);
            }
        } else {
            getServletFilters().add(servletFilterDesc);
        }
    }
}
Also used : ServletFilter(com.sun.enterprise.deployment.web.ServletFilter)

Example 4 with ServletFilter

use of com.sun.enterprise.deployment.web.ServletFilter in project Payara by payara.

the class WebBundleTracerVisitor method accept.

public void accept(BundleDescriptor descriptor) {
    if (descriptor instanceof WebBundleDescriptor) {
        WebBundleDescriptor webBundle = (WebBundleDescriptor) descriptor;
        accept(webBundle);
        for (Iterator<WebComponentDescriptor> i = webBundle.getWebComponentDescriptors().iterator(); i.hasNext(); ) {
            WebComponentDescriptor aWebComp = i.next();
            accept(aWebComp);
        }
        for (Iterator<WebService> itr = webBundle.getWebServices().getWebServices().iterator(); itr.hasNext(); ) {
            WebService aWebService = itr.next();
            accept(aWebService);
        }
        super.accept(descriptor);
        for (Iterator<ServletFilter> itr = webBundle.getServletFilterDescriptors().iterator(); itr.hasNext(); ) {
            ServletFilter servletFilterDescriptor = itr.next();
            accept(servletFilterDescriptor);
        }
    }
}
Also used : ServletFilter(com.sun.enterprise.deployment.web.ServletFilter)

Example 5 with ServletFilter

use of com.sun.enterprise.deployment.web.ServletFilter in project Payara by payara.

the class WebBundleValidator method accept.

public void accept(BundleDescriptor descriptor) {
    if (descriptor instanceof WebBundleDescriptor) {
        WebBundleDescriptor webBundle = (WebBundleDescriptor) descriptor;
        accept(webBundle);
        // inject field.
        for (InjectionCapable injectable : webBundle.getInjectableResources(webBundle)) {
            accept(injectable);
        }
        for (Iterator<WebComponentDescriptor> i = webBundle.getWebComponentDescriptors().iterator(); i.hasNext(); ) {
            WebComponentDescriptor aWebComp = i.next();
            accept(aWebComp);
        }
        for (Iterator<WebService> itr = webBundle.getWebServices().getWebServices().iterator(); itr.hasNext(); ) {
            WebService aWebService = itr.next();
            accept(aWebService);
        }
        super.accept(descriptor);
        for (Iterator<ServletFilter> itr = webBundle.getServletFilterDescriptors().iterator(); itr.hasNext(); ) {
            ServletFilterDescriptor servletFilterDescriptor = (ServletFilterDescriptor) itr.next();
            accept(servletFilterDescriptor);
        }
    }
}
Also used : ServletFilter(com.sun.enterprise.deployment.web.ServletFilter) ServletFilterDescriptor(org.glassfish.web.deployment.descriptor.ServletFilterDescriptor)

Aggregations

ServletFilter (com.sun.enterprise.deployment.web.ServletFilter)7 ServletFilterDescriptor (org.glassfish.web.deployment.descriptor.ServletFilterDescriptor)2 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)1 AppListenerDescriptor (com.sun.enterprise.deployment.web.AppListenerDescriptor)1 ServletFilterMapping (com.sun.enterprise.deployment.web.ServletFilterMapping)1 Iterator (java.util.Iterator)1 Vector (java.util.Vector)1 DispatcherType (javax.servlet.DispatcherType)1 WebFilter (javax.servlet.annotation.WebFilter)1 WebInitParam (javax.servlet.annotation.WebInitParam)1 ServletFilterMappingDescriptor (org.glassfish.web.deployment.descriptor.ServletFilterMappingDescriptor)1