MR respin changes, mainly additions for Servlet 3 pluggability.

svn path=/trunk/; revision=575
diff --git a/src/jsr311-api/pom.xml b/src/jsr311-api/pom.xml
index 934afd3..a44c1cd 100644
--- a/src/jsr311-api/pom.xml
+++ b/src/jsr311-api/pom.xml
@@ -5,7 +5,7 @@
   <groupId>javax.ws.rs</groupId>
   <artifactId>jsr311-api</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.1-ea-SNAPSHOT</version>
   <name>jsr311-api</name>
   <url>https://jsr311.dev.java.net</url>
 
diff --git a/src/jsr311-api/src/javax/ws/rs/ApplicationPath.java b/src/jsr311-api/src/javax/ws/rs/ApplicationPath.java
new file mode 100644
index 0000000..6038130
--- /dev/null
+++ b/src/jsr311-api/src/javax/ws/rs/ApplicationPath.java
@@ -0,0 +1,55 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License").  You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * http://www.opensource.org/licenses/cddl1.php
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+/*
+ * ApplicationPath.java
+ *
+ * Created on August 21, 2009
+ *
+ */
+
+package javax.ws.rs;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Identifies the application path that serves as the base URI
+ * for all resource URIs provided by {@link javax.ws.rs.Path}. May only be
+ * applied to a subclass of {@link javax.ws.rs.core.Application}.
+ *
+ * <p>When published in a Servlet container, the value of the application path
+ * may be overridden using a servlet-mapping element in the web.xml.</p>
+ *
+ * @see javax.ws.rs.core.Application
+ * @see Path
+ * @since 1.1
+ */
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ApplicationPath {
+    /**
+     * Defines the base URI for all resource URIs. A trailing '/' character will
+     * be automatically appended if one is not present.
+     *
+     * <p>The supplied value is automatically percent
+     * encoded to conform to the {@code path} production of
+     * {@link <a href="http://tools.ietf.org/html/rfc3986#section-3.3">RFC 3986 section 3.3</a>}.
+     * Note that percent encoded values are allowed in the value, an
+     * implementation will recognize such values and will not double
+     * encode the '%' character.</p>
+     */
+    String value();
+
+}
diff --git a/src/jsr311-api/src/javax/ws/rs/Path.java b/src/jsr311-api/src/javax/ws/rs/Path.java
index 9ebe736..a8a8b09 100644
--- a/src/jsr311-api/src/javax/ws/rs/Path.java
+++ b/src/jsr311-api/src/javax/ws/rs/Path.java
@@ -29,7 +29,8 @@
  * requests for.
  *
  * <p>Paths are relative. For an annotated class the base URI is the 
- * application context. For an annotated method the base URI is the
+ * application path, see {@link javax.ws.rs.ApplicationPath}. For an annotated
+ * method the base URI is the
  * effective URI of the containing class. For the purposes of absolutizing a
  * path against the base URI , a leading '/' in a path is 
  * ignored and base URIs are treated as if they ended in '/'. E.g.:</p>
@@ -43,10 +44,11 @@
  *  String getWidget(&#64;PathParam("id") String id) {...}
  *}</pre>
  * 
- * <p>In the above, if the application context is 
- * <code>http://example.com/catalogue</code>, then <code>GET</code> reguests for
+ * <p>In the above, if the application path is
+ * <code>catalogue</code> and the application is deployed at
+ * <code>http://example.com/</code>, then <code>GET</code> requests for
  * <code>http://example.com/catalogue/widgets</code> will be handled by the
- * <code>getList</code> method while reguests for
+ * <code>getList</code> method while requests for
  * <code>http://example.com/catalogue/widgets/<i>nnn</i></code> (where 
  * <code><i>nnn</i></code> is some value) will be handled by the
  * <code>getWidget</code> method. The same would apply if the value of either
diff --git a/src/jsr311-api/src/javax/ws/rs/core/Application.java b/src/jsr311-api/src/javax/ws/rs/core/Application.java
index b03f1d7..e5c3340 100644
--- a/src/jsr311-api/src/javax/ws/rs/core/Application.java
+++ b/src/jsr311-api/src/javax/ws/rs/core/Application.java
@@ -19,10 +19,15 @@
  * Defines the components of a JAX-RS application and supplies additional
  * metadata. A JAX-RS application or implementation supplies a concrete
  * subclass of this abstract class.
+ *
+ * <p>The implementation-created instance of an Application subclass may be
+ * injected into resource classes and providers using
+ * {@link javax.ws.rs.core.Context}.<p>
  * 
  */
-public abstract class Application {
-    private static final Set<Object> emptySet = Collections.emptySet();
+public class Application {
+    private static final Set<Object> emptyObjectSet = Collections.emptySet();
+    private static final Set<Class<?>> emptyClassSet = Collections.emptySet();
     
     /**
      * Get a set of root resource and provider classes. The default lifecycle
@@ -35,10 +40,14 @@
      * {@link #getSingletons()} returns an instance. Implementations MUST
      * NOT modify the returned set.</p>
      * 
+     * <p>The default implementation returns an empty set.</p>
+     *
      * @return a set of root resource and provider classes. Returning null
      * is equivalent to returning an empty set.
      */
-    public abstract Set<Class<?>> getClasses();
+    public Set<Class<?>> getClasses() {
+        return emptyClassSet;
+    }
     
     /**
      * Get a set of root resource and provider instances. Fields and properties
@@ -57,7 +66,7 @@
      * is equivalent to returning an empty set.
      */
     public Set<Object> getSingletons() {
-        return emptySet;
+        return emptyObjectSet;
     }
     
 }
diff --git a/src/jsr311-api/src/javax/ws/rs/core/Context.java b/src/jsr311-api/src/javax/ws/rs/core/Context.java
index c6ece88..953823c 100644
--- a/src/jsr311-api/src/javax/ws/rs/core/Context.java
+++ b/src/jsr311-api/src/javax/ws/rs/core/Context.java
@@ -28,6 +28,7 @@
 /**
  * This annotation is used to inject information into a class
  * field, bean property or method parameter.
+ * @see Application
  * @see UriInfo
  * @see Request
  * @see HttpHeaders