Package net.sf.regain

Examples of net.sf.regain.RegainException


      mIncludeRegex = new RE("<%@include\\s*file=\"([^\"]*)\"\\s*%>");
      mJspCodeRegex = new RE("<%([^%]*)%>");
      mJspTagRegex = new RE("<([\\w/]*):(\\w*)(([^>\"]*\"[^\"]*\")*\\w*/?)>");
      mParamRegex = new RE("(\\w+)\\s*=\\s*\"([^\"]*)\"");
    } catch (RESyntaxException exc) {
      throw new RegainException("Creating the ExecuterParser regexes failed", exc);
    }
  }
View Full Code Here


    // Parse the content
    Executer executer = new TextExecuter("");
    int pos = parse(executer, jspCode, startPos);
    if (pos < jspCode.length()) {
      throw new RegainException("Last taglib tag is not closed! (offset: " + pos + ")");
    }
   
    return executer;
  }
View Full Code Here

  private String prepareJspCode(File baseDir, String filename)
    throws RegainException
  {
    File file = new File(baseDir, filename);
    if (! file.exists()) {
      throw new RegainException("JSP file does not exist: " + file.getAbsolutePath());
    }
    String jspCode = RegainToolkit.readStringFromFile(file);
   
    // Add all inludes
    // NOTE: For performance reasons we create only a StringBuffer if a match is
View Full Code Here

          // System.out.println("End tag " + namespace + ":" + tagName);
         
          // The current tag is finished -> Check namespace and tag name
          namespace = namespace.substring(1); // Remove the leading /
          if (! namespace.equals(startNamespace) || ! tagName.equals(startTagName)) {
            throw new RegainException("End tag " + namespace + ":" + tagName
                + " does not match to start tag " + startNamespace + ":" + startTagName);
          }

          startNamespace = null;
          startTagName = null;
View Full Code Here

    String params)
    throws RegainException
  {
    String packageName = (String) mNamespaceHash.get(namespace);
    if (packageName == null) {
      throw new RegainException("Unknown tag namespace: '" + namespace + "'");
    }
   
    String className = packageName;
   
    // Add the sub packages (E.g. stats_size)
    int linePos;
    String cutTagName = tagName;
    while ((linePos = cutTagName.indexOf('_')) != -1) {
      className += "." + cutTagName.substring(0, linePos);
      cutTagName = cutTagName.substring(linePos + 1);
    }
   
    // Add the className
    className += "." + Character.toUpperCase(cutTagName.charAt(0))
      + cutTagName.substring(1) + "Tag";
   
    // Get the tag class
    Class tagClass;
    try {
      tagClass = Class.forName(className);
    }
    catch (ClassNotFoundException exc) {
      throw new RegainException("Class for tag " + namespace + ":" + tagName
          + " not found: " + className, exc);
    }

    // Create the tag instance
    SharedTag tag;
    try {
      tag = (SharedTag) tagClass.newInstance();
    }
    catch (Exception exc) {
      throw new RegainException("Creating tag instance for tag " + namespace
          + ":" + tagName + " could not be created: " + className, exc);
    }
   
    // Set the params
    int pos = 0;
View Full Code Here

  public OutputStream getOutputStream() throws RegainException {
    try {
      return mResponse.getOutputStream();
    }
    catch (IOException exc) {
      throw new RegainException("Getting the response OutputStream failed", exc);
    }
  }
View Full Code Here

    if (mPrintStream == null) {
      try {
        mPrintStream = mResponse.getPrintStream();
      }
      catch (IOException exc) {
        throw new RegainException("Getting response PrintStream failed", exc);
      }
    }
   
    mPrintStream.print(text);
  }
View Full Code Here

  public String getParameter(String name, boolean mandatory)
    throws RegainException
  {
    String asString = getParameter(name);
    if (mandatory && (asString == null)) {
      throw new RegainException("Parameter " + name + " of tag "
          + getTagName() + " was not specified");
    } else {
      return asString;
    }
  }
View Full Code Here

    } else {
      try {
        return Integer.parseInt(asString);
      }
      catch (NumberFormatException exc) {
        throw new RegainException("Parameter " + name + " of tag "
            + getTagName() + " must be a number: '" + asString + "'");
      }
    }
  }
View Full Code Here

      if (asString.equalsIgnoreCase("true")) {
        return true;
      } else if (asString.equalsIgnoreCase("false")) {
        return false;
      } else {
        throw new RegainException("Parameter " + name + " of tag "
            + getTagName() + " must be a boolean: '" + asString + "'");
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.regain.RegainException

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.