incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r581158 - in /incubator/sling/trunk/sling-api: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/resources/ src/main/resources/META-INF/
Date Tue, 02 Oct 2007 08:45:51 GMT
Author: fmeschbe
Date: Tue Oct  2 01:45:49 2007
New Revision: 581158

URL: http://svn.apache.org/viewvc?rev=581158&view=rev
Log:
Simplify the Sling (aka Component) API

Added:
    incubator/sling/trunk/sling-api/   (with props)
    incubator/sling/trunk/sling-api/pom.xml   (with props)
    incubator/sling/trunk/sling-api/src/
    incubator/sling/trunk/sling-api/src/main/
    incubator/sling/trunk/sling-api/src/main/java/
    incubator/sling/trunk/sling-api/src/main/java/org/
    incubator/sling/trunk/sling-api/src/main/java/org/apache/
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java   (with props)
    incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java   (with props)
    incubator/sling/trunk/sling-api/src/main/resources/
    incubator/sling/trunk/sling-api/src/main/resources/META-INF/
    incubator/sling/trunk/sling-api/src/main/resources/META-INF/LICENSE
    incubator/sling/trunk/sling-api/src/main/resources/META-INF/NOTICE

Propchange: incubator/sling/trunk/sling-api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct  2 01:45:49 2007
@@ -0,0 +1,3 @@
+.classpath
+.project
+target

Added: incubator/sling/trunk/sling-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/pom.xml?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/pom.xml (added)
+++ incubator/sling/trunk/sling-api/pom.xml Tue Oct  2 01:45:49 2007
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>1-incubator-SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>sling-api</artifactId>
+    <version>2.0.0-incubator-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Sling - Servlet Extension API</name>
+    <description>
+        The Sling API defines an extension to the Serlvet API 2.4 to
+        provide access to content and unified access to request
+        parameters hiding the differences between the different methods
+        of transferring parameters from client to server. Note that the
+        Sling API bundle does not include the Serlvet API but instead
+        requires the API to be provided by the Servlet container in
+        which the Sling framework is running or by another bundle.
+    </description>
+
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/sling-api
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/sling-api
+        </developerConnection>
+        <url>
+            http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api
+        </url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Create the mapping file for the Content interface -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-jcrocm-plugin</artifactId>
+            </plugin>
+
+            <!-- Support to install in Sling instances and deploy to Sling OBR -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-sling-plugin</artifactId>
+            </plugin>
+
+            <!-- Create the bundle of the Sling API -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-DocURL>
+                            http://incubator.apache.org/sling/site/component-api.html
+                        </Bundle-DocURL>
+                        <Export-Package>
+                            org.apache.sling;version=${pom.version}
+                        </Export-Package>
+                        <!-- Require explicite version of the servlet API -->
+                        <Import-Package>
+                            javax.servlet.*;version=2.4,*
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: incubator/sling/trunk/sling-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+/**
+ * The <code>Constants</code> interface provides some symbolic constants for
+ * well known constant strings in Sling. Even though these constants will never
+ * change, it is recommended that applications refer to the symbolic constants
+ * instead of code the strings themselves.
+ */
+public interface Constants {
+
+    /**
+     * The name of the request attribute containing the <code>Servlet</code>
+     * which included the servlet currently being active (value is
+     * "org.apache.sling.include.servlet"). This attribute is <code>null</code>
+     * if the current servlet is the servlet handling the client request.
+     * <p>
+     * The type of the attribute value is <code>javax.jcr.servlet</code>.
+     */
+    public static final String ATTR_REQUEST_SERVLET = "org.apache.sling.include.servlet";
+
+    /**
+     * The name of the request attribute containing the <code>Content</code>
+     * underlying the <code>Servlet</code> which included the servlet
+     * currently being active (value is "org.apache.sling.include.content").
+     * This attribute is <code>null</code> if the current servlet is the
+     * servlet handling the client request.
+     * <p>
+     * The type of the attribute value is <code>org.apache.sling.Content</code>.
+     */
+    public static final String ATTR_REQUEST_CONTENT = "org.apache.sling.include.content";
+
+    /**
+     * The name of the request attribute containing request context path if
+     * Sling (the Sling Servlet actually) is called by the servlet containing as
+     * a result of a standard Servlet request include (value is
+     * "javax.servlet.include.context_path"). Sling never sets this attribute.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>. This
+     * attribute corresponds to the
+     * <code>HttpServletRequest.getContextPath()</code>.
+     */
+    public static final String INCLUDE_CONTEXT_PATH = "javax.servlet.include.context_path";
+
+    /**
+     * The name of the request attribute containing request path info if Sling
+     * (the Sling Servlet actually) is called by the servlet containing as a
+     * result of a standard Servlet request include (value is
+     * "javax.servlet.include.path_info"). Sling never sets this attribute.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>. This
+     * attribute corresponds to the
+     * <code>HttpServletRequest.getPathInfo()</code>.
+     */
+    public static final String INCLUDE_PATH_INFO = "javax.servlet.include.path_info";
+
+    /**
+     * The name of the request attribute containing request query string if
+     * Sling (the Sling Servlet actually) is called by the servlet containing as
+     * a result of a standard Servlet request include (value is
+     * "javax.servlet.include.query_string"). Sling never sets this attribute.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>. This
+     * attribute corresponds to the
+     * <code>HttpServletRequest.getQueryString()</code>.
+     */
+    public static final String INCLUDE_QUERY_STRING = "javax.servlet.include.query_string";
+
+    /**
+     * The name of the request attribute containing request uri if Sling (the
+     * Sling Servlet actually) is called by the servlet containing as a result
+     * of a standard Servlet request include (value is
+     * "javax.servlet.include.request_uri"). Sling never sets this attribute.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>. This
+     * attribute corresponds to the
+     * <code>HttpServletRequest.getRequestURI()</code>.
+     */
+    public static final String INCLUDE_REQUEST_URI = "javax.servlet.include.request_uri";
+
+    /**
+     * The name of the request attribute containing servlet path if Sling (the
+     * Sling Servlet actually) is called by the servlet containing as a result
+     * of a standard Servlet request include (value is
+     * "javax.servlet.include.servlet_path"). Sling never sets this attribute.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>. This
+     * attribute corresponds to the
+     * <code>HttpServletRequest.getServletPath()</code>.
+     */
+    public static final String INCLUDE_SERVLET_PATH = "javax.servlet.include.servlet_path";
+
+    // ---------- Error handling -----------------------------------------------
+
+    /**
+     * The name of the request attribute containing the exception thrown causing
+     * the error handler to be called (value is
+     * "javax.servlet.error.exception"). This attribute is only available to
+     * error handling servlets and only if an exception has been thrown causing
+     * error handling.
+     * <p>
+     * The type of the attribute value is <code>java.lang.Throwable</code>.
+     */
+    public static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
+
+    /**
+     * The name of the request attribute containing the fully qualified class
+     * name of the exception thrown causing the error handler to be called
+     * (value is "javax.servlet.error.exception_type"). This attribute is only
+     * available to error handling servlets and only if an exception has been
+     * thrown causing error handling. This attribute is present for backwards
+     * compatibility only. Error handling servlet implementors are advised to
+     * use the {@link #ERROR_EXCEPTION Throwable} itself.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>.
+     */
+    public static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
+
+    /**
+     * The name of the request attribute containing the message of the error
+     * situation (value is "javax.servlet.error.message"). If an exception
+     * caused error handling, this is the exceptions message from
+     * <code>Throwable.getMessage()</code>. If error handling is caused by a
+     * call to one of the <code>SlingResponse.sendError</code> methods, this
+     * attribute contains the optional message.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>.
+     */
+    public static final String ERROR_MESSAGE = "javax.servlet.error.message";
+
+    /**
+     * The name of the request attribute containing the URL requested by the
+     * client during whose processing the error handling was caused (value is
+     * "javax.servlet.error.request_uri"). This property is retrieved calling
+     * the <code>SlingRequest.getRequestURI()</code> method.
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>.
+     */
+    public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
+
+    /**
+     * The name of the request attribute containing the name of the servlet
+     * which caused the error handling (value is
+     * "javax.servlet.error.servlet_name").
+     * <p>
+     * The type of the attribute value is <code>java.lang.String</code>.
+     */
+    public static final String ERROR_SERVLET_NAME = "javax.servlet.error.servlet_name";
+
+    /**
+     * The name of the request attribute containing the status code sent to the
+     * client (value is "javax.servlet.error.status_code"). Error handling
+     * servlets may set this status code on their response to the client or they
+     * may choose to set another status code. For example a handler for
+     * NOT_FOUND status (404) may opt to redirect to a new location and thus not
+     * set the 404 status but a MOVED_PERMANENTLY (301) status. If this
+     * attribute is not set and the error handler is not configured to set its
+     * own status code anyway, a default value of INTERNAL_SERVER_ERROR (500)
+     * should be sent.
+     * <p>
+     * The type of the attribute value is <code>java.lang.Integer</code>.
+     */
+    public static final String ERROR_STATUS = "javax.servlet.error.status_code";
+
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+/**
+ * The <code>Content</code> interface defines the API to be implemented by all
+ * content to be acted upon by the Sling framework.
+ *
+ * @ocm.mapped discriminator="false"
+ */
+public interface Content {
+
+    /**
+     * Returns the name of the servlet responsible for the handling and
+     * presentation of this content object. This method must never return
+     * <code>null</code>.
+     *
+     * @return the name of the handling Servlet.
+     */
+    String getServletName();
+
+    /**
+     * Returns the path of this content object in the persistence layer from
+     * where the object has been loaded.
+     */
+    String getPath();
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/Content.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * The <code>RequestParameter</code> class represents a single parameter sent
+ * with the client request. Instances of this class are returned by the
+ * {@link SlingRequest#getRequestParameter(String)},
+ * {@link SlingRequest#getRequestParameters(String)} and
+ * {@link SlingRequest#getRequestParameterMap()} method.
+ * 
+ * @see SlingRequest#getRequestParameter(String)
+ * @see SlingRequest#getRequestParameters(String)
+ * @see SlingRequest#getRequestParameterMap()
+ */
+public interface RequestParameter {
+
+    /**
+     * Determines whether or not this instance represents a simple form field or
+     * an uploaded file.
+     * 
+     * @return <code>true</code> if the instance represents a simple form
+     *         field; <code>false</code> if it represents an uploaded file.
+     */
+    boolean isFormField();
+
+    /**
+     * Returns the content type passed by the browser or <code>null</code> if
+     * not defined.
+     * 
+     * @return The content type passed by the browser or <code>null</code> if
+     *         not defined.
+     */
+    String getContentType();
+
+    /**
+     * Returns the size in bytes of the parameter.
+     * 
+     * @return The size in bytes of the parameter.
+     */
+    long getSize();
+
+    /**
+     * Returns the contents of the parameter as an array of bytes.
+     * 
+     * @return The contents of the parameter as an array of bytes.
+     */
+    byte[] get();
+
+    /**
+     * Returns an InputStream that can be used to retrieve the contents of the
+     * file.
+     * 
+     * @return An InputStream that can be used to retrieve the contents of the
+     *         file.
+     * @throws IOException if an error occurs.
+     */
+    InputStream getInputStream() throws IOException;
+
+    /**
+     * Returns the original filename in the client's filesystem, as provided by
+     * the browser (or other client software). In most cases, this will be the
+     * base file name, without path information. However, some clients, such as
+     * the Opera browser, do include path information.
+     * 
+     * @return The original filename in the client's filesystem.
+     */
+    String getFileName();
+
+    /**
+     * Returns the contents of the parameter as a String, using the default
+     * character encoding. This method uses {@link #get()} to retrieve the
+     * contents of the item.
+     * 
+     * @return The contents of the parameter, as a string.
+     */
+    String getString();
+
+    /**
+     * Returns the contents of the parameter as a String, using the specified
+     * encoding. This method uses link {@link #get()} to retrieve the contents
+     * of the item.
+     * 
+     * @param encoding The character encoding to use.
+     * @return The contents of the parameter, as a string.
+     * @throws UnsupportedEncodingException if the requested character encoding
+     *             is not available.
+     */
+    String getString(String encoding) throws UnsupportedEncodingException;
+
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/RequestParameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import javax.servlet.ServletException;
+
+/**
+ * The <code>SlingException</code> class defines a general exception that may
+ * be thrown when unexpected situations occurr while processing requests.
+ */
+public class SlingException extends ServletException {
+
+    /**
+     * Serial Version ID for pre Java2 RMI
+     */
+    private static final long serialVersionUID = -1243027389278210618L;
+
+    /**
+     * Constructs a new Sling exception.
+     */
+    public SlingException() {
+        super();
+    }
+
+    /**
+     * Constructs a new Sling exception with the given text. The Sling framework
+     * may use the text to write it to a log.
+     * 
+     * @param text the exception text
+     */
+    public SlingException(String text) {
+        super(text);
+    }
+
+    /**
+     * Constructs a new Sling exception when the Servlet needs to do the
+     * following:
+     * <ul>
+     * <li>throw an exception
+     * <li>include the "root cause" exception
+     * <li>include a description message
+     * </ul>
+     * 
+     * @param text the exception text
+     * @param cause the root cause
+     */
+    public SlingException(String text, Throwable cause) {
+        super(text, cause);
+    }
+
+    /**
+     * Constructs a new Sling exception when the Servlet needs to throw an
+     * exception. The exception's message is based on the localized message of
+     * the underlying exception.
+     * 
+     * @param cause the root cause
+     */
+    public SlingException(Throwable cause) {
+        super(cause);
+    }
+}
\ No newline at end of file

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * The <code>SlingRequest</code> defines the interface to provide client
+ * request information to a servlet.
+ * <p id="decomp">
+ * <b>Decomposition of a Request URL</b>
+ * <p>
+ * The Sling Framework is responsible to decompose the
+ * {@link #getRequestURI() request URI} into four parts:
+ * <ol>
+ * <li>{@link Content#getPath() content path} - The longest substring of the
+ * request URI resolving to a {@link Content} object such that the content path
+ * is either the complete request URI the next character in the request URI
+ * after the content path is either a dot (<code>.</code>) or a slash (<code>/</code>).
+ * <li>{@link #getSelectors() selectors} - If the first character in the
+ * request URI after the content path is a dot, the string after the dot upto
+ * but not including the last dot before the next slash character or the end of
+ * the request URI. If the content path spans the complete request URI or if a
+ * slash follows the content path in the request, the no seletors exist. If only
+ * one dot follows the content path before the end of the request URI or the
+ * next slash, no selectors exist. The selectors are available as
+ * {@link #getSelectorString() a single string}, an
+ * {@link #getSelectors() array of strings}, which is the selector string
+ * splitted on dots, or
+ * {@link #getSelector(int) selectively by zero-based index}.
+ * <li>{@link #getExtension() extension} - The string after the last dot after
+ * the content path in the request uri but before the end of the request uri or
+ * the next slash after the content path in the request uri. If a slash follows
+ * the content path in the request URI, the extension is empty.
+ * <li>{@link #getSuffix() suffix path} - If the request URI contains more a
+ * slash character after the content path and optional selectors and extension,
+ * the path starting with the slash upto the end of the request URI is the
+ * suffix path.
+ * </ol>
+ * <p>
+ * Examples: <table>
+ * <tr>
+ * <th>URI</th>
+ * <th>Content Path</th>
+ * <th>Selectors</th>
+ * <th>Extension</th>
+ * <th>Suffix</th>
+ * </tr>
+ * <tr>
+ * <td>/a/b</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>""</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.html</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>html</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.html</td>
+ * <td>/a/b</td>
+ * <td>s1</td>
+ * <td>html</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.s2.html</td>
+ * <td>/a/b</td>
+ * <td>s1.s2</td>
+ * <td>html</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b/c/d</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>""</td>
+ * <td>/c/d</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.html/c/d</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>html</td>
+ * <td>/c/d</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.html/c/d</td>
+ * <td>/a/b</td>
+ * <td>s1</td>
+ * <td>html</td>
+ * <td>/c/d</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.s2.html/c/d</td>
+ * <td>/a/b</td>
+ * <td>s1.s2</td>
+ * <td>html</td>
+ * <td>/c/d</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b/c/d.s.txt</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>""</td>
+ * <td>/c/d.s.txt</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.html/c/d.s.txt</td>
+ * <td>/a/b</td>
+ * <td>""</td>
+ * <td>html</td>
+ * <td>/c/d.s.txt</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.html/c/d.s.txt</td>
+ * <td>/a/b</td>
+ * <td>s1</td>
+ * <td>html</td>
+ * <td>/c/d.s.txt</td>
+ * </tr>
+ * <tr>
+ * <td>/a/b.s1.s2.html/c/d.s.txt</td>
+ * <td>/a/b</td>
+ * <td>s1.s2</td>
+ * <td>html</td>
+ * <td>/c/d.s.txt</td>
+ * </tr>
+ * </table>
+ * <p>
+ * <b>Request Parameters</b> Generally request parameters are transmitted as
+ * part of the URL string such as <code>GET /some/path?<b>param=value</b></code>
+ * or as request data of content type <i>application/x-www-form-urlencoded</i>
+ * or <i>multipart/form-data</i>. The Sling Framework must decode parameters
+ * transferred as request data and make them available through the various
+ * parameter accessor methods. Generally parameters transferred as
+ * <i>multipart/form-data</i> will be accessed by one of the methods returning
+ * {@link RequestParameter} instances.
+ * <p>
+ * In any case, the {@link #getReader()} and {@link #getInputStream()} methods
+ * will throw an <code>IllegalStateException</code> if called when the request
+ * content type is either <i>application/x-www-form-urlencoded</i> or
+ * <i>multipart/form-data</i> because the request data has already been
+ * processed.
+ */
+public interface SlingRequest extends HttpServletRequest {
+
+    // ---------- Content Access Methods ---------------------------------------
+
+    /**
+     * Returns the {@link Content} object on whose behalf the servlet acts.
+     *
+     * @return The <code>Content</code> object of this request.
+     */
+    Content getContent();
+
+    /**
+     * Returns a content object for data located at the given path.
+     * <p>
+     * This specification does not define the location for content or the
+     * semantics for content paths. For an implementation reading content from a
+     * Java Content Repository, the path could be a <code>javax.jcr.Item</code>
+     * path from which the content object is loaded.
+     *
+     * @param path The path to the content object to be loaded. If the path is
+     *            relative, i.e. does not start with a slash (<code>/</code>),
+     *            the content relative to this request's content is returned.
+     * @return The <code>Content</code> object loaded from the path or
+     *         <code>null</code> if no content object may be loaded from the
+     *         path.
+     * @throws SlingException If an error occurrs trying to load the content
+     *             object from the path.
+     */
+    Content getContent(String path) throws SlingException;
+
+    /**
+     * Returns an <code>Iterator</code> of {@link Content} objects loaded from
+     * the children of the given <code>content</code>.
+     * <p>
+     * This specification does not define what the term "child" means. This is
+     * left to the implementation to define. For example an implementation
+     * reading content from a Java Content Repository, the children could be the
+     * {@link Content} objects loaded from child items of the
+     * <code>javax.jcr.Item</code> of the given <code>content</code>.
+     *
+     * @param content The {@link Content content object} whose children are
+     *            requested. If <code>null</code> the children of this
+     *            request's content (see {@link #getContent()}) are returned.
+     * @return
+     * @throws SlingException
+     */
+    Enumeration<Content> getChildren(Content content) throws SlingException;
+
+    // ---------- Request URL Information --------------------------------------
+
+    /**
+     * Returns the extension from the URL or an empty string if the request URL
+     * does not contain an extension.
+     * <p>
+     * Decomposition of the request URL is defined in the <a
+     * href="#decomp">Decomposition of a Request URL</a> above.
+     *
+     * @return The extension from the request URL.
+     */
+    String getExtension();
+
+    /**
+     * Returns the i-th selector of the selector string split on dots or
+     * <code>null</code> if i&lt;0 or i&gt;getSelectors().length. Alyways
+     * returns <code>null</code> if the request has no selectors.
+     * <p>
+     * Decomposition of the request URL is defined in the <a
+     * href="#decomp">Decomposition of a Request URL</a> above.
+     *
+     * @param i The index of the selector to return.
+     * @return The value of the selector if 0 &lt;= i &lt;
+     *         <code>getSelectors().length</code> or <code>null</code>
+     *         otherwise.
+     * @see #getSelectorString()
+     * @see #getSelectors()
+     */
+    String getSelector(int i);
+
+    /**
+     * Returns the selectors decoded from the request URL as an array of
+     * strings. This array is derived from the
+     * {@link #getSelectorString() selector string} by splitting the string on
+     * dots. Returns an empty array if the request has no selectors.
+     * <p>
+     * Decomposition of the request URL is defined in the <a
+     * href="#decomp">Decomposition of a Request URL</a> above.
+     *
+     * @see #getSelectorString()
+     * @see #getSelector(int)
+     */
+    String[] getSelectors();
+
+    /**
+     * Returns the selectors decoded from the request URL as string. Returns an
+     * empty string if the request has no selectors.
+     * <p>
+     * Decomposition of the request URL is defined in the <a
+     * href="#decomp">Decomposition of a Request URL</a> above.
+     *
+     * @see #getSelectors()
+     * @see #getSelector(int)
+     */
+    String getSelectorString();
+
+    /**
+     * Returns the suffix part of the URL or an empty string if the request URL
+     * does not contain a suffix.
+     * <p>
+     * Decomposition of the request URL is defined in the <a
+     * href="#decomp">Decomposition of a Request URL</a> above.
+     *
+     * @return The suffix part of the request URL.
+     */
+    String getSuffix();
+
+    // ---------- File oriented POST parameters --------------------------------
+
+    /**
+     * Returns the value of a request parameter as a {@link RequestParameter},
+     * or <code>null</code> if the parameter does not exist.
+     * <p>
+     * This method should only be used if the parameter has only one value. If
+     * the parameter might have more than one value, use
+     * {@link #getRequestParameters(String)}.
+     * <p>
+     * If this method is used with a multivalued parameter, the value returned
+     * is equal to the first value in the array returned by
+     * <code>getRequestParameters</code>.
+     *
+     * @param name a <code>String</code> specifying the name of the parameter
+     * @return a {@link RequestParameter} representing the single value of the
+     *         parameter
+     * @see #getRequestParameters(String)
+     * @throws IllegalArgumentException if name is <code>null</code>.
+     */
+    public RequestParameter getRequestParameter(String name);
+
+    /**
+     * Returns a <code>Map</code> of the parameters of this request.
+     * <p>
+     * The values in the returned <code>Map</code> are from type
+     * {@link RequestParameter} array (<code>RequestParameter[]</code>).
+     * <p>
+     * If no parameters exist this method returns an empty <code>Map</code>.
+     *
+     * @return an immutable <code>Map</code> containing parameter names as
+     *         keys and parameter values as map values, or an empty
+     *         <code>Map</code> if no parameters exist. The keys in the
+     *         parameter map are of type String. The values in the parameter map
+     *         are of type {@link RequestParameter} array (<code>RequestParameter[]</code>).
+     */
+    Map<String, RequestParameter> getRequestParameterMap();
+
+    /**
+     * Returns an array of {@link RequestParameter} objects containing all of
+     * the values the given request parameter has, or <code>null</code> if the
+     * parameter does not exist.
+     * <p>
+     * If the parameter has a single value, the array has a length of 1.
+     *
+     * @param name a <code>String</code> containing the name of the parameter
+     *            the value of which is requested
+     * @return an array of {@link RequestParameter} objects containing the
+     *         parameter values.
+     * @see #getRequestParameter(String)
+     * @throws IllegalArgumentException if name is <code>null</code>.
+     */
+    public RequestParameter[] getRequestParameters(String name);
+
+    // ---------- Request Dispatching ------------------------------------------
+
+    /**
+     * Returns a <code>RequestDispatcher</code> object that acts as a wrapper
+     * for the content located at the given path. A
+     * <code>RequestDispatcher</code> object can be used to include the
+     * resource in a response.
+     * <p>
+     * This method returns <code>null</code> if the
+     * <code>ServletContext</code> cannot return a
+     * <code>RequestDispatcher</code> for any reason.
+     *
+     * @param content The {@link Content} instance whose response content may be
+     *            included by the returned dispatcher.
+     * @return a <code>RequestDispatcher</code> object that acts as a wrapper
+     *         for the <code>content</code> or <code>null</code> if an error
+     *         occurrs preparing the dispatcher.
+     */
+    RequestDispatcher getRequestDispatcher(Content content);
+
+    // --------- Miscellaneous -------------------------------------------------
+
+    /**
+     * Returns the named cookie from the HTTP request or <code>null</code> if
+     * no such cookie exists in the request.
+     *
+     * @param name The name of the cookie to return.
+     * @return The named cookie or <code>null</code> if no such cookie exists.
+     */
+    Cookie getCookie(String name);
+
+    /**
+     * Returns the framework preferred content type for the response.
+     * <p>
+     * The content type only includes the MIME type, not the character set.
+     *
+     * @return preferred MIME type of the response
+     */
+    String getResponseContentType();
+
+    /**
+     * Gets a list of content types which the framework accepts for the
+     * response. This list is ordered with the most preferable types listed
+     * first.
+     * <p>
+     * The content type only includes the MIME type, not the character set.
+     *
+     * @return ordered list of MIME types for the response
+     */
+    Enumeration<String> getResponseContentTypes();
+
+    /**
+     * Returns the resource bundle for the given locale.
+     *
+     * @param locale the locale for which to retrieve the resource bundle. If
+     *            this is <code>null</code>, the locale returned by
+     *            {@link #getLocale()} is used to select the resource bundle.
+     * @return the resource bundle for the given locale
+     */
+    ResourceBundle getResourceBundle(Locale locale);
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * The <code>SlingRequestWrapper</code> class is a default wrapper class
+ * around a {@link SlingRequest} which may be extended to amend the
+ * functionality of the original request object.
+ */
+public class SlingRequestWrapper extends HttpServletRequestWrapper implements
+        SlingRequest {
+
+    public SlingRequestWrapper(SlingRequest delegatee) {
+        super(delegatee);
+    }
+
+    /**
+     * Return the original {@link SlingRequest} object wrapped by this.
+     */
+    public SlingRequest getSlingRequest() {
+        return (SlingRequest) this.getRequest();
+    }
+
+    public Enumeration<Content> getChildren(Content content)
+            throws SlingException {
+        return this.getSlingRequest().getChildren(content);
+    }
+
+    public Content getContent() {
+        return this.getSlingRequest().getContent();
+    }
+
+    public Content getContent(String path) throws SlingException {
+        return this.getSlingRequest().getContent(path);
+    }
+
+    public Cookie getCookie(String name) {
+        return this.getSlingRequest().getCookie(name);
+    }
+
+    public String getExtension() {
+        return this.getSlingRequest().getExtension();
+    }
+
+    public String getLocalAddr() {
+        return this.getSlingRequest().getLocalAddr();
+    }
+
+    public String getLocalName() {
+        return this.getSlingRequest().getLocalName();
+    }
+
+    public int getLocalPort() {
+        return this.getSlingRequest().getLocalPort();
+    }
+
+    public RequestDispatcher getRequestDispatcher(Content content) {
+        return this.getSlingRequest().getRequestDispatcher(content);
+    }
+
+    public RequestParameter getRequestParameter(String name) {
+        return this.getSlingRequest().getRequestParameter(name);
+    }
+
+    public Map<String, RequestParameter> getRequestParameterMap() {
+        return this.getSlingRequest().getRequestParameterMap();
+    }
+
+    public int getRemotePort() {
+        return this.getSlingRequest().getRemotePort();
+    }
+
+    public RequestParameter[] getRequestParameters(String name) {
+        return this.getSlingRequest().getRequestParameters(name);
+    }
+
+    public ResourceBundle getResourceBundle(Locale locale) {
+        return this.getSlingRequest().getResourceBundle(locale);
+    }
+
+    public String getResponseContentType() {
+        return this.getSlingRequest().getResponseContentType();
+    }
+
+    public Enumeration<String> getResponseContentTypes() {
+        return this.getSlingRequest().getResponseContentTypes();
+    }
+
+    public String getSelector(int i) {
+        return this.getSlingRequest().getSelector(i);
+    }
+
+    public String[] getSelectors() {
+        return this.getSlingRequest().getSelectors();
+    }
+
+    public String getSelectorString() {
+        return this.getSlingRequest().getSelectorString();
+    }
+
+    public String getSuffix() {
+        return this.getSlingRequest().getSuffix();
+    }
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingRequestWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * The <code>SlingResponse</code> defines the interface to assist a servlet in
+ * creating and sending a response to the client.
+ */
+public interface SlingResponse extends HttpServletResponse {
+
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * The <code>SlingResponseWrapper</code> class is a default wrapper class
+ * around a {@link SlingResponse} which may be extended to amend the
+ * functionality of the original response object.
+ */
+public class SlingResponseWrapper extends HttpServletResponseWrapper implements
+        SlingResponse {
+
+    public SlingResponseWrapper(SlingResponse delegatee) {
+        super(delegatee);
+    }
+
+    /**
+     * Return the original {@link SlingResponse} object wrapped by this.
+     */
+    public SlingResponse getSlingResponse() {
+        return (SlingResponse) getResponse();
+    }
+
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingResponseWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java (added)
+++ incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java Tue Oct  2 01:45:49 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling;
+
+import java.io.IOException;
+
+import javax.servlet.GenericServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * The <code>SlingServlet</code> is a convenience extension to the Servlet API
+ * <code>GenericServlet</code> which forwards requests to a
+ * {@link #service(SlingRequest, SlingResponse) service} method providing the
+ * request and response objects as {@link SlingRequest} and
+ * {@link SlingResponse} objects respectively.
+ * <p>
+ * Extensions may implement the new service method and make use of the
+ * functionality of the <code>GenericServlet</code>.
+ */
+public abstract class SlingServlet extends GenericServlet {
+
+    public abstract void service(SlingRequest request, SlingResponse response)
+            throws ServletException, IOException;
+
+    @Override
+    public void service(ServletRequest req, ServletResponse res)
+            throws ServletException, IOException {
+        try {
+            service((SlingRequest) req, (SlingResponse) res);
+        } catch (ClassCastException e) {
+            throw new SlingException("Non-Sling request or response");
+        }
+    }
+
+}

Propchange: incubator/sling/trunk/sling-api/src/main/java/org/apache/sling/SlingServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sling-api/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/resources/META-INF/LICENSE?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/resources/META-INF/LICENSE (added)
+++ incubator/sling/trunk/sling-api/src/main/resources/META-INF/LICENSE Tue Oct  2 01:45:49 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Added: incubator/sling/trunk/sling-api/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling-api/src/main/resources/META-INF/NOTICE?rev=581158&view=auto
==============================================================================
--- incubator/sling/trunk/sling-api/src/main/resources/META-INF/NOTICE (added)
+++ incubator/sling/trunk/sling-api/src/main/resources/META-INF/NOTICE Tue Oct  2 01:45:49 2007
@@ -0,0 +1,5 @@
+Apache Sling API
+Copyright 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).



Mime
View raw message