Package org.apache.struts.digester

Examples of org.apache.struts.digester.Digester


     * file format.
     */
    protected Digester initDigesterOld(int detail) {

  // Initialize a new Digester instance
  Digester digester = new Digester();
  digester.push(this);
  digester.setDebug(detail);
  digester.setValidating(false);

  // Configure the processing rules
  digester.addObjectCreate("action-mappings/action", mappingClass,
         "className");
  digester.addSetProperties("action-mappings/action");
  digester.addSetNext("action-mappings/action", "addMapping",
          "org.apache.struts.action.ActionMapping");
  digester.addObjectCreate("action-mappings/action/forward",
         forwardClass, "className");
  digester.addSetProperties("action-mappings/action/forward");
  digester.addSetNext("action-mappings/action/forward", "addForward",
          "org.apache.struts.action.ActionForward");
  digester.addSetProperty("action-mappings/action/forward/property",
        "name", "value");
  digester.addSetProperty("action-mappings/action/property",
        "name", "value");
  digester.addObjectCreate("action-mappings/forward",
         forwardClass, "className");
  digester.addSetProperties("action-mappings/forward");
  digester.addSetNext("action-mappings/forward", "addForward",
          "org.apache.struts.action.ActionForward");
  digester.addSetProperty("action-mappings/forward/property",
        "name", "value");

  return (digester);

    }
View Full Code Here


  if (input == null)
      throw new UnavailableException
    (internal.getMessage("configMissing", config));

  // Build a digester to process our configuration resource
  Digester digester = null;
  if (validate)
      digester = initDigester(detail);
  else
      digester = initDigesterOld(detail);

  // Parse the input stream to configure our mappings
  try {
            formBeans.setFast(false);
            forwards.setFast(false);
            mappings.setFast(false);
      digester.parse(input);
            mappings.setFast(true);
            forwards.setFast(true);
            formBeans.setFast(true);
  } catch (SAXException e) {
      throw new ServletException
View Full Code Here

        // Remember our servlet name
        this.servletName = getServletConfig().getServletName();

        // Prepare a Digester to scan the web application deployment descriptor
        Digester digester = new Digester();
        digester.push(this);
        digester.setDebug(this.debug);
        digester.setValidating(false);

  // Register our local copy of the DTDs that we can find
        for (int i = 0; i < registrations.length; i += 2) {
            URL url = this.getClass().getResource(registrations[i+1]);
            if (url != null)
                digester.register(registrations[i], url.toString());
        }

        // Configure the processing rules that we need
        digester.addCallMethod("web-app/servlet-mapping",
                               "addServletMapping", 2);
        digester.addCallParam("web-app/servlet-mapping/servlet-name", 0);
        digester.addCallParam("web-app/servlet-mapping/url-pattern", 1);

        // Process the web application deployment descriptor
        InputStream input= null;
        try {
            input =
                getServletContext().getResourceAsStream("/WEB-INF/web.xml");
            digester.parse(input);
        } catch (Throwable e) {
            log(internal.getMessage("configWebXml"), e);
        } finally {
            if (input != null)
                input = null;
View Full Code Here

  if (input == null)
      throw new UnavailableException
    (internal.getMessage("configMissing", config));

  // Build a digester to process our configuration resource
  Digester digester = new Digester();
  digester.push(this);
  digester.setDebug(detail);
  digester.setValidating(false);
  digester.addObjectCreate("action-mappings/action", mappingClass,
         "className");
  digester.addSetProperties("action-mappings/action");
  digester.addSetNext("action-mappings/action", "addMapping",
          "org.apache.struts.action.ActionMapping");
  digester.addObjectCreate("action-mappings/action/forward",
         forwardClass, "className");
  digester.addSetProperties("action-mappings/action/forward");
  digester.addSetNext("action-mappings/action/forward", "addForward",
          "org.apache.struts.action.ActionForward");
  digester.addSetProperty("action-mappings/action/forward/property",
        "name", "value");
  digester.addSetProperty("action-mappings/action/property",
        "name", "value");
  digester.addObjectCreate("action-mappings/forward",
         forwardClass, "className");
  digester.addSetProperties("action-mappings/forward");
  digester.addSetNext("action-mappings/forward", "addForward",
          "org.apache.struts.action.ActionForward");
  digester.addSetProperty("action-mappings/forward/property",
        "name", "value");

  // Parse the input stream to configure our mappings
  try {
      digester.parse(input);
      input.close();
  } catch (SAXException e) {
      throw new ServletException
    (internal.getMessage("configParse", config), e);
  }
View Full Code Here

            return;
        }
  BufferedInputStream bis = new BufferedInputStream(is);

  // Construct a digester to use for parsing
  Digester digester = new Digester();
  digester.push(this);
  digester.setDebug(debug);
  digester.setValidating(false);
  digester.addObjectCreate("database/user",
         "org.apache.struts.webapp.example.User");
  digester.addSetProperties("database/user");
  digester.addSetNext("database/user", "addUser");
  digester.addObjectCreate("database/user/subscription",
         "org.apache.struts.webapp.example.Subscription");
  digester.addSetProperties("database/user/subscription");
  digester.addSetTop("database/user/subscription", "setUser");

  // Parse the input stream to initialize our database
  digester.parse(bis);
  bis.close();

    }
View Full Code Here

TOP

Related Classes of org.apache.struts.digester.Digester

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.