incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r788908 [4/8] - in /incubator/wink/contrib/ibm-jaxrs: src/com/ibm/ws/jaxrs/annotations/ src/com/ibm/ws/jaxrs/context/ src/com/ibm/ws/jaxrs/core/ src/com/ibm/ws/jaxrs/engine/ src/com/ibm/ws/jaxrs/exception/ src/com/ibm/ws/jaxrs/ext/ src/com/...
Date Sat, 27 Jun 2009 00:02:34 GMT
Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletApplicationProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletApplicationProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletApplicationProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletMetadataProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletMetadataProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletMetadataProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletResponseWriter.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletResponseWriter.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletResponseWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletStatusOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletStatusOutputStream.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/ServletStatusOutputStream.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationData.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationData.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationData.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationScanner.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationScanner.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationScanner.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationVisitor.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSAnnotationVisitor.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSClassAdapter.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSClassAdapter.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/ws/jaxrs/web/asm/JAXRSClassAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/http/DateHandler.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/http/DateHandler.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/http/DateHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Consumes.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Consumes.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Consumes.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ObjectFactory.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ObjectFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Produces.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Produces.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Produces.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Representation.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Representation.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Representation.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resource.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resource.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceLocator.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceLocator.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceLocator.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceMethod.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceMethod.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/ResourceMethod.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resources.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resources.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/Resources.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/SubResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/SubResource.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/com/ibm/wsspi/jaxrs/options/SubResource.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PackageUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PackageUtils.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PackageUtils.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PrimitiveUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PrimitiveUtils.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/PrimitiveUtils.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/StringUtils.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/StringUtils.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/StringUtils.java Sat Jun 27 00:02:26 2009
@@ -123,9 +123,11 @@
         List<String> parts = Arrays.asList(str.split("/"));
         List<String> ret = new ArrayList<String>(parts != null ? parts.size()
                 : 0);
-        for (String part : parts) {
-            if (!isEmpty(part)) {
-                ret.add(part);
+        if (parts != null) {
+            for (String part : parts) {
+                if (!isEmpty(part)) {
+                    ret.add(part);
+                }
             }
         }
         return ret;

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/common/util/StringUtils.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/IOUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/IOUtils.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/IOUtils.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/helpers/LoadingByteArrayOutputStream.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/EntityTagHeaderProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/EntityTagHeaderProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/EntityTagHeaderProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java Sat Jun 27 00:02:26 2009
@@ -19,11 +19,14 @@
 
 package org.apache.cxf.jaxrs.impl;
 
+import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
@@ -32,6 +35,23 @@
 
 public class MediaTypeHeaderProvider implements HeaderDelegate<MediaType> {
 
+    final private static int cacheSize = 128;
+
+    private ThreadLocal<LinkedHashMap<String, MediaType>> mediaTypeCache = new ThreadLocal<LinkedHashMap<String, MediaType>>() {
+
+        @Override
+        public LinkedHashMap<String, MediaType> initialValue() {
+            return new LinkedHashMap<String, MediaType>(16, 0.75f, true) {
+                private static final long serialVersionUID = 3802888905777490396L;
+
+                @Override
+                protected boolean removeEldestEntry(Map.Entry<String, MediaType> eldestEntry) {
+                    return size() > cacheSize;
+                }
+            };
+        }
+    };
+
     public MediaType fromString(String mType) {
         if (mType == null) {
             throw new IllegalArgumentException(Messages.getMessage("nullInput"));
@@ -42,6 +62,12 @@
             return MediaType.WILDCARD_TYPE;
         }
 
+        LinkedHashMap<String, MediaType> cache = mediaTypeCache.get();
+        MediaType mt = cache.get(mType);
+        if (mt != null) {
+            return mt;
+        }
+
         int i = mType.indexOf('/');
         if (i == -1) {
             throw new IllegalArgumentException(Messages.getMessage(
@@ -75,8 +101,10 @@
 
         }
 
-        return new MediaType(type.trim().toLowerCase(), subtype.trim()
+        mt = new MediaType(type.trim().toLowerCase(), subtype.trim()
                 .toLowerCase(), parameters);
+        cache.put(mType, mt);
+        return mt;
     }
 
     public String toString(MediaType type) {
@@ -88,15 +116,17 @@
         sb.append(type.getType()).append('/').append(type.getSubtype());
 
         Map<String, String> params = type.getParameters();
-        if (params != null) {
-            for (Iterator<Map.Entry<String, String>> iter = params.entrySet()
-                    .iterator(); iter.hasNext();) {
-                Map.Entry<String, String> entry = iter.next();
-                sb.append(';').append(entry.getKey()).append('=').append(
-                        entry.getValue());
+        if (params != null && !params.isEmpty()) {
+            /*
+             * this is very important to keep the ordering the same.  toString(MediaType) is used for keys in a lot of maps
+             */
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+
+            for (String k : keys) {
+                sb.append(';').append(k).append('=').append(params.get(k));
             }
         }
-
         return sb.toString();
     }
 

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MetadataMap.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MetadataMap.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/MetadataMap.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java Sat Jun 27 00:02:26 2009
@@ -45,7 +45,7 @@
 
     private Object entity;
 
-    private MultivaluedMap<String, Object> metadata = new MetadataMap<String, Object>();
+    final private MultivaluedMap<String, Object> metadata = new MetadataMap<String, Object>();
 
     public ResponseBuilderImpl() {
     }
@@ -62,7 +62,7 @@
     public Response build() {
         ResponseImpl r = new ResponseImpl(status, entity);
         MetadataMap<String, Object> m = new MetadataMap<String, Object>(
-                metadata, new CaseInsensitiveComparator());
+                metadata, CaseInsensitiveComparator.getInstance());
         r.addMetadata(m);
         reset();
         return r;

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/ResponseImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/VariantListBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/VariantListBuilderImpl.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/VariantListBuilderImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/AbstractThreadLocalProxy.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/AbstractThreadLocalProxy.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/AbstractThreadLocalProxy.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpHeaders.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpHeaders.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpHeaders.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalProxy.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalProxy.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalProxy.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalRequest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalRequest.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalRequest.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSecurityContext.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSecurityContext.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSecurityContext.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalUriInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalUriInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/impl/tl/ThreadLocalUriInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java Sat Jun 27 00:02:26 2009
@@ -40,16 +40,10 @@
      */
     public void initConstructorParams();
 
-    public void initContextFields();
-
-    public void initContextSetterMethods();
-
     public Map<Class<?>, Method> getContextMethods();
 
     public boolean isRoot();
 
-    public Class<?> getResourceClass();
-
     public List<Field> getContextFields();
 
     /*

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ClassResourceInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ClassResourceInfo.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ClassResourceInfo.java Sat Jun 27 00:02:26 2009
@@ -22,6 +22,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.List;
+import java.util.Map;
 
 import javax.ws.rs.core.MediaType;
 
@@ -47,21 +48,19 @@
 
     public URITemplate getURITemplate();
 
-    public void setURITemplate(URITemplate u);
-
     public void addURIAliasTemplate(URITemplate u);
 
     public List<URITemplate> getURIAliasTemplates();
 
     public MethodDispatcher getMethodDispatcher();
 
-    public void setMethodDispatcher(MethodDispatcher md);
-
     public boolean hasSubResources();
 
     public void addSubClassResourceInfo(ClassResourceInfo cri);
 
-    public List<ClassResourceInfo> getSubClassResourceInfo();
+    public Map<String, ClassResourceInfo> getSubClassResourceInfoMap();
+
+    public ClassResourceInfo getSubClassResourceInfo(String className);
 
     public List<MediaType> getProduces();
 
@@ -78,7 +77,4 @@
     public boolean isSingleton();
 
     public Object getSingleton();
-
-    public void setValue(Property property, Object value);
-
 }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/MethodDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/MethodDispatcher.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/MethodDispatcher.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/MethodDispatcher.java Sat Jun 27 00:02:26 2009
@@ -21,29 +21,45 @@
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
 
 public class MethodDispatcher {
 
-    private List<OperationResourceInfo> opInfos = new ArrayList<OperationResourceInfo>();
+    /*
+     * this class should be thread safe since it is only constructed per thread and then added
+     */
+
+    final private List<OperationResourceInfo> opInfos = new ArrayList<OperationResourceInfo>();
 
-    private Map<OperationResourceInfo, Method> oriToMethod = new ConcurrentHashMap<OperationResourceInfo, Method>();
+    final private Map<OperationResourceInfo, Method> oriToMethod = new HashMap<OperationResourceInfo, Method>();
 
-    private Map<Method, OperationResourceInfo> methodToOri = new ConcurrentHashMap<Method, OperationResourceInfo>();
+    final private Map<Method, OperationResourceInfo> methodToOri = new HashMap<Method, OperationResourceInfo>();
 
     public void bind(OperationResourceInfo o, Method... methods) {
         Method primary = methods[0];
 
+        Set<OperationResourceInfo> oldValues = new HashSet<OperationResourceInfo>();
         for (Method m : methods) {
-            methodToOri.put(m, o);
+            OperationResourceInfo oldValue = methodToOri.put(m, o);
+            if (oldValue != null && !oldValue.equals(o)) {
+                oldValues.add(oldValue);
+            }
         }
 
         oriToMethod.put(o, primary);
+        opInfos.add(o);
 
-        if (!opInfos.contains(o)) {
-            opInfos.add(o);
+        for (OperationResourceInfo oldOri : oldValues) {
+            oriToMethod.remove(oldOri);
+            opInfos.remove(oldOri);
         }
     }
 
@@ -58,4 +74,25 @@
     public Method getMethod(OperationResourceInfo op) {
         return oriToMethod.get(op);
     }
+
+    final private ThreadLocal<Map<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>>> cache = new ThreadLocal<Map<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>>>() {
+        @Override
+        public Map<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>> initialValue() {
+            return new LinkedHashMap<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>>(
+                    4, 0.75f, true) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                public boolean removeEldestEntry(Map.Entry<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>> eldestEntry) {
+                    return size() > opInfos.size();
+                }
+            };
+        }
+    };
+
+    public Map<String, Map<String, Map<String, Map<MediaType, OperationResourceInfo>>>> getCache() {
+        return cache.get();
+    }
+
 }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/MethodDispatcher.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfo.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfo.java Sat Jun 27 00:02:26 2009
@@ -26,66 +26,46 @@
 
 public interface OperationResourceInfo {
 
-    // names of properties that can be associated with a value
-    public enum Property {
-
-        // String
-        PATH,
-
-        // List<MediaType>
-        CONSUMES,
-
-        // List<MediaType>
-        PRODUCES,
-
-        // Boolean
-        ENCODED,
-
-        // String
-        DEFAULT_VALUE
-
-    }
-
     public URITemplate getURITemplate();
 
-    public void setURITemplate(URITemplate u);
-
     public ClassResourceInfo getClassResourceInfo();
 
-    public void setClassResourceInfo(ClassResourceInfo c);
-
     public Method getMethodToInvoke();
 
-    public void setMethodToInvoke(Method m);
-
+    /**
+     * Returns the HTTP Method in all uppercase.
+     * @return the HTTP method in uppercase
+     */
     public String getHttpMethod();
 
-    public void setHttpMethod(String m);
-
-    public void setAnnotatedMethod(Method m);
-
     public Method getAnnotatedMethod();
 
     public boolean isSubResourceLocator();
 
-    public void setIsSubResourceLocator(boolean subResourceLocator);
-
     public boolean isSubResourceMethod();
 
-    public void setIsSubResourceMethod(boolean subResourceMethod);
-
     public List<MediaType> getProduces();
 
     public List<MediaType> getConsumes();
 
+    public boolean isMediaTypeCompatibleWithProduces(MediaType aMediaType);
+
+    public boolean isMediaTypeCompatibleWithConsumes(MediaType aMediaType);
+
+    public List<MediaType> getProducesIntersectedWithMediaType(MediaType aMediaType);
+
+    public List<MediaType> getConsumesIntersectedWithMediaType(MediaType aMediaType);
+
+    public MediaType getConsumesTypesMostSpecificCompatibleWithMediaType(MediaType aMediaType);
+
+    public MediaType getProducesTypesMostSpecificCompatibleWithMediaType(MediaType aMediaType);
+
     public String getPath();
 
     public boolean isEncodedEnabled();
 
     public String getDefaultParameterValue();
 
-    public void setValue(Property property, Object value);
-
     public void setIsFormParamFound(boolean isFormParamFound);
 
     public boolean isFormParamFound();

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java Sat Jun 27 00:02:26 2009
@@ -20,7 +20,8 @@
 package org.apache.cxf.jaxrs.model;
 
 import java.util.Comparator;
-import java.util.List;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 import javax.ws.rs.HttpMethod;
 import javax.ws.rs.core.MediaType;
@@ -28,58 +29,136 @@
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
 public class OperationResourceInfoComparator implements Comparator<OperationResourceInfo> {
+    final private static int cacheSize = 8;
+
+    private static final ThreadLocal<Map<String, Map<String, OperationResourceInfoComparator>>> comparatorCache = new ThreadLocal<Map<String, Map<String, OperationResourceInfoComparator>>>() {
+
+        @Override
+        public Map<String, Map<String, OperationResourceInfoComparator>> initialValue() {
+            return new LinkedHashMap<String, Map<String, OperationResourceInfoComparator>>(
+                    16, 0.75f, true) {
+                private static final long serialVersionUID = 3802888905777490396L;
+
+                @Override
+                protected boolean removeEldestEntry(Map.Entry<String, Map<String, OperationResourceInfoComparator>> eldestEntry) {
+                    return size() > cacheSize;
+                }
+            };
+        }
+    };
+
+    public static OperationResourceInfoComparator getInstance(MediaType requestMediaType, MediaType acceptMediaType) {
+        MediaType reqMT = (requestMediaType == null) ? MediaType.WILDCARD_TYPE
+                : requestMediaType;
+        MediaType acceptMT = (acceptMediaType == null) ? MediaType.WILDCARD_TYPE
+                : acceptMediaType;
+        String reqMTStr = reqMT.toString();
+        String acceptMTStr = acceptMT.toString();
+
+        Map<String, Map<String, OperationResourceInfoComparator>> cache = comparatorCache
+                .get();
+        Map<String, OperationResourceInfoComparator> acceptCache = cache.get(reqMTStr);
+        if (acceptCache == null) {
+            cache.put(
+                    reqMTStr,
+                    new LinkedHashMap<String, OperationResourceInfoComparator>(
+                            16, 0.75f, true) {
+                        private static final long serialVersionUID = 3802888905777490396L;
+
+                        @Override
+                        protected boolean removeEldestEntry(Map.Entry<String, OperationResourceInfoComparator> eldestEntry) {
+                            return size() > cacheSize;
+                        }
+                    });
+            acceptCache = cache.get(reqMTStr);
+        }
+
+        OperationResourceInfoComparator comparator = acceptCache
+                .get(acceptMTStr);
+        if (comparator == null) {
+            acceptCache.put(acceptMTStr, new OperationResourceInfoComparator(
+                    reqMT, acceptMT));
+            comparator = acceptCache.get(acceptMTStr);
+        }
+        return comparator;
+    }
+
+    final private MediaType acceptMT;
+
+    final private MediaType requestMT;
+
+    public OperationResourceInfoComparator(MediaType requestMT, MediaType acceptMT) {
+        this.requestMT = requestMT;
+        this.acceptMT = acceptMT;
+    }
 
     public int compare(OperationResourceInfo e1, OperationResourceInfo e2) {
 
         // take care of the cases when we have both HEAD and GET operations
         // since the GET can serve HEAD requests
-        if (HttpMethod.GET.equalsIgnoreCase(e1.getHttpMethod())
-                && HttpMethod.HEAD.equalsIgnoreCase(e2.getHttpMethod())) {
+        String e1HttpMethod = e1.getHttpMethod();
+        String e2HttpMethod = e2.getHttpMethod();
+        if (HttpMethod.GET.equals(e1HttpMethod)
+                && HttpMethod.HEAD.equals(e2HttpMethod)) {
             return 1;
         }
 
-        if (HttpMethod.HEAD.equalsIgnoreCase(e1.getHttpMethod())
-                && HttpMethod.GET.equalsIgnoreCase(e2.getHttpMethod())) {
+        if (HttpMethod.HEAD.equals(e1HttpMethod)
+                && HttpMethod.GET.equals(e2HttpMethod)) {
             return -1;
         }
 
-        if (e1.getHttpMethod() != null && e2.getHttpMethod() == null
-                || e1.getHttpMethod() == null && e2.getHttpMethod() != null) {
+        if ((e1HttpMethod != null && e2HttpMethod == null)
+                || (e1HttpMethod == null && e2HttpMethod != null)) {
             // subresource method takes precedence over a subresource locator
-            return e1.getHttpMethod() != null ? -1 : 1;
+            return e1HttpMethod != null ? -1 : 1;
         }
 
-        String l1 = e1.getURITemplate().getLiteralChars();
-        String l2 = e2.getURITemplate().getLiteralChars();
+        URITemplate e1URITemplate = e1.getURITemplate();
+        String l1 = e1URITemplate.getLiteralChars();
+        URITemplate e2URITemplate = e2.getURITemplate();
+        String l2 = e2URITemplate.getLiteralChars();
         if (!l1.equals(l2)) {
             // descending order
             return l1.length() < l2.length() ? 1 : -1;
         }
 
-        int g1 = e1.getURITemplate().getNumberOfGroups();
-        int g2 = e2.getURITemplate().getNumberOfGroups();
+        int g1 = e1URITemplate.getNumberOfGroups();
+        int g2 = e2URITemplate.getNumberOfGroups();
         if (g1 != g2) {
             // descending order
             return g1 < g2 ? 1 : -1;
         }
 
-        int ce1 = e1.getURITemplate().getNumberOfGroupsWithCustomExpression();
-        int ce2 = e2.getURITemplate().getNumberOfGroupsWithCustomExpression();
+        int ce1 = e1URITemplate.getNumberOfGroupsWithCustomExpression();
+        int ce2 = e2URITemplate.getNumberOfGroupsWithCustomExpression();
         if (ce1 != ce2) {
             return ce1 < ce2 ? 1 : -1;
         }
 
-        List<MediaType> mimeType1 = e1.getConsumes();
-        List<MediaType> mimeType2 = e2.getConsumes();
+        MediaType mimeType1 = e1
+                .getConsumesTypesMostSpecificCompatibleWithMediaType(requestMT);
+        MediaType mimeType2 = e2
+                .getConsumesTypesMostSpecificCompatibleWithMediaType(requestMT);
+        if (mimeType1 != null && mimeType2 == null) {
+            return 1;
+        } else if (mimeType1 == null && mimeType2 != null) {
+            return -1;
+        }
 
-        int result = JAXRSUtils.compareMediaTypes(mimeType1.get(0), mimeType2
-                .get(0));
+        int result = JAXRSUtils.compareMediaTypes(mimeType1, mimeType2);
         if (result == 0) {
             //use the media type of output data as the secondary key.
-            List<MediaType> mimeTypeP1 = e1.getProduces();
-            List<MediaType> mimeTypeP2 = e2.getProduces();
-            result = JAXRSUtils.compareMediaTypes(mimeTypeP1.get(0), mimeTypeP2
-                    .get(0));
+            MediaType mimeTypeP1 = e1
+                    .getProducesTypesMostSpecificCompatibleWithMediaType(acceptMT);
+            MediaType mimeTypeP2 = e2
+                    .getProducesTypesMostSpecificCompatibleWithMediaType(acceptMT);
+            if (mimeTypeP1 != null && mimeTypeP2 == null) {
+                return 1;
+            } else if (mimeTypeP1 == null && mimeTypeP2 != null) {
+                return -1;
+            }
+            result = JAXRSUtils.compareMediaTypes(mimeTypeP1, mimeTypeP2);
         }
 
         return result;

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ProviderInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ProviderInfo.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ProviderInfo.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ProviderInfo.java Sat Jun 27 00:02:26 2009
@@ -57,6 +57,18 @@
      */
     public List<MediaType> getProducesTypes();
 
+    public boolean isMediaTypeCompatibleWithProduces(MediaType aMediaType);
+
+    public boolean isMediaTypeCompatibleWithConsumes(MediaType aMediaType);
+
+    public List<MediaType> getProducesTypesIntersectedWithMediaType(MediaType aMediaType);
+
+    public List<MediaType> getConsumesTypesIntersectedWithMediaType(MediaType aMediaType);
+
+    public MediaType getConsumesTypesMostSpecificCompatibleWithMediaType(MediaType aMediaType);
+
+    public MediaType getProducesTypesMostSpecificCompatibleWithMediaType(MediaType aMediaType);
+
     /**
      * This method will return a list of enums that convey the types that are
      * implemented by the class annotated with @Provider.
@@ -66,6 +78,8 @@
 
     public Map<Type, java.lang.reflect.Type> getParameterizedType();
 
+    public boolean isParameterizedTypeCompatible(Type providerType, java.lang.reflect.Type genericType);
+
     public boolean isSingleton();
 
     public Object getSingleton();

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/ProviderInfo.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/URITemplate.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/URITemplate.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/URITemplate.java (original)
+++ incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/URITemplate.java Sat Jun 27 00:02:26 2009
@@ -21,18 +21,26 @@
 
 import java.net.URLDecoder;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.PathSegment;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
 public final class URITemplate {
 
+    private static Log log = LogFactory.getLog(URITemplate.class);
+
     public static final String TEMPLATE_PARAMETERS = "jaxrs.template.parameters";
 
     public static final String LIMITED_REGEX_SUFFIX = "(/.*)?";
@@ -47,13 +55,31 @@
     private static final String DEFAULT_PATH_VARIABLE_REGEX = "([^/]+?)";
 
     private final String template;
-    private final List<String> templateVariables = new ArrayList<String>();
-    private final List<String> customTemplateVariables = new ArrayList<String>();
+    private final List<String> templateVariables;
+    //    private final List<String> customTemplateVariables = new ArrayList<String>();
+    private final int numberOfCustomTemplateVariable;
     private final Pattern templateRegexPattern;
     private final String literals;
 
-    public URITemplate(String theTemplate) {
+    final private static int CACHE_SIZE = 32;
+
+    private final ThreadLocal<Map<String, MultivaluedMap<String, String>>> matchingCache = new ThreadLocal<Map<String, MultivaluedMap<String, String>>>() {
+        @Override
+        public Map<String, MultivaluedMap<String, String>> initialValue() {
+            return new LinkedHashMap<String, MultivaluedMap<String, String>>(
+                   CACHE_SIZE, 0.75f, true) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                public boolean removeEldestEntry(Map.Entry<String, MultivaluedMap<String, String>> eldestEntry) {
+                    return size() > CACHE_SIZE;
+                }
+            };
+        }
+    };
 
+    public URITemplate(String theTemplate) {
         this.template = theTemplate;
 
         StringBuilder literalChars = new StringBuilder();
@@ -62,8 +88,10 @@
         // compute a regular expression from URI template
         Matcher matcher = TEMPLATE_NAMES_PATTERN.matcher(template);
         int i = 0;
+        int numberOfCustomTemplateVariableCount = 0;
+        List<String> tempTemplateVariables = new ArrayList<String>();
         while (matcher.find()) {
-            templateVariables.add(matcher.group(1).trim());
+            tempTemplateVariables.add(matcher.group(1).trim());
 
             String substr = escapeCharacters(template.substring(i, matcher
                     .start()));
@@ -74,11 +102,14 @@
                 patternBuilder.append('(');
                 patternBuilder.append(matcher.group(3).trim());
                 patternBuilder.append(')');
-                customTemplateVariables.add(matcher.group(1).trim());
+                ++numberOfCustomTemplateVariableCount;
+                //                customTemplateVariables.add(matcher.group(1).trim());
             } else {
                 patternBuilder.append(DEFAULT_PATH_VARIABLE_REGEX);
             }
         }
+        this.templateVariables = Collections
+                .unmodifiableList(tempTemplateVariables);
         String substr = escapeCharacters(template.substring(i, template
                 .length()));
         literalChars.append(substr);
@@ -94,6 +125,7 @@
         }
         patternBuilder.append(LIMITED_REGEX_SUFFIX);
 
+        this.numberOfCustomTemplateVariable = numberOfCustomTemplateVariableCount;
         templateRegexPattern = Pattern.compile(patternBuilder.toString());
     }
 
@@ -110,7 +142,8 @@
     }
 
     public int getNumberOfGroupsWithCustomExpression() {
-        return customTemplateVariables.size();
+        //        return customTemplateVariables.size();
+        return numberOfCustomTemplateVariable;
     }
 
     private static String escapeCharacters(String expression) {
@@ -127,57 +160,54 @@
         return '.' == ch;
     }
 
-    public boolean match(String uri, MultivaluedMap<String, String> templateVariableToValue) {
-
-        if (uri == null) {
-            return (templateRegexPattern == null) ? true : false;
-        }
-
-        if (templateRegexPattern == null) {
-            return false;
-        }
-
-        // if we can, we need to decode the URI, this will help in cases
-        // where parts of the literal path have been encoded
-        String uriDecoded = null;
-        try {
-            uriDecoded = URLDecoder.decode(uri, "UTF-8");
-        } catch (Exception e) {
-            e.printStackTrace();
+    public MultivaluedMap<String, String> match(String uri) {
+        final String finalURI = (uri == null) ? "" : uri;
+        Map<String, MultivaluedMap<String, String>> cache = matchingCache.get();
+        MultivaluedMap<String, String> retMap = cache.get(uri);
+        if (retMap != null) {
+            return retMap;
         }
 
-        Matcher m = templateRegexPattern.matcher(uri);
+        Matcher m = templateRegexPattern.matcher(finalURI);
         if (!m.matches()) {
+            // if we can, we need to decode the URI, this will help in cases
+            // where parts of the literal path have been encoded
+            String uriDecoded = null;
+            try {
+                uriDecoded = URLDecoder.decode(finalURI, "UTF-8");
+            } catch (Exception e) {
+                log.debug("Could not decode URI", e);
+            }
 
             // first check against the decoded version
             if (uriDecoded != null) {
                 m = templateRegexPattern.matcher(uriDecoded);
-            }
 
-            // now handle matrix parameters in the path
-            if (!m.matches() && uri.contains(";")) {
-                m = templateRegexPattern.matcher(handleMatrixParams(uri));
-
-                // if it still doesn't match, let's try it on the
-                // decoded URI value
-                if (!m.matches() && uriDecoded != null) {
-                    uriDecoded = handleMatrixParams(uriDecoded);
-                    m = templateRegexPattern.matcher(uriDecoded);
-                    if (!m.matches()) {
-                        return false;
+                // now handle matrix parameters in the path
+                if (!m.matches()) {
+                    if (finalURI.contains(";")) {
+                        m = templateRegexPattern
+                                .matcher(handleMatrixParams(finalURI));
+
+                        // if it still doesn't match, let's try it on the
+                        // decoded URI value
+                        if (!m.matches()) {
+                            uriDecoded = handleMatrixParams(uriDecoded);
+                            m = templateRegexPattern.matcher(uriDecoded);
+                            if (!m.matches()) {
+                                return null;
+                            }
+                        }
+                    } else {
+                        return null;
                     }
-                } else if (!m.matches()) {
-                    return false;
                 }
-            } else if (!m.matches()) {
-                return false;
+            } else {
+                return null;
             }
         }
 
-        if (!m.matches()) {
-            return false;
-        }
-
+        MultivaluedMap<String, String> templateVariableToValue = new MetadataMap<String, String>();
         // Assign the matched template values to template variables
         int i = 1;
         for (String name : templateVariables) {
@@ -191,7 +221,9 @@
         templateVariableToValue.putSingle(FINAL_MATCH_GROUP,
                 finalGroup == null ? "/" : finalGroup);
 
-        return true;
+        cache.put(uri, templateVariableToValue);
+
+        return templateVariableToValue;
     }
 
     /**
@@ -199,7 +231,6 @@
      * within a request URI.
      */
     String handleMatrixParams(String uri) {
-
         // we might be trying to match one or few path segments containing matrix
         // parameters against a clear path segment as in @Path("base").
         List<PathSegment> pList = JAXRSUtils.getPathSegments(template, false);
@@ -217,8 +248,7 @@
         return sb.toString();
     }
 
-    public static URITemplate createTemplate(ClassResourceInfo cri, String pathValue) {
-
+    public static URITemplate createTemplate(String pathValue) {
         if (pathValue == null) {
             return new URITemplate("/");
         }

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/model/URITemplate.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomEntryProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomEntryProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomEntryProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomFeedProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomFeedProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/AtomFeedProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java?rev=788908&r1=788907&r2=788908&view=diff
==============================================================================
    (empty)

Propchange: incubator/wink/contrib/ibm-jaxrs/src/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message