Class JspReader

java.lang.Object
org.apache.jasper.compiler.JspReader

class JspReader extends Object
JspReader is an input buffer for the JSP parser. It should allow unlimited lookahead and pushback. It also has a bunch of parsing utility methods for understanding htmlesque thingies.
  • Field Details

  • Constructor Details

  • Method Details

    • getJspCompilationContext

      JspCompilationContext getJspCompilationContext()
    • getFile

      String getFile(int fileid)
    • hasMoreInput

      boolean hasMoreInput() throws JasperException
      Throws:
      JasperException
    • nextChar

      int nextChar() throws JasperException
      Throws:
      JasperException
    • pushChar

      void pushChar()
      Back up the current cursor by one char, assumes current.cursor > 0, and that the char to be pushed back is not '\n'.
    • getText

      String getText(Mark start, Mark stop) throws JasperException
      Throws:
      JasperException
    • peekChar

      int peekChar() throws JasperException
      Throws:
      JasperException
    • mark

      Mark mark()
    • reset

      void reset(Mark mark)
    • matchesIgnoreCase

      boolean matchesIgnoreCase(String string) throws JasperException
      Throws:
      JasperException
    • matches

      boolean matches(String string) throws JasperException
      search the stream for a match to a string
      Parameters:
      string - The string to match
      Returns:
      true is one is found, the current position in stream is positioned after the search string, false otherwise, position in stream unchanged.
      Throws:
      JasperException
    • matchesETag

      boolean matchesETag(String tagName) throws JasperException
      Throws:
      JasperException
    • matchesETagWithoutLessThan

      boolean matchesETagWithoutLessThan(String tagName) throws JasperException
      Throws:
      JasperException
    • matchesOptionalSpacesFollowedBy

      boolean matchesOptionalSpacesFollowedBy(String s) throws JasperException
      Looks ahead to see if there are optional spaces followed by the given String. If so, true is returned and those spaces and characters are skipped. If not, false is returned and the position is restored to where we were before.
      Throws:
      JasperException
    • skipSpaces

      int skipSpaces() throws JasperException
      Throws:
      JasperException
    • skipUntil

      Mark skipUntil(String limit) throws JasperException
      Skip until the given string is matched in the stream. When returned, the context is positioned past the end of the match.
      Parameters:
      s - The String to match.
      Returns:
      A non-null Mark instance (positioned immediately before the search string) if found, null otherwise.
      Throws:
      JasperException
    • skipUntilIgnoreEsc

      Mark skipUntilIgnoreEsc(String limit) throws JasperException
      Skip until the given string is matched in the stream, but ignoring chars initially escaped by a '\'. When returned, the context is positioned past the end of the match.
      Parameters:
      s - The String to match.
      Returns:
      A non-null Mark instance (positioned immediately before the search string) if found, null otherwise.
      Throws:
      JasperException
    • skipUntilETag

      Mark skipUntilETag(String tag) throws JasperException
      Skip until the given end tag is matched in the stream. When returned, the context is positioned past the end of the tag.
      Parameters:
      tag - The name of the tag whose ETag () to match.
      Returns:
      A non-null Mark instance (positioned immediately before the ETag) if found, null otherwise.
      Throws:
      JasperException
    • isSpace

      final boolean isSpace() throws JasperException
      Throws:
      JasperException
    • parseToken

      String parseToken(boolean quoted) throws JasperException
      Parse a space delimited token. If quoted the token will consume all characters up to a matching quote, otherwise, it consumes up to the first delimiter character.
      Parameters:
      quoted - If true accept quoted strings.
      Throws:
      JasperException
    • setSingleFile

      void setSingleFile(boolean val)
    • getResource

      URL getResource(String path) throws MalformedURLException
      Gets the URL for the given path name.
      Parameters:
      path - Path name
      Returns:
      URL for the given path name.
      Throws:
      MalformedURLException - if the path name is not given in the correct form
    • isDelimiter

      private boolean isDelimiter() throws JasperException
      Parse utils - Is current character a token delimiter ? Delimiters are currently defined to be =, >, <, ", and ' or any any space character as defined by isSpace.
      Returns:
      A boolean.
      Throws:
      JasperException
    • registerSourceFile

      private int registerSourceFile(String file)
      Register a new source file. This method is used to implement file inclusion. Each included file gets a unique identifier (which is the index in the array of source files).
      Returns:
      The index of the now registered file.
    • unregisterSourceFile

      private int unregisterSourceFile(String file)
      Unregister the source file. This method is used to implement file inclusion. Each included file gets a uniq identifier (which is the index in the array of source files).
      Returns:
      The index of the now registered file.
    • pushFile

      private void pushFile(String file, String encoding, InputStreamReader reader) throws JasperException, FileNotFoundException
      Push a file (and its associated Stream) on the file stack. THe current position in the current file is remembered.
      Throws:
      JasperException
      FileNotFoundException
    • popFile

      private boolean popFile() throws JasperException
      Pop a file from the file stack. The field "current" is retored to the value to point to the previous files, if any, and is set to null otherwise.
      Returns:
      true is there is a previous file on the stck. false otherwise.
      Throws:
      JasperException