luehe       2003/07/23 12:23:46

  Modified:    jasper2/src/share/org/apache/jasper/compiler Parser.java
                        PageInfo.java
  Log:
  Preparation work for new 'static include' rules
  
  Revision  Changes    Path
  1.77      +5 -5      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Parser.java       21 Jul 2003 20:44:20 -0000      1.76
  +++ Parser.java       23 Jul 2003 19:23:46 -0000      1.77
  @@ -459,7 +459,7 @@
                                                              location,
                                                              err));
                }
  -             pageInfo.addPrefixToURIMapping(prefix, uri);
  +             pageInfo.addPrefixMapping(prefix, uri);
            } else {
                String tagdir = attrs.getValue("tagdir");
                if (tagdir != null) {
  @@ -473,7 +473,7 @@
                                                   tagdir,
                                                   err));
                    }
  -                 pageInfo.addPrefixToURIMapping(prefix, urnTagdir);
  +                 pageInfo.addPrefixMapping(prefix, urnTagdir);
                }
            }
        }
  
  
  
  1.32      +51 -11    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java
  
  Index: PageInfo.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PageInfo.java     21 Jul 2003 21:52:51 -0000      1.31
  +++ PageInfo.java     23 Jul 2003 19:23:46 -0000      1.32
  @@ -79,8 +79,8 @@
   
       private BeanRepository beanRepository;
       private HashMap taglibsMap;
  -    private Hashtable prefixMapper;
  -
  +    private HashMap jspPrefixMapper;
  +    private HashMap xmlPrefixMapper;
       private String language = "java";
       private String xtends = Constants.JSP_SERVLET_BASE;
       private String contentType = null;
  @@ -128,7 +128,8 @@
       PageInfo(BeanRepository beanRepository) {
        this.beanRepository = beanRepository;
        this.taglibsMap = new HashMap();
  -     this.prefixMapper = new Hashtable();
  +     this.jspPrefixMapper = new HashMap();
  +     this.xmlPrefixMapper = new HashMap();
        this.imports = new Vector();
           this.dependants = new Vector();
        this.includePrelude = new Vector();
  @@ -344,19 +345,58 @@
        * @param prefix The prefix to map
        * @param uri The URI to be associated with the given prefix
        */
  -    public void addPrefixToURIMapping(String prefix, String uri) {
  -     prefixMapper.put(prefix, uri);
  +    public void addPrefixMapping(String prefix, String uri) {
  +     jspPrefixMapper.put(prefix, uri);
       }
   
       /*
  -     * Maps the given prefix to its URI.
  +     * Pushes the given URI onto the stack of URIs to which the given prefix
  +     * is mapped.
        *
  -     * @param prefix The prefix to map
  +     * @param prefix The prefix whose stack of URIs is to be pushed
  +     * @param uri The URI to be pushed onto the stack
  +     */
  +    public void pushPrefixMapping(String prefix, String uri) {
  +     LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
  +     if (stack == null) {
  +         stack = new LinkedList();
  +     }
  +     stack.addFirst(uri);
  +    }
  +
  +    /*
  +     * Removes the URI at the top of the stack of URIs to which the given 
  +     * prefix is mapped. 
  +     *
  +     * @param prefix The prefix whose stack of URIs is to be popped
  +     */
  +    public void popPrefixMapping(String prefix) {
  +     LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
  +     if (stack == null || stack.size() == 0) {
  +         // XXX throw new Exception("XXX");
  +     }
  +     stack.removeFirst();
  +    }
  +
  +    /*
  +     * Returns the URI to which the given prefix maps.
  +     *
  +     * @param prefix The prefix whose URI is sought
        *
        * @return The URI to which the given prefix maps
        */
       public String getURI(String prefix) {
  -     return (String) prefixMapper.get(prefix);
  +
  +     String uri = null;
  +
  +     LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
  +     if (stack == null || stack.size() == 0) {
  +         uri = (String) jspPrefixMapper.get(prefix);
  +     } else {
  +         uri = (String) stack.getFirst();
  +     }
  +
  +     return uri;
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to