cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/webapp sitemap.xmap
Date Tue, 15 May 2001 11:34:26 GMT
dims        01/05/15 04:34:26

  Modified:    webapp   sitemap.xmap
  Added:       src/org/apache/cocoon/matching RequestParamMatcher.java
  Log:
  RequestParamMatcher contribution from Marcus Crafter (crafterm@fztig938.bank.dresdner.net)
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/org/apache/cocoon/matching/RequestParamMatcher.java
  
  Index: RequestParamMatcher.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  /*
   * Package definition
   */
  package org.apache.cocoon.matching;
  
  /*
   * Standard imports
   */
  import java.util.*;
  import org.apache.cocoon.matching.Matcher;
  import org.apache.cocoon.environment.Request;
  import org.apache.cocoon.Constants;
  
  /**
   * This class allows for matching based on a request parameter.
   * If the specified request parameter exists, its value is retrieved for later
   * xpath substitution.
   *
   * Example:
   *
   * <map:match type="request" pattern="dest">
   *     <map:redirect-to uri="{1}"/>
   * </map:match>
   * 
   * @author <a href="mailto:Marcus.Crafter@osa.de">Marcus Crafter</a>
   * @version CVS $Revision: 1.1 $
   */
  public class RequestParamMatcher implements Matcher {
      /**
        * Match method to see if the request parameter exists. If it does
        * have a value the parameter is added to the array list for later
        * substitution with a xpath attribute.
        *
        * @param pattern name of request parameter to find
        * @param objectModel environment passed through via cocoon
        * @returns null or map containing value of request parameter 'pattern'
        */
      public Map match(String pattern, Map objectModel) {
          Request request =
            (Request) objectModel.get(Constants.REQUEST_OBJECT);
          String param = request.getParameter(pattern);
  
          if (param == null)
              return null; // no parameter defined
          else {
              Map map = new HashMap();
              map.put(Integer.toString(1), param);
              return map; // parameter defined, return map
          }
      }
  }
  
  
  
  1.3       +2 -1      xml-cocoon2/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/sitemap.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sitemap.xmap	2001/05/11 11:00:52	1.2
  +++ sitemap.xmap	2001/05/15 11:34:24	1.3
  @@ -89,8 +89,9 @@
     </map:selectors>
   
     <map:matchers default="wildcard">
  -   <map:matcher name="wildcard"        factory="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
  +   <map:matcher name="wildcard" factory="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
      <map:matcher name="regexp" factory="org.apache.cocoon.matching.RegexpURIMatcherFactory"/>
  +   <map:matcher name="request" src="org.apache.cocoon.matching.RequestParamMatcher"/>
     </map:matchers>
   
     <map:actions>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message