Package org.apache.tomcat.util.xml

Examples of org.apache.tomcat.util.xml.XmlAction


  throws TomcatException
    {
  ContextPropertySource propS=new ContextPropertySource( cm );
  xh.setPropertySource( propS );
 
  xh.addRule( "Context/Property", new XmlAction() {
    public void start(SaxContext ctx ) throws Exception {
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String value=attributes.getValue("value");
        if( name==null || value==null ) return;
View Full Code Here


  // Virtual host support - if Context is inside a <Host>
  xh.addRule( "Host", xh.setVar( "current_host", "name"));
  xh.addRule( "Host", xh.setVar( "current_address", "address"));
  xh.addRule( "Host", xh.setVar( "host_aliases", "")); // so host_aliases will get reset
  xh.addRule( "Host", xh.setProperties());
  xh.addRule( "Alias", new XmlAction() {
    public void start( SaxContext xctx) throws Exception {
        Vector aliases=(Vector)xctx.getVariable( "host_aliases" );
        if( aliases==null ) {
      aliases=new Vector();
      xctx.setVariable( "host_aliases", aliases );
        }
        String alias=(String)xctx.getCurrentAttributes().getValue("name");
        if( alias!=null )
      aliases.addElement( alias );
    }
      });

        xh.addRule( "Context", new XmlAction() {
                public void start( SaxContext xctx) throws Exception {
                    Context tcCtx=(Context)xctx.currentObject();
                    XmlMapper xm=xctx.getMapper();
                    ContextPropertySource propS = (ContextPropertySource)xm.getPropertySource();
                    if( propS != null )
                        propS.setContext(tcCtx);
                }
            });

  xh.addRule( "Context", new XmlAction() {
    public void end( SaxContext xctx) throws Exception {
        Context tcCtx=(Context)xctx.currentObject();
                    XmlMapper xm=xctx.getMapper();
                    ContextPropertySource propS = (ContextPropertySource)xm.getPropertySource();
                    if( propS != null )
View Full Code Here

    {
  CMPropertySource propS=new CMPropertySource( cm );
  xh.setPropertySource( propS );

        // add the "correct" first-letter-capitalized version
        xh.addRule( "ContextManager/Property", new XmlAction() {
                public void start(SaxContext ctx ) throws Exception {
                    AttributeList attributes = ctx.getCurrentAttributes();
                    String name=attributes.getValue("name");
                    String value=attributes.getValue("value");
                    if( name==null || value==null ) return;
                    XmlMapper xm=ctx.getMapper();

                    ContextManager cm1=(ContextManager)ctx.currentObject();
                    // replace ${foo} in value
                    value=xm.replaceProperties( value );
                    if( cm1.getDebug() > 0 )
                        cm1.log("Setting " + name + "=" + value);
                    cm1.setProperty( name, value );
                }
            });

        // for backward compatibility, keep old version
  xh.addRule( "ContextManager/property", new XmlAction() {
    public void start(SaxContext ctx ) throws Exception {
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String value=attributes.getValue("value");
        if( name==null || value==null ) return;
View Full Code Here

        xh.addChild( "addInterceptor",
         "org.apache.tomcat.core.BaseInterceptor"));
    }

    public static void setTagRules( XmlMapper xh ) {
  xh.addRule( "module"new XmlAction() {
    public void start(SaxContext ctx ) throws Exception {
        Object elem=ctx.currentObject();
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String classN=attributes.getValue("javaClass");
View Full Code Here

            XmlMapper xh=new XmlMapper();
            if( getDebug() > 5 ) xh.setDebug( 2 );

            // call addUser using attributes as parameters
            xh.addRule("tomcat-users/user",
                       new XmlAction() {
                               public void start(SaxContext sctx) throws Exception {
                                   int top=sctx.getTagCount()-1;
                                   MemoryRealm mr=(MemoryRealm)sctx.getRoot();
                                   AttributeList attributes = sctx.getAttributeList( top );
                                   String user=attributes.getValue("name");
View Full Code Here

  xh.addRule( tag ,
        xh.objectCreate( classN, null ));
  xh.addRule( tag ,
        xh.setProperties());
  xh.addRule( tag,
        new XmlAction() {
      public void end( SaxContext ctx) throws Exception {
          Vector modules=(Vector)ctx.getRoot();
          Object obj=ctx.currentObject();
          modules.addElement( obj );
      }
View Full Code Here

        });
    }


    public static void setTagRules( XmlMapper xh ) {
  xh.addRule( "module"new XmlAction() {
    public void start(SaxContext ctx ) throws Exception {
        Object elem=ctx.currentObject();
        AttributeList attributes = ctx.getCurrentAttributes();
        String name=attributes.getValue("name");
        String classN=attributes.getValue("javaClass");
View Full Code Here

      xh.addRule("web-app/servlet", xh.objectCreate("org.apache.tomcat.facade.ServletInfo") ); // servlet-wrapper
      xh.addRule("web-app/servlet", xh.setParent( "setContext") ); // remove it from stack when done
      //      xh.addRule("web-app/servlet", xh.addChild("addServlet", "org.apache.tomcat.core.Handler") );

      final WebXmlReader wxr=this;
      xh.addRule("web-app/servlet", new XmlAction() {
         public void end( SaxContext xctx)
             throws Exception {
             ServletInfo sw=(ServletInfo)
           xctx.currentObject();
             Context cctx=(Context)xctx.previousObject();
View Full Code Here

    void addSecurity( XmlMapper xh ) {
  xh.addRule("web-app/security-constraint",
       new SCAction() );

  xh.addRule("web-app/security-constraint/user-data-constraint/transport-guarantee",
       new XmlAction() {
         public void end( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             SecurityConstraint rc=(SecurityConstraint)st.peek();
             String  body=ctx.getBody().trim();
             rc.setTransport( body );
         }
           }
       );
  xh.addRule("web-app/security-constraint/auth-constraint/role-name",
       new XmlAction() {
         public void end( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             SecurityConstraint rc=(SecurityConstraint)st.peek();
             String  body=ctx.getBody().trim();
             rc.addRole( body );
         }
           }
       );

  xh.addRule("web-app/security-constraint/web-resource-collection",
       new XmlAction() {
         public void start( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             st.push(new ResourceCollection());
         }
         public void end( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             ResourceCollection rc=(ResourceCollection)st.pop();
             SecurityConstraint sc=(SecurityConstraint)st.peek();
             st.push( rc );
             sc.addResourceCollection( rc );
         }
         public void cleanup( SaxContext ctx) {
             Stack st=ctx.getObjectStack();
             Object o=st.pop();
         }
           }
       );

  xh.addRule("web-app/security-constraint/web-resource-collection/url-pattern",
       new XmlAction() {
         public void end( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             ResourceCollection rc=(ResourceCollection)st.peek();
             String  body=ctx.getBody().trim();
             rc.addUrlPattern( body );
         }
           }
       );
  xh.addRule("web-app/security-constraint/web-resource-collection/http-method",
       new XmlAction() {
         public void end( SaxContext ctx) throws Exception {
             Stack st=ctx.getObjectStack();
             ResourceCollection rc=(ResourceCollection)st.peek();
             String  body=ctx.getBody().trim();
             rc.addHttpMethod( body );
View Full Code Here

TOP

Related Classes of org.apache.tomcat.util.xml.XmlAction

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.