Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java?rev=1660344&r1=1660343&r2=1660344&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java Tue Feb 17 10:32:22 2015 @@ -18,6 +18,7 @@ */ package org.apache.sling.api.servlets; +import javax.annotation.Nonnull; import javax.servlet.Servlet; import org.apache.sling.api.SlingHttpServletRequest; @@ -62,7 +63,7 @@ public interface ServletResolver { * request or if no servlet could be resolved to handle the * request. */ - Servlet resolveServlet(SlingHttpServletRequest request); + @Nonnull Servlet resolveServlet(@Nonnull SlingHttpServletRequest request); /** * Resolves a <code>javax.servlet.Servlet</code> whose @@ -90,7 +91,7 @@ public interface ServletResolver { * request. * @since 2.1 (Sling API Bundle 2.1.0) */ - Servlet resolveServlet(Resource resource, String scriptName); + @Nonnull Servlet resolveServlet(@Nonnull Resource resource, @Nonnull String scriptName); /** * Resolves a <code>javax.servlet.Servlet</code> whose @@ -117,6 +118,6 @@ public interface ServletResolver { * request. * @since 2.1 (Sling API Bundle 2.1.0) */ - Servlet resolveServlet(ResourceResolver resolver, String scriptName); + @Nonnull Servlet resolveServlet(@Nonnull ResourceResolver resolver, @Nonnull String scriptName); }
Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java?rev=1660344&r1=1660343&r2=1660344&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java Tue Feb 17 10:32:22 2015 @@ -20,6 +20,7 @@ import java.io.IOException; import java.lang.reflect.Method; import java.util.Map; +import javax.annotation.Nonnull; import javax.servlet.ServletException; import org.apache.sling.api.SlingHttpServletRequest; @@ -60,8 +61,8 @@ public class SlingAllMethodsServlet exte * client. */ @SuppressWarnings("unused") - protected void doPost(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doPost(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { handleMethodNotImplemented(request, response); } @@ -84,8 +85,8 @@ public class SlingAllMethodsServlet exte * client. */ @SuppressWarnings("unused") - protected void doPut(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doPut(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { handleMethodNotImplemented(request, response); } @@ -108,8 +109,8 @@ public class SlingAllMethodsServlet exte * client. */ @SuppressWarnings("unused") - protected void doDelete(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doDelete(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { handleMethodNotImplemented(request, response); } @@ -131,8 +132,8 @@ public class SlingAllMethodsServlet exte * @throws ServletException Forwarded from any of the dispatched methods * @throws IOException Forwarded from any of the dispatched methods */ - protected boolean mayService(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected boolean mayService(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { // assume the method is known for now @@ -175,8 +176,8 @@ public class SlingAllMethodsServlet exte * @return A <code>StringBuffer</code> containing the list of HTTP methods * supported. */ - protected StringBuffer getAllowedRequestMethods( - Map<String, Method> declaredMethods) { + protected @Nonnull StringBuffer getAllowedRequestMethods( + @Nonnull Map<String, Method> declaredMethods) { StringBuffer allowBuf = super.getAllowedRequestMethods(declaredMethods); // add more method names depending on the methods found Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java?rev=1660344&r1=1660343&r2=1660344&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java Tue Feb 17 10:32:22 2015 @@ -26,6 +26,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nonnull; import javax.servlet.GenericServlet; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; @@ -89,8 +90,8 @@ public class SlingSafeMethodsServlet ext * {@link #doGet(SlingHttpServletRequest, SlingHttpServletResponse)} * method called by this implementation. */ - protected void doHead(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doHead(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { // the null-output wrapper @@ -121,8 +122,8 @@ public class SlingSafeMethodsServlet ext * client. */ @SuppressWarnings("unused") - protected void doGet(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doGet(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { handleMethodNotImplemented(request, response); } @@ -146,8 +147,8 @@ public class SlingSafeMethodsServlet ext * @throws IOException Not thrown by this implementation. */ @SuppressWarnings("unused") - protected void doOptions(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doOptions(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { Map<String, Method> methods = getAllDeclaredMethods(getClass()); StringBuffer allowBuf = getAllowedRequestMethods(methods); @@ -169,8 +170,8 @@ public class SlingSafeMethodsServlet ext * request headers in the response stream. */ @SuppressWarnings("unused") - protected void doTrace(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doTrace(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { String CRLF = "\r\n"; @@ -226,8 +227,8 @@ public class SlingSafeMethodsServlet ext * client. */ @SuppressWarnings("unused") - protected void doGeneric(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void doGeneric(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { handleMethodNotImplemented(request, response); } @@ -254,8 +255,8 @@ public class SlingSafeMethodsServlet ext * @throws ServletException Forwarded from any of the dispatched methods * @throws IOException Forwarded from any of the dispatched methods */ - protected boolean mayService(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected boolean mayService(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { // assume the method is known for now @@ -290,8 +291,8 @@ public class SlingSafeMethodsServlet ext * @param response The HTTP response to which the error status is sent. * @throws IOException Thrown if the status cannot be sent to the client. */ - protected void handleMethodNotImplemented(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws IOException { + protected void handleMethodNotImplemented(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws IOException { String protocol = request.getProtocol(); String msg = "Method " + request.getMethod() + " not supported"; @@ -336,8 +337,8 @@ public class SlingSafeMethodsServlet ext * {@link #doGeneric(SlingHttpServletRequest, SlingHttpServletResponse)} * methods. */ - protected void service(SlingHttpServletRequest request, - SlingHttpServletResponse response) throws ServletException, + protected void service(@Nonnull SlingHttpServletRequest request, + @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { // first try to handle the request by the known methods @@ -366,7 +367,7 @@ public class SlingSafeMethodsServlet ext * {@link #service(SlingHttpServletRequest, SlingHttpServletResponse)} * called. */ - public void service(ServletRequest req, ServletResponse res) + public void service(@Nonnull ServletRequest req, @Nonnull ServletResponse res) throws ServletException, IOException { if ((req instanceof SlingHttpServletRequest) @@ -386,7 +387,7 @@ public class SlingSafeMethodsServlet ext * Returns the simple class name of this servlet class. Extensions of this * class may overwrite to return more specific information. */ - public String getServletInfo() { + public @Nonnull String getServletInfo() { return getClass().getSimpleName(); } Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/package-info.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/package-info.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/package-info.java Tue Feb 17 10:32:22 2015 @@ -17,7 +17,7 @@ * under the License. */ -@Version("2.1") +@Version("2.1.1") package org.apache.sling.api.servlets; import aQute.bnd.annotation.Version;
