Search in sources :

Example 71 with JasperException

use of org.apache.jasper.JasperException in project tomcat by apache.

the class JspCServletContext method scanForResourceJARs.

private List<URL> scanForResourceJARs(Set<WebXml> orderedFragments, Collection<WebXml> fragments) throws JasperException {
    List<URL> resourceJars = new ArrayList<>();
    // Build list of potential resource JARs. Use same ordering as ContextConfig
    Set<WebXml> resourceFragments = new LinkedHashSet<>(orderedFragments);
    for (WebXml fragment : fragments) {
        if (!resourceFragments.contains(fragment)) {
            resourceFragments.add(fragment);
        }
    }
    for (WebXml resourceFragment : resourceFragments) {
        try (Jar jar = JarFactory.newInstance(resourceFragment.getURL())) {
            if (jar.exists("META-INF/resources/")) {
                // This is a resource JAR
                resourceJars.add(resourceFragment.getURL());
            }
        } catch (IOException ioe) {
            throw new JasperException(ioe);
        }
    }
    return resourceJars;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) WebXml(org.apache.tomcat.util.descriptor.web.WebXml) JasperException(org.apache.jasper.JasperException) ArrayList(java.util.ArrayList) Jar(org.apache.tomcat.Jar) IOException(java.io.IOException) URL(java.net.URL)

Example 72 with JasperException

use of org.apache.jasper.JasperException in project tomcat by apache.

the class JspRuntimeLibrary method handleSetProperty.

public static void handleSetProperty(Object bean, String prop, short value) throws JasperException {
    try {
        Method method = getWriteMethod(bean.getClass(), prop);
        method.invoke(bean, new Object[] { Short.valueOf(value) });
    } catch (Exception ex) {
        Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
        ExceptionUtils.handleThrowable(thr);
        throw new JasperException(ex);
    }
}
Also used : JasperException(org.apache.jasper.JasperException) Method(java.lang.reflect.Method) IOException(java.io.IOException) ServletException(jakarta.servlet.ServletException) JspException(jakarta.servlet.jsp.JspException) JasperException(org.apache.jasper.JasperException)

Example 73 with JasperException

use of org.apache.jasper.JasperException in project tomcat by apache.

the class JspRuntimeLibrary method handleSetProperty.

public static void handleSetProperty(Object bean, String prop, byte value) throws JasperException {
    try {
        Method method = getWriteMethod(bean.getClass(), prop);
        method.invoke(bean, new Object[] { Byte.valueOf(value) });
    } catch (Exception ex) {
        Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
        ExceptionUtils.handleThrowable(thr);
        throw new JasperException(ex);
    }
}
Also used : JasperException(org.apache.jasper.JasperException) Method(java.lang.reflect.Method) IOException(java.io.IOException) ServletException(jakarta.servlet.ServletException) JspException(jakarta.servlet.jsp.JspException) JasperException(org.apache.jasper.JasperException)

Example 74 with JasperException

use of org.apache.jasper.JasperException in project tomcat by apache.

the class JspRuntimeLibrary method handleSetProperty.

public static void handleSetProperty(Object bean, String prop, double value) throws JasperException {
    try {
        Method method = getWriteMethod(bean.getClass(), prop);
        method.invoke(bean, new Object[] { Double.valueOf(value) });
    } catch (Exception ex) {
        Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
        ExceptionUtils.handleThrowable(thr);
        throw new JasperException(ex);
    }
}
Also used : JasperException(org.apache.jasper.JasperException) Method(java.lang.reflect.Method) IOException(java.io.IOException) ServletException(jakarta.servlet.ServletException) JspException(jakarta.servlet.jsp.JspException) JasperException(org.apache.jasper.JasperException)

Example 75 with JasperException

use of org.apache.jasper.JasperException in project tomcat by apache.

the class JspRuntimeLibrary method handleSetProperty.

public static void handleSetProperty(Object bean, String prop, char value) throws JasperException {
    try {
        Method method = getWriteMethod(bean.getClass(), prop);
        method.invoke(bean, new Object[] { Character.valueOf(value) });
    } catch (Exception ex) {
        Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
        ExceptionUtils.handleThrowable(thr);
        throw new JasperException(ex);
    }
}
Also used : JasperException(org.apache.jasper.JasperException) Method(java.lang.reflect.Method) IOException(java.io.IOException) ServletException(jakarta.servlet.ServletException) JspException(jakarta.servlet.jsp.JspException) JasperException(org.apache.jasper.JasperException)

Aggregations

JasperException (org.apache.jasper.JasperException)80 IOException (java.io.IOException)61 Method (java.lang.reflect.Method)28 ServletException (javax.servlet.ServletException)21 FileNotFoundException (java.io.FileNotFoundException)19 ServletException (jakarta.servlet.ServletException)18 JspException (javax.servlet.jsp.JspException)18 JspException (jakarta.servlet.jsp.JspException)15 File (java.io.File)8 SAXException (org.xml.sax.SAXException)7 HashMap (java.util.HashMap)6 FileOutputStream (java.io.FileOutputStream)5 InputStream (java.io.InputStream)5 InputStreamReader (java.io.InputStreamReader)4 URL (java.net.URL)4 ArrayList (java.util.ArrayList)4 TreeNode (org.apache.jasper.xmlparser.TreeNode)4 TagInfo (jakarta.servlet.jsp.tagext.TagInfo)3 BufferedOutputStream (java.io.BufferedOutputStream)3 BufferedReader (java.io.BufferedReader)3