cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1034035 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils: AnnotationUtils.java Messages.properties
Date Thu, 11 Nov 2010 18:44:12 GMT
Author: sergeyb
Date: Thu Nov 11 18:44:12 2010
New Revision: 1034035

URL: http://svn.apache.org/viewvc?rev=1034035&view=rev
Log:
Making sure no servlet api is strictly required on the client side

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java?rev=1034035&r1=1034034&r2=1034035&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
Thu Nov 11 18:44:12 2010
@@ -22,7 +22,9 @@ package org.apache.cxf.jaxrs.utils;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.HashSet;
+import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.logging.Logger;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -47,10 +49,15 @@ import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.ContextResolver;
 import javax.ws.rs.ext.Providers;
 
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 
 public final class AnnotationUtils {
     
+    private static final Logger LOG = LogUtils.getL7dLogger(AnnotationUtils.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AnnotationUtils.class);
+
     private static final Set<Class> CONTEXT_CLASSES;
     private static final Set<Class> PARAM_ANNOTATION_CLASSES;
     private static final Set<Class> METHOD_ANNOTATION_CLASSES;
@@ -73,10 +80,19 @@ public final class AnnotationUtils {
         classes.add(ContextResolver.class);
         classes.add(Providers.class);
         classes.add(Request.class);
-        classes.add(HttpServletRequest.class);
-        classes.add(HttpServletResponse.class);
-        classes.add(ServletConfig.class);
-        classes.add(ServletContext.class);
+        // Servlet API
+        try {
+            classes.add(HttpServletRequest.class);
+            classes.add(HttpServletResponse.class);
+            classes.add(ServletConfig.class);
+            classes.add(ServletContext.class);
+        } catch (Exception ex) {
+            // it is not a problem on the client side and the exception will be
+            // thrown later on if the injection of one of these contexts will be 
+            // attempted on the server side
+            LOG.fine(new org.apache.cxf.common.i18n.Message("NO_SERVLET_API", 
+                                                            BUNDLE).toString());
+        }
         // CXF-specific
         classes.add(MessageContext.class);
         return classes;

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties?rev=1034035&r1=1034034&r2=1034035&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
Thu Nov 11 18:44:12 2010
@@ -18,6 +18,7 @@
 #    under the License.
 #
 #
+NO_SERVLET_API=No Java Servlet API is available on the runtime classpath
 NO_RESOURCE_OP_EXC=No resource methods have been found for resource class {0}
 GET_INSTEAD_OF_HEAD=Resource class {0} does not support HEAD http method, method {1} supporting
GET http method will be invoked
 NO_CONTENT_TYPE_SPECIFIED=No Content-Type specified for HTTP {0}



Mime
View raw message