wms-jakarta-taglibs-standard-1.1.2

16:54:06.421 INFO  jd.cli.Main - Decompiling wms-jakarta-taglibs-standard-1.1.2.jar
package javax.servlet.jsp.jstl.core;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

public abstract class ConditionalTagSupport
  extends TagSupport
{
  private boolean result;
  private String var;
  private int scope;
  
  protected abstract boolean condition()
    throws JspTagException;
  
  public ConditionalTagSupport()
  {
    init();
  }
  
  public int doStartTag()
    throws JspException
  {
    result = condition();
    
    exposeVariables();
    if (result) {
      return 1;
    }
    return 0;
  }
  
  public void release()
  {
    super.release();
    init();
  }
  
  public void setVar(String var)
  {
    this.var = var;
  }
  
  public void setScope(String scope)
  {
    if (scope.equalsIgnoreCase("page")) {
      this.scope = 1;
    } else if (scope.equalsIgnoreCase("request")) {
      this.scope = 2;
    } else if (scope.equalsIgnoreCase("session")) {
      this.scope = 3;
    } else if (scope.equalsIgnoreCase("application")) {
      this.scope = 4;
    }
  }
  
  private void exposeVariables()
  {
    if (var != null) {
      pageContext.setAttribute(var, new Boolean(result), scope);
    }
  }
  
  private void init()
  {
    result = false;
    var = null;
    scope = 1;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.ConditionalTagSupport
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.core;

import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;

public class Config
{
  public static final String FMT_LOCALE = "javax.servlet.jsp.jstl.fmt.locale";
  public static final String FMT_FALLBACK_LOCALE = "javax.servlet.jsp.jstl.fmt.fallbackLocale";
  public static final String FMT_LOCALIZATION_CONTEXT = "javax.servlet.jsp.jstl.fmt.localizationContext";
  public static final String FMT_TIME_ZONE = "javax.servlet.jsp.jstl.fmt.timeZone";
  public static final String SQL_DATA_SOURCE = "javax.servlet.jsp.jstl.sql.dataSource";
  public static final String SQL_MAX_ROWS = "javax.servlet.jsp.jstl.sql.maxRows";
  private static final String PAGE_SCOPE_SUFFIX = ".page";
  private static final String REQUEST_SCOPE_SUFFIX = ".request";
  private static final String SESSION_SCOPE_SUFFIX = ".session";
  private static final String APPLICATION_SCOPE_SUFFIX = ".application";
  
  public static Object get(PageContext pc, String name, int scope)
  {
    switch (scope)
    {
    case 1: 
      return pc.getAttribute(name + ".page", scope);
    case 2: 
      return pc.getAttribute(name + ".request", scope);
    case 3: 
      return get(pc.getSession(), name);
    case 4: 
      return pc.getAttribute(name + ".application", scope);
    }
    throw new IllegalArgumentException("unknown scope");
  }
  
  public static Object get(ServletRequest request, String name)
  {
    return request.getAttribute(name + ".request");
  }
  
  public static Object get(HttpSession session, String name)
  {
    Object ret = null;
    if (session != null) {
      try
      {
        ret = session.getAttribute(name + ".session");
      }
      catch (IllegalStateException ex) {}
    }
    return ret;
  }
  
  public static Object get(ServletContext context, String name)
  {
    return context.getAttribute(name + ".application");
  }
  
  public static void set(PageContext pc, String name, Object value, int scope)
  {
    switch (scope)
    {
    case 1: 
      pc.setAttribute(name + ".page", value, scope);
      break;
    case 2: 
      pc.setAttribute(name + ".request", value, scope);
      break;
    case 3: 
      pc.setAttribute(name + ".session", value, scope);
      break;
    case 4: 
      pc.setAttribute(name + ".application", value, scope);
      break;
    default: 
      throw new IllegalArgumentException("unknown scope");
    }
  }
  
  public static void set(ServletRequest request, String name, Object value)
  {
    request.setAttribute(name + ".request", value);
  }
  
  public static void set(HttpSession session, String name, Object value)
  {
    session.setAttribute(name + ".session", value);
  }
  
  public static void set(ServletContext context, String name, Object value)
  {
    context.setAttribute(name + ".application", value);
  }
  
  public static void remove(PageContext pc, String name, int scope)
  {
    switch (scope)
    {
    case 1: 
      pc.removeAttribute(name + ".page", scope);
      break;
    case 2: 
      pc.removeAttribute(name + ".request", scope);
      break;
    case 3: 
      pc.removeAttribute(name + ".session", scope);
      break;
    case 4: 
      pc.removeAttribute(name + ".application", scope);
      break;
    default: 
      throw new IllegalArgumentException("unknown scope");
    }
  }
  
  public static void remove(ServletRequest request, String name)
  {
    request.removeAttribute(name + ".request");
  }
  
  public static void remove(HttpSession session, String name)
  {
    session.removeAttribute(name + ".session");
  }
  
  public static void remove(ServletContext context, String name)
  {
    context.removeAttribute(name + ".application");
  }
  
  public static Object find(PageContext pc, String name)
  {
    Object ret = get(pc, name, 1);
    if (ret == null)
    {
      ret = get(pc, name, 2);
      if (ret == null)
      {
        if (pc.getSession() != null) {
          ret = get(pc, name, 3);
        }
        if (ret == null)
        {
          ret = get(pc, name, 4);
          if (ret == null) {
            ret = pc.getServletContext().getInitParameter(name);
          }
        }
      }
    }
    return ret;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.Config
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.core;

import javax.servlet.jsp.tagext.Tag;

public abstract interface LoopTag
  extends Tag
{
  public abstract Object getCurrent();
  
  public abstract LoopTagStatus getLoopStatus();
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.LoopTag
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.core;

public abstract interface LoopTagStatus
{
  public abstract Object getCurrent();
  
  public abstract int getIndex();
  
  public abstract int getCount();
  
  public abstract boolean isFirst();
  
  public abstract boolean isLast();
  
  public abstract Integer getBegin();
  
  public abstract Integer getEnd();
  
  public abstract Integer getStep();
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.LoopTagStatus
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.core;

class LoopTagSupport$1Status
  implements LoopTagStatus
{
  private final LoopTagSupport this$0;
  
  LoopTagSupport$1Status(LoopTagSupport this$0)
  {
    this.this$0 = this$0;
  }
  
  public Object getCurrent()
  {
    return this$0.getCurrent();
  }
  
  public int getIndex()
  {
    return LoopTagSupport.access$000(this$0) + this$0.begin;
  }
  
  public int getCount()
  {
    return LoopTagSupport.access$100(this$0);
  }
  
  public boolean isFirst()
  {
    return LoopTagSupport.access$000(this$0) == 0;
  }
  
  public boolean isLast()
  {
    return LoopTagSupport.access$200(this$0);
  }
  
  public Integer getBegin()
  {
    if (this$0.beginSpecified) {
      return new Integer(this$0.begin);
    }
    return null;
  }
  
  public Integer getEnd()
  {
    if (this$0.endSpecified) {
      return new Integer(this$0.end);
    }
    return null;
  }
  
  public Integer getStep()
  {
    if (this$0.stepSpecified) {
      return new Integer(this$0.step);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.LoopTagSupport.1Status
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.core;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.IterationTag;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.TryCatchFinally;

public abstract class LoopTagSupport
  extends TagSupport
  implements LoopTag, IterationTag, TryCatchFinally
{
  protected int begin;
  protected int end;
  protected int step;
  protected boolean beginSpecified;
  protected boolean endSpecified;
  protected boolean stepSpecified;
  protected String itemId;
  protected String statusId;
  private LoopTagStatus status;
  private Object item;
  private int index;
  private int count;
  private boolean last;
  
  public LoopTagSupport()
  {
    init();
  }
  
  protected abstract Object next()
    throws JspTagException;
  
  protected abstract boolean hasNext()
    throws JspTagException;
  
  protected abstract void prepare()
    throws JspTagException;
  
  public void release()
  {
    super.release();
    init();
  }
  
  public int doStartTag()
    throws JspException
  {
    if ((end != -1) && (begin > end)) {
      return 0;
    }
    index = 0;
    count = 1;
    last = false;
    
    prepare();
    
    discardIgnoreSubset(begin);
    if (hasNext()) {
      item = next();
    } else {
      return 0;
    }
    discard(step - 1);
    
    exposeVariables();
    calibrateLast();
    return 1;
  }
  
  public int doAfterBody()
    throws JspException
  {
    index += step - 1;
    
    count += 1;
    if ((hasNext()) && (!atEnd()))
    {
      index += 1;
      item = next();
    }
    else
    {
      return 0;
    }
    discard(step - 1);
    
    exposeVariables();
    calibrateLast();
    return 2;
  }
  
  public void doFinally()
  {
    unExposeVariables();
  }
  
  public void doCatch(Throwable t)
    throws Throwable
  {
    throw t;
  }
  
  public Object getCurrent()
  {
    return item;
  }
  
  public LoopTagStatus getLoopStatus()
  {
    if (status == null) {
      status = new LoopTagStatus()
      {
        public Object getCurrent()
        {
          return LoopTagSupport.this.getCurrent();
        }
        
        public int getIndex()
        {
          return index + begin;
        }
        
        public int getCount()
        {
          return count;
        }
        
        public boolean isFirst()
        {
          return index == 0;
        }
        
        public boolean isLast()
        {
          return last;
        }
        
        public Integer getBegin()
        {
          if (beginSpecified) {
            return new Integer(begin);
          }
          return null;
        }
        
        public Integer getEnd()
        {
          if (endSpecified) {
            return new Integer(end);
          }
          return null;
        }
        
        public Integer getStep()
        {
          if (stepSpecified) {
            return new Integer(step);
          }
          return null;
        }
      };
    }
    return status;
  }
  
  public void setVar(String id)
  {
    itemId = id;
  }
  
  public void setVarStatus(String statusId)
  {
    this.statusId = statusId;
  }
  
  protected void validateBegin()
    throws JspTagException
  {
    if (begin < 0) {
      throw new JspTagException("'begin' < 0");
    }
  }
  
  protected void validateEnd()
    throws JspTagException
  {
    if (end < 0) {
      throw new JspTagException("'end' < 0");
    }
  }
  
  protected void validateStep()
    throws JspTagException
  {
    if (step < 1) {
      throw new JspTagException("'step' <= 0");
    }
  }
  
  private void init()
  {
    index = 0;
    count = 1;
    status = null;
    item = null;
    last = false;
    beginSpecified = false;
    endSpecified = false;
    stepSpecified = false;
    
    begin = 0;
    end = -1;
    step = 1;
    itemId = null;
    statusId = null;
  }
  
  private void calibrateLast()
    throws JspTagException
  {
    last = ((!hasNext()) || (atEnd()) || ((end != -1) && (begin + index + step > end)));
  }
  
  private void exposeVariables()
    throws JspTagException
  {
    if (itemId != null) {
      if (getCurrent() == null) {
        pageContext.removeAttribute(itemId, 1);
      } else {
        pageContext.setAttribute(itemId, getCurrent());
      }
    }
    if (statusId != null) {
      if (getLoopStatus() == null) {
        pageContext.removeAttribute(statusId, 1);
      } else {
        pageContext.setAttribute(statusId, getLoopStatus());
      }
    }
  }
  
  private void unExposeVariables()
  {
    if (itemId != null) {
      pageContext.removeAttribute(itemId, 1);
    }
    if (statusId != null) {
      pageContext.removeAttribute(statusId, 1);
    }
  }
  
  private void discard(int n)
    throws JspTagException
  {
    int oldIndex = index;
    while ((n-- > 0) && (!atEnd()) && (hasNext()))
    {
      index += 1;
      next();
    }
    index = oldIndex;
  }
  
  private void discardIgnoreSubset(int n)
    throws JspTagException
  {
    while ((n-- > 0) && (hasNext())) {
      next();
    }
  }
  
  private boolean atEnd()
  {
    return (end != -1) && (begin + index >= end);
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.core.LoopTagSupport
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.fmt;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.servlet.jsp.PageContext;
import org.apache.taglibs.standard.tag.common.fmt.BundleSupport;

public class LocaleSupport
{
  public static String getLocalizedMessage(PageContext pageContext, String key)
  {
    return getLocalizedMessage(pageContext, key, null, null);
  }
  
  public static String getLocalizedMessage(PageContext pageContext, String key, String basename)
  {
    return getLocalizedMessage(pageContext, key, null, basename);
  }
  
  public static String getLocalizedMessage(PageContext pageContext, String key, Object[] args)
  {
    return getLocalizedMessage(pageContext, key, args, null);
  }
  
  public static String getLocalizedMessage(PageContext pageContext, String key, Object[] args, String basename)
  {
    LocalizationContext locCtxt = null;
    String message = "???" + key + "???";
    if (basename != null) {
      locCtxt = BundleSupport.getLocalizationContext(pageContext, basename);
    } else {
      locCtxt = BundleSupport.getLocalizationContext(pageContext);
    }
    if (locCtxt != null)
    {
      ResourceBundle bundle = locCtxt.getResourceBundle();
      if (bundle != null) {
        try
        {
          message = bundle.getString(key);
          if (args != null)
          {
            MessageFormat formatter = new MessageFormat("");
            if (locCtxt.getLocale() != null) {
              formatter.setLocale(locCtxt.getLocale());
            }
            formatter.applyPattern(message);
            message = formatter.format(args);
          }
        }
        catch (MissingResourceException mre) {}
      }
    }
    return message;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.fmt.LocaleSupport
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.fmt;

import java.util.Locale;
import java.util.ResourceBundle;

public class LocalizationContext
{
  private final ResourceBundle bundle;
  private final Locale locale;
  
  public LocalizationContext()
  {
    bundle = null;
    locale = null;
  }
  
  public LocalizationContext(ResourceBundle bundle, Locale locale)
  {
    this.bundle = bundle;
    this.locale = locale;
  }
  
  public LocalizationContext(ResourceBundle bundle)
  {
    this.bundle = bundle;
    locale = bundle.getLocale();
  }
  
  public ResourceBundle getResourceBundle()
  {
    return bundle;
  }
  
  public Locale getLocale()
  {
    return locale;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.fmt.LocalizationContext
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.sql;

import java.util.SortedMap;

public abstract interface Result
{
  public abstract SortedMap[] getRows();
  
  public abstract Object[][] getRowsByIndex();
  
  public abstract String[] getColumnNames();
  
  public abstract int getRowCount();
  
  public abstract boolean isLimitedByMaxRows();
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.sql.Result
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.sql;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;

class ResultImpl
  implements Result, Serializable
{
  private List rowMap;
  private List rowByIndex;
  private String[] columnNames;
  private boolean isLimited;
  
  public ResultImpl(ResultSet rs, int startRow, int maxRows)
    throws SQLException
  {
    rowMap = new ArrayList();
    rowByIndex = new ArrayList();
    
    ResultSetMetaData rsmd = rs.getMetaData();
    int noOfColumns = rsmd.getColumnCount();
    
    columnNames = new String[noOfColumns];
    for (int i = 1; i <= noOfColumns; i++) {
      columnNames[(i - 1)] = rsmd.getColumnName(i);
    }
    for (int i = 0; i < startRow; i++) {
      rs.next();
    }
    int processedRows = 0;
    while (rs.next())
    {
      if ((maxRows != -1) && (processedRows == maxRows))
      {
        isLimited = true;
        break;
      }
      Object[] columns = new Object[noOfColumns];
      SortedMap columnMap = new TreeMap(String.CASE_INSENSITIVE_ORDER);
      for (int i = 1; i <= noOfColumns; i++)
      {
        Object value = rs.getObject(i);
        if (rs.wasNull()) {
          value = null;
        }
        columns[(i - 1)] = value;
        columnMap.put(columnNames[(i - 1)], value);
      }
      rowMap.add(columnMap);
      rowByIndex.add(columns);
      processedRows++;
    }
  }
  
  public SortedMap[] getRows()
  {
    if (rowMap == null) {
      return null;
    }
    return (SortedMap[])rowMap.toArray(new SortedMap[0]);
  }
  
  public Object[][] getRowsByIndex()
  {
    if (rowByIndex == null) {
      return (Object[][])null;
    }
    return (Object[][])rowByIndex.toArray(new Object[0][0]);
  }
  
  public String[] getColumnNames()
  {
    return columnNames;
  }
  
  public int getRowCount()
  {
    if (rowMap == null) {
      return -1;
    }
    return rowMap.size();
  }
  
  public boolean isLimitedByMaxRows()
  {
    return isLimited;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.sql.ResultImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.sql;

import java.sql.ResultSet;
import java.sql.SQLException;

public class ResultSupport
{
  public static Result toResult(ResultSet rs)
  {
    try
    {
      return new ResultImpl(rs, -1, -1);
    }
    catch (SQLException ex) {}
    return null;
  }
  
  public static Result toResult(ResultSet rs, int maxRows)
  {
    try
    {
      return new ResultImpl(rs, -1, maxRows);
    }
    catch (SQLException ex) {}
    return null;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.sql.ResultSupport
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.sql;

public abstract interface SQLExecutionTag
{
  public abstract void addSQLParameter(Object paramObject);
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.sql.SQLExecutionTag
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

class PermittedTaglibsTLV$1 {}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

import java.util.Set;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

class PermittedTaglibsTLV$PermittedTaglibsHandler
  extends DefaultHandler
{
  private final PermittedTaglibsTLV this$0;
  
  private PermittedTaglibsTLV$PermittedTaglibsHandler(PermittedTaglibsTLV this$0)
  {
    this.this$0 = this$0;
  }
  
  PermittedTaglibsTLV$PermittedTaglibsHandler(PermittedTaglibsTLV x0, PermittedTaglibsTLV.1 x1)
  {
    this(x0);
  }
  
  public void startElement(String ns, String ln, String qn, Attributes a)
  {
    if ((!qn.equals("jsp:root")) && ((!ns.equals("http://java.sun.com/JSP/Page")) || (!ln.equals("root")))) {
      return;
    }
    for (int i = 0; i < a.getLength(); i++)
    {
      String name = a.getQName(i);
      if ((name.startsWith("xmlns:")) && (!name.equals("xmlns:jsp")))
      {
        String value = a.getValue(i);
        if (!value.equals(PermittedTaglibsTLV.access$100(this$0))) {
          if (!PermittedTaglibsTLV.access$200(this$0).contains(value)) {
            PermittedTaglibsTLV.access$302(this$0, true);
          }
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV.PermittedTaglibsHandler
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.TagLibraryValidator;
import javax.servlet.jsp.tagext.ValidationMessage;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class PermittedTaglibsTLV
  extends TagLibraryValidator
{
  private final String PERMITTED_TAGLIBS_PARAM = "permittedTaglibs";
  private final String JSP_ROOT_URI = "http://java.sun.com/JSP/Page";
  private final String JSP_ROOT_NAME = "root";
  private final String JSP_ROOT_QN = "jsp:root";
  private Set permittedTaglibs;
  private boolean failed;
  private String uri;
  
  public PermittedTaglibsTLV()
  {
    init();
  }
  
  private void init()
  {
    permittedTaglibs = null;
  }
  
  public void release()
  {
    super.release();
    init();
  }
  
  public synchronized ValidationMessage[] validate(String prefix, String uri, PageData page)
  {
    try
    {
      this.uri = uri;
      permittedTaglibs = readConfiguration();
      
      DefaultHandler h = new PermittedTaglibsHandler(null);
      
      SAXParserFactory f = SAXParserFactory.newInstance();
      f.setValidating(true);
      SAXParser p = f.newSAXParser();
      p.parse(page.getInputStream(), h);
      if (failed) {
        return vmFromString("taglib " + prefix + " (" + uri + ") allows only the " + "following taglibs to be imported: " + permittedTaglibs);
      }
      return null;
    }
    catch (SAXException ex)
    {
      return vmFromString(ex.toString());
    }
    catch (ParserConfigurationException ex)
    {
      return vmFromString(ex.toString());
    }
    catch (IOException ex)
    {
      return vmFromString(ex.toString());
    }
  }
  
  private Set readConfiguration()
  {
    Set s = new HashSet();
    
    String uris = (String)getInitParameters().get("permittedTaglibs");
    
    StringTokenizer st = new StringTokenizer(uris);
    while (st.hasMoreTokens()) {
      s.add(st.nextToken());
    }
    return s;
  }
  
  private ValidationMessage[] vmFromString(String message)
  {
    return new ValidationMessage[] { new ValidationMessage(null, message) };
  }
  
  private class PermittedTaglibsHandler
    extends DefaultHandler
  {
    PermittedTaglibsHandler(PermittedTaglibsTLV.1 x1)
    {
      this();
    }
    
    public void startElement(String ns, String ln, String qn, Attributes a)
    {
      if ((!qn.equals("jsp:root")) && ((!ns.equals("http://java.sun.com/JSP/Page")) || (!ln.equals("root")))) {
        return;
      }
      for (int i = 0; i < a.getLength(); i++)
      {
        String name = a.getQName(i);
        if ((name.startsWith("xmlns:")) && (!name.equals("xmlns:jsp")))
        {
          String value = a.getValue(i);
          if (!value.equals(uri)) {
            if (!permittedTaglibs.contains(value)) {
              failed = true;
            }
          }
        }
      }
    }
    
    private PermittedTaglibsHandler() {}
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

class ScriptFreeTLV$1 {}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.ScriptFreeTLV.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

import javax.servlet.jsp.tagext.ValidationMessage;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

class ScriptFreeTLV$MyContentHandler
  extends DefaultHandler
{
  private int declarationCount;
  private int scriptletCount;
  private int expressionCount;
  private int rtExpressionCount;
  private final ScriptFreeTLV this$0;
  
  ScriptFreeTLV$MyContentHandler(ScriptFreeTLV x0, ScriptFreeTLV.1 x1)
  {
    this(x0);
  }
  
  private ScriptFreeTLV$MyContentHandler(ScriptFreeTLV this$0)
  {
    this.this$0 = this$0;
    declarationCount = 0;
    scriptletCount = 0;
    expressionCount = 0;
    rtExpressionCount = 0;
  }
  
  public void startElement(String namespaceUri, String localName, String qualifiedName, Attributes atts)
  {
    if ((!ScriptFreeTLV.access$100(this$0)) && (qualifiedName.equals("jsp:declaration"))) {
      declarationCount += 1;
    } else if ((!ScriptFreeTLV.access$200(this$0)) && (qualifiedName.equals("jsp:scriptlet"))) {
      scriptletCount += 1;
    } else if ((!ScriptFreeTLV.access$300(this$0)) && (qualifiedName.equals("jsp:expression"))) {
      expressionCount += 1;
    }
    if (!ScriptFreeTLV.access$400(this$0)) {
      countRTExpressions(atts);
    }
  }
  
  private void countRTExpressions(Attributes atts)
  {
    int stop = atts.getLength();
    for (int i = 0; i < stop; i++)
    {
      String attval = atts.getValue(i);
      if ((attval.startsWith("%=")) && (attval.endsWith("%"))) {
        rtExpressionCount += 1;
      }
    }
  }
  
  public ValidationMessage[] reportResults()
  {
    if (declarationCount + scriptletCount + expressionCount + rtExpressionCount > 0)
    {
      StringBuffer results = new StringBuffer("JSP page contains ");
      boolean first = true;
      if (declarationCount > 0)
      {
        results.append(Integer.toString(declarationCount));
        results.append(" declaration");
        if (declarationCount > 1) {
          results.append('s');
        }
        first = false;
      }
      if (scriptletCount > 0)
      {
        if (!first) {
          results.append(", ");
        }
        results.append(Integer.toString(scriptletCount));
        results.append(" scriptlet");
        if (scriptletCount > 1) {
          results.append('s');
        }
        first = false;
      }
      if (expressionCount > 0)
      {
        if (!first) {
          results.append(", ");
        }
        results.append(Integer.toString(expressionCount));
        results.append(" expression");
        if (expressionCount > 1) {
          results.append('s');
        }
        first = false;
      }
      if (rtExpressionCount > 0)
      {
        if (!first) {
          results.append(", ");
        }
        results.append(Integer.toString(rtExpressionCount));
        results.append(" request-time attribute value");
        if (rtExpressionCount > 1) {
          results.append('s');
        }
        first = false;
      }
      results.append(".");
      return ScriptFreeTLV.access$500(results.toString());
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.ScriptFreeTLV.MyContentHandler
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.jsp.jstl.tlv;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.TagLibraryValidator;
import javax.servlet.jsp.tagext.ValidationMessage;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class ScriptFreeTLV
  extends TagLibraryValidator
{
  private boolean allowDeclarations = false;
  private boolean allowScriptlets = false;
  private boolean allowExpressions = false;
  private boolean allowRTExpressions = false;
  private SAXParserFactory factory;
  
  public ScriptFreeTLV()
  {
    factory = SAXParserFactory.newInstance();
    factory.setValidating(false);
    factory.setNamespaceAware(true);
  }
  
  public void setInitParameters(Map initParms)
  {
    super.setInitParameters(initParms);
    String declarationsParm = (String)initParms.get("allowDeclarations");
    String scriptletsParm = (String)initParms.get("allowScriptlets");
    String expressionsParm = (String)initParms.get("allowExpressions");
    String rtExpressionsParm = (String)initParms.get("allowRTExpressions");
    
    allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
    allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
    allowExpressions = "true".equalsIgnoreCase(expressionsParm);
    allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
  }
  
  public ValidationMessage[] validate(String prefix, String uri, PageData page)
  {
    InputStream in = null;
    
    MyContentHandler handler = new MyContentHandler(null);
    try
    {
      SAXParser parser;
      synchronized (factory)
      {
        parser = factory.newSAXParser();
      }
      SAXParser parser;
      in = page.getInputStream();
      parser.parse(in, handler);
    }
    catch (ParserConfigurationException e)
    {
      return vmFromString(e.toString());
    }
    catch (SAXException e)
    {
      return vmFromString(e.toString());
    }
    catch (IOException e)
    {
      ValidationMessage[] arrayOfValidationMessage;
      return vmFromString(e.toString());
    }
    finally
    {
      if (in != null) {
        try
        {
          in.close();
        }
        catch (IOException e) {}
      }
    }
    SAXParser parser;
    return handler.reportResults();
  }
  
  private class MyContentHandler
    extends DefaultHandler
  {
    MyContentHandler(ScriptFreeTLV.1 x1)
    {
      this();
    }
    
    private int declarationCount = 0;
    private int scriptletCount = 0;
    private int expressionCount = 0;
    private int rtExpressionCount = 0;
    
    public void startElement(String namespaceUri, String localName, String qualifiedName, Attributes atts)
    {
      if ((!allowDeclarations) && (qualifiedName.equals("jsp:declaration"))) {
        declarationCount += 1;
      } else if ((!allowScriptlets) && (qualifiedName.equals("jsp:scriptlet"))) {
        scriptletCount += 1;
      } else if ((!allowExpressions) && (qualifiedName.equals("jsp:expression"))) {
        expressionCount += 1;
      }
      if (!allowRTExpressions) {
        countRTExpressions(atts);
      }
    }
    
    private void countRTExpressions(Attributes atts)
    {
      int stop = atts.getLength();
      for (int i = 0; i < stop; i++)
      {
        String attval = atts.getValue(i);
        if ((attval.startsWith("%=")) && (attval.endsWith("%"))) {
          rtExpressionCount += 1;
        }
      }
    }
    
    public ValidationMessage[] reportResults()
    {
      if (declarationCount + scriptletCount + expressionCount + rtExpressionCount > 0)
      {
        StringBuffer results = new StringBuffer("JSP page contains ");
        boolean first = true;
        if (declarationCount > 0)
        {
          results.append(Integer.toString(declarationCount));
          results.append(" declaration");
          if (declarationCount > 1) {
            results.append('s');
          }
          first = false;
        }
        if (scriptletCount > 0)
        {
          if (!first) {
            results.append(", ");
          }
          results.append(Integer.toString(scriptletCount));
          results.append(" scriptlet");
          if (scriptletCount > 1) {
            results.append('s');
          }
          first = false;
        }
        if (expressionCount > 0)
        {
          if (!first) {
            results.append(", ");
          }
          results.append(Integer.toString(expressionCount));
          results.append(" expression");
          if (expressionCount > 1) {
            results.append('s');
          }
          first = false;
        }
        if (rtExpressionCount > 0)
        {
          if (!first) {
            results.append(", ");
          }
          results.append(Integer.toString(rtExpressionCount));
          results.append(" request-time attribute value");
          if (rtExpressionCount > 1) {
            results.append('s');
          }
          first = false;
        }
        results.append(".");
        return ScriptFreeTLV.vmFromString(results.toString());
      }
      return null;
    }
    
    private MyContentHandler() {}
  }
  
  private static ValidationMessage[] vmFromString(String message)
  {
    return new ValidationMessage[] { new ValidationMessage(null, message) };
  }
}

/* Location:
 * Qualified Name:     javax.servlet.jsp.jstl.tlv.ScriptFreeTLV
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.taglibs.standard.extra.spath;

import java.util.List;

public class AbsolutePath
  extends Path
{
  private boolean all;
  private RelativePath base;
  
  public AbsolutePath(RelativePath base)
  {
    if (base == null) {
      throw new IllegalArgumentException("non-null base required");
    }
    this.base = base;
  }
  
  public List getSteps()
  {
    return base.getSteps();
  }
}

/* Location:
 * Qualified Name:     org.apache.taglibs.standard.extra.spath.AbsolutePath
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.taglibs.standard.extra.spath;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public final class ASCII_CharStream
{
  public static final boolean staticFlag = false;
  int bufsize;
  int available;
  int tokenBegin;
  public int bufpos = -1;
  private int[] bufline;
  private int[] bufcolumn;
  private int column = 0;
  private int line = 1;
  private boolean prevCharIsCR = false;
  private boolean prevCharIsLF = false;
  private Reader inputStream;
  private char[] buffer;
  private int maxNextCharInd = 0;
  private int inBuf = 0;
  
  private final void ExpandBuff(boolean wrapAround)
  {
    char[] newbuffer = new char[bufsize + 2048];
    int[] newbufline = new int[bufsize + 2048];
    int[] newbufcolumn = new int[bufsize + 2048];
    try
    {
      if (wrapAround)
      {
        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
        System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
        
        buffer = newbuffer;
        
        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
        System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
        bufline = newbufline;
        
        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
        System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
        bufcolumn = newbufcolumn;
        
        maxNextCharInd = (bufpos += bufsize - tokenBegin);
      }
      else
      {
        System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
        buffer = newbuffer;
        
        System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
        bufline = newbufline;
        
        System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
        bufcolumn = newbufcolumn;
        
        maxNextCharInd = (bufpos -= tokenBegin);
      }
    }
    catch (Throwable t)
    {
      throw new Error(t.getMessage());
    }
    bufsize += 2048;
    available = bufsize;
    tokenBegin = 0;
  }
  
  private final void FillBuff()
    throws IOException
  {
    if (maxNextCharInd == available) {
      if (available == bufsize)
      {
        if (tokenBegin > 2048)
        {
          bufpos = (maxNextCharInd = 0);
          available = tokenBegin;
        }
        else if (tokenBegin < 0)
        {
          bufpos = (maxNextCharInd = 0);
        }
        else
        {
          ExpandBuff(false);
        }
      }
      else if (available > tokenBegin) {
        available = bufsize;
      } else if (tokenBegin - available < 2048) {
        ExpandBuff(true);
      } else {
        available = tokenBegin;
      }
    }
    try
    {
      int i;
      if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
      {
        inputStream.close();
        throw new IOException();
      }
      maxNextCharInd += i;
      return;
    }
    catch (IOException e)
    {
      bufpos -= 1;
      backup(0);
      if (tokenBegin == -1) {
        tokenBegin = bufpos;
      }
      throw e;
    }
  }
  
  public final char BeginToken()
    throws IOException
  {
    tokenBegin = -1;
    char c = readChar();
    tokenBegin = bufpos;
    
    return c;
  }
  
  private final void UpdateLineColumn(char c)
  {
    column += 1;
    if (prevCharIsLF)
    {
      prevCharIsLF = false;
      line += (column = 1);
    }
    else if (prevCharIsCR)
    {
      prevCharIsCR = false;
      if (c == '\n') {
        prevCharIsLF = true;
      } else {
        line += (column = 1);
      }
    }
    switch (c)
    {
    case '\r': 
      prevCharIsCR = true;
      break;
    case '\n': 
      prevCharIsLF = true;
      break;
    case '\t': 
      column -= 1;
      column += 8 - (column & 0x7);
      break;
    }
    bufline[bufpos] = line;
    bufcolumn[bufpos] = column;
  }
  
  public final char readChar()
    throws IOException
  {
    if (inBuf > 0)
    {
      inBuf -= 1;
      return (char)(0xFF & buffer[(++bufpos)]);
    }
    if (++bufpos >= maxNextCharInd) {
      FillBuff();
    }
    char c = (char)(0xFF & buffer[bufpos]);
    
    UpdateLineColumn(c);
    return c;
  }
  
  /**
   * @deprecated
   */
  public final int getColumn()
  {
    return bufcolumn[bufpos];
  }
  
  /**
   * @deprecated
   */
  public final int getLine()
  {
    return bufline[bufpos];
  }
  
  public final int getEndColumn()
  {
    return bufcolumn[bufpos];
  }
  
  public final int getEndLine()
  {
    return bufline[bufpos];
  }
  
  public final int getBeginColumn()
  {
    return bufcolumn[tokenBegin];
  }
  
  public final int getBeginLine()
  {
    return bufline[tokenBegin];
  }
  
  public final void backup(int amount)
  {
    inBuf += amount;
    if (bufpos -= amount < 0) {
      bufpos += bufsize;
    }
  }
  
  public ASCII_CharStream(Reader dstream, int startline, int startcolumn, int buffersize)
  {
    inputStream = dstream;
    line = startline;
    column = (startcolumn - 1);
    
    available = (bufsize = buffersize);
    buffer = new char[buffersize];
    bufline = new int[buffersize];
    bufcolumn = new int[buffersize];
  }
  
  public ASCII_CharStream(Reader dstream, int startline, int startcolumn)
  {
    this(dstream, startline, startcolumn, 4096);
  }
  
  public void ReInit(Reader dstream, int startline, int startcolumn, int buffersize)
  {
    inputStream = dstream;
    line = startline;
    column = (start
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd