abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r655963 - in /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server: Target.java impl/RegexTargetResolver.java impl/RouteManager.java impl/SimpleTarget.java
Date Tue, 13 May 2008 18:26:20 GMT
Author: jmsnell
Date: Tue May 13 11:26:20 2008
New Revision: 655963

URL: http://svn.apache.org/viewvc?rev=655963&view=rev
Log:
https://issues.apache.org/jira/browse/ABDERA-157

Modified version of David's patch.  I changed the method signature to <T>T getMatcher()
and made the RegexTarget return the Pattern that was matched instead of the Matcher.  Allowing
access to the Matcher can cause problems since it's a mutable object.  The Pattern is better.

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RegexTargetResolver.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SimpleTarget.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java?rev=655963&r1=655962&r2=655963&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
Tue May 13 11:26:20 2008
@@ -44,4 +44,10 @@
    */
   String[] getParameterNames();
   
+  /**
+   * Return the object that matches with the uri
+   * @return
+   */
+  public <T>T getMatcher();
+  
 }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RegexTargetResolver.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RegexTargetResolver.java?rev=655963&r1=655962&r2=655963&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RegexTargetResolver.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RegexTargetResolver.java
Tue May 13 11:26:20 2008
@@ -181,6 +181,11 @@
       if (fields != null) list.addAll(Arrays.asList(fields));
       return list.toArray(new String[list.size()]);
     }
+    
+    @Override
+    public <T>T getMatcher() {
+    	return (T)matcher.pattern();
+    }
 
     @Override
     public int hashCode() {

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java?rev=655963&r1=655962&r2=655963&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
Tue May 13 11:26:20 2008
@@ -204,6 +204,12 @@
       public Route getRoute() {
         return route;
       }
+      
+      @Override
+      public <T>T getMatcher() {
+    	  return (T)getRoute();
+      }
+      
       public String getParameter(String name) {
         return params.containsKey(name) ?
           params.get(name) :

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SimpleTarget.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SimpleTarget.java?rev=655963&r1=655962&r2=655963&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SimpleTarget.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SimpleTarget.java
Tue May 13 11:26:20 2008
@@ -64,6 +64,10 @@
   public String toString() {
     return getType() + " - " + getIdentity();
   }
+  
+  public <T>T getMatcher() {
+	  return (T)null;
+  }
 
   @Override
   public int hashCode() {



Mime
View raw message