Package org.apache.jasper

Examples of org.apache.jasper.JasperException


                                new ImplicitTldRuleSet(), blockExternal);
                        taglibXml = parser.parse(resourcePath);
                    } catch (IOException | SAXException e) {
                        err.jspError(e);
                        // unreached
                        throw new JasperException(e);
                    }
                    this.tlibversion = taglibXml.getTlibVersion();
                    this.jspversion = taglibXml.getJspVersion();
                    try {
                        double version = Double.parseDouble(this.jspversion);
View Full Code Here


                    // Re-parse TLD
                    TaglibXml updatedTaglibXml;
                    try {
                        updatedTaglibXml = tldParser.parse(tldResourcePath);
                    } catch (IOException | SAXException e) {
                        throw new JasperException(e);
                    }
                    cacheEntry.setTaglibXml(updatedTaglibXml);
                    cacheEntry.setWebAppPathLastModified(lastModified[0]);
                    cacheEntry.setEntryLastModified(lastModified[1]);
                }
View Full Code Here

            DocumentBuilder builder = factory.newDocumentBuilder();
            builder.setEntityResolver(entityResolver);
            builder.setErrorHandler(errorHandler);
            document = builder.parse(is);
  } catch (ParserConfigurationException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), ex);
  } catch (SAXParseException ex) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml.line",
              uri,
              Integer.toString(ex.getLineNumber()),
              Integer.toString(ex.getColumnNumber())),
     ex);
  } catch (SAXException sx) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), sx);
        } catch (IOException io) {
            throw new JasperException
                (Localizer.getMessage("jsp.error.parse.xml", uri), io);
  }

        // Convert the resulting document to a graph of TreeNodes
        return (convert(null, document.getDocumentElement()));
View Full Code Here

        if (!uri.endsWith("jar")) {
      in = getResourceAsStream(uri);
     
      if (in == null)
    throw new JasperException(Constants.getString("jsp.error.tld_not_found",
                    new Object[] {TLD}));
      // Now parse the tld.
      parseTLD(in);
  }
     
  // FIXME Take this stuff out when taglib changes are thoroughly tested.
        // 2000.11.15 commented out the 'copy to work dir' section,
        // which I believe is what this FIXME comment referred to. (pierred)
  if (uri.endsWith("jar")) {
     
      if (!isRelativeURI(uri)) {
    url = new URL(uri);
    in = url.openStream();
      } else {
    relativeURL = true;
    in = getResourceAsStream(uri);
      }
     
      zin = new ZipInputStream(in);
      this.jarEntries = new Hashtable();
      this.ctxt = ctxt;
     
            /* NOT COMPILED
      // First copy this file into our work directory!
      {
    File jspFile = new File(ctxt.getJspFile());
                String parent = jspFile.getParent();
                String jarFileName = ctxt.getOutputDir();
                if (parent != null) {
                   jarFileName = jarFileName + File.separatorChar +
                       parent;
                }
                File jspDir = new File(jarFileName);
    jspDir.mkdirs();
     
    if (relativeURL)
        jarFileName = jarFileName+File.separatorChar+new File(uri).getName();
    else                   
        jarFileName = jarFileName+File.separatorChar+
      new File(url.getFile()).getName();
     
    Constants.message("jsp.message.copyinguri",
                            new Object[] { uri, jarFileName },
          Logger.DEBUG);
     
    if (relativeURL)
        copy(getResourceAsStream(uri),
       jarFileName);
    else
        copy(url.openStream(), jarFileName);
     
          ctxt.addJar(jarFileName);
      }
            */ // END NOT COMPILED
      boolean tldFound = false;
      ZipEntry entry;
      while ((entry = zin.getNextEntry()) != null) {
    if (entry.getName().equals(TLD)) {
        /*******
         * This hack is necessary because XML reads until the end
         * of an inputstream -- does not use available()
         * -- and closes the inputstream when it can't
         * read no more.
         */
       
        // BEGIN HACK
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int b;
        while (zin.available() != 0) {
      b = zin.read();
      if (b == -1)
          break;
      baos.write(b);
        }

        baos.close();
        ByteArrayInputStream bais
      = new ByteArrayInputStream(baos.toByteArray());
        // END HACK
        tldFound = true;
        parseTLD(bais);
    } else {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int b;
        while (zin.available() != 0) {
      b = zin.read();
      if (b == -1)
          break;
      baos.write(b);
        }
        baos.close();
        jarEntries.put(entry.getName(), baos.toByteArray());
    }
    zin.closeEntry();
      }
     
      if (!tldFound)
    throw new JasperException(Constants.getString("jsp.error.tld_not_found",
                    new Object[] {
        TLD
      }
                    ));
  } // Take this out (END of if(endsWith("jar")))
View Full Code Here

 
        Vector tagVector = new Vector();
        NodeList list = tld.getElementsByTagName("taglib");

        if (list.getLength() != 1)
            throw new JasperException(Constants.getString("jsp.error.more.than.one.taglib"));

        Element elem = (Element) list.item(0);
        list = elem.getChildNodes();

        for(int i = 0; i < list.getLength(); i++) {
View Full Code Here

            javaFile.delete();
        }
   
        if (status == false) {
            String msg = out.toString ();
            throw new JasperException(Constants.getString("jsp.error.unable.compile")
                                      + msg);
        }

        String classFile = ctxt.getOutputDir() + File.separatorChar;
        if (pkgName != null && !pkgName.equals(""))
            classFile = classFile + pkgName.replace('.', File.separatorChar) +
                File.separatorChar;
        classFile = classFile + className + ".class";

        if (!classFile.equals(classFileName)) {
            File classFileObject = new File(classFile);
            File myClassFileObject = new File(classFileName);
            if (myClassFileObject.exists())
                myClassFileObject.delete();
            if (classFileObject.renameTo(myClassFileObject) == false)
                throw new JasperException(Constants.getString("jsp.error.unable.rename",
                                                              new Object[] {
                                                                  classFileObject,
                                                                  myClassFileObject
                                                              }));
        }
View Full Code Here

                vector.copyInto(tempCharArray);
                o.writeObject(tempCharArray);
                o.close();
                writer.close();
            } catch (IOException ex) {
                throw new JasperException(Constants.getString(
                                                              "jsp.error.data.file.write"), ex);
            }
        ctxt.setContentType(servletContentType);
    }
View Full Code Here

                        if (annotationProcessor != null) {
                           annotationProcessor.processAnnotations(servlet);
                           annotationProcessor.postConstruct(servlet);
                        }
                    } catch (IllegalAccessException e) {
                        throw new JasperException(e);
                    } catch (InstantiationException e) {
                        throw new JasperException(e);
                    } catch (Exception e) {
                        throw new JasperException(e);
                    }
                   
                    servlet.init(config);

                    if (!firstTime) {
View Full Code Here

            if (reload) {
                tagHandlerClass = ctxt.load();
                reload = false;
            }
        } catch (FileNotFoundException ex) {
            throw new JasperException(ex);
  }

  return tagHandlerClass;
    }
View Full Code Here

            }
        } catch (Exception ex) {
            if (options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw new JasperException(ex);
            }
        }

        try {
           
            /*
             * (3) Service request
             */
            if (servlet instanceof SingleThreadModel) {
               // sync on the wrapper so that the freshness
               // of the page is determined right before servicing
               synchronized (this) {
                   servlet.service(request, response);
                }
            } else {
                servlet.service(request, response);
            }

        } catch (UnavailableException ex) {
            String includeRequestUri = (String)
                request.getAttribute("javax.servlet.include.request_uri");
            if (includeRequestUri != null) {
                // This file was included. Throw an exception as
                // a response.sendError() will be ignored by the
                // servlet engine.
                throw ex;
            } else {
                int unavailableSeconds = ex.getUnavailableSeconds();
                if (unavailableSeconds <= 0) {
                    unavailableSeconds = 60;        // Arbitrary default
                }
                available = System.currentTimeMillis() +
                    (unavailableSeconds * 1000L);
                response.sendError
                    (HttpServletResponse.SC_SERVICE_UNAVAILABLE,
                     ex.getMessage());
            }
        } catch (ServletException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (IOException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (IllegalStateException ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw ex;
            }
        } catch (Exception ex) {
            if(options.getDevelopment()) {
                throw handleJspException(ex);
            } else {
                throw new JasperException(ex);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jasper.JasperException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.