All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastchar.servlet.FastServletRegistration Maven / Gradle / Ivy

There is a newer version: 2.2.2
Show newest version
package com.fastchar.servlet;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

public class FastServletRegistration {

    private final Object target;

    public FastServletRegistration(Object target) {
        this.target = target;
    }

    public Object getTarget() {
        return target;
    }

    public Set addMapping(String... urlPatterns) {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).addMapping(urlPatterns);
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).addMapping(urlPatterns);
        }
        return null;
    }

    public Collection getMappings() {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getMappings();
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getMappings();
        }
        return null;
    }

    public String getRunAsRole() {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getRunAsRole();
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getRunAsRole();
        }
        return null;
    }

    public String getName() {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getName();
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getName();
        }
        return null;
    }

    public String getClassName() {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getClassName();
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getClassName();
        }
        return null;
    }

    public boolean setInitParameter(String name, String value) {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).setInitParameter(name, value);
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).setInitParameter(name, value);
        }
        return false;
    }

    public String getInitParameter(String name) {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getInitParameter(name);
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getInitParameter(name);
        }
        return null;
    }

    public Set setInitParameters(Map initParameters) {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).setInitParameters(initParameters);
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).setInitParameters(initParameters);
        }
        return null;
    }

    public Map getInitParameters() {
        if (FastServletHelper.isJavaxServlet()) {
            return ((javax.servlet.ServletRegistration) target).getInitParameters();
        }
        if (FastServletHelper.isJakartaServlet()) {
            return ((jakarta.servlet.ServletRegistration) target).getInitParameters();
        }
        return null;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy