Author: fmeschbe
Date: Sun Dec 23 06:37:02 2007
New Revision: 606559
URL: http://svn.apache.org/viewvc?rev=606559&view=rev
Log:
Make SlingException a RuntimeException and revisit exception throwing
declarations.
Added:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/QuerySyntaxException.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/ScriptEvaluationException.java
Removed:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceNotAvailableException.java
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/HttpStatusCodeException.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/SlingException.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/InvalidServiceFilterSyntaxException.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceLocator.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/wrappers/SlingRequestPaths.java
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/HttpStatusCodeException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/HttpStatusCodeException.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/HttpStatusCodeException.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/HttpStatusCodeException.java
Sun Dec 23 06:37:02 2007
@@ -16,14 +16,20 @@
*/
package org.apache.sling.api;
-import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
/**
- * An Exception that causes Sling to return the specified HTTP status code.
+ * An Exception that causes Sling to return the specified HTTP status code.
This
+ * exception should not be caught but rather let be handed up the call stack up
+ * to the Sling error and exception handling.
+ * <p>
+ * The advantage of using this exception over the
+ * <code>HttpServletResponse.sendError</code> methods is that the request can
+ * be aborted immediately all the way up in the call stack and that in addition
+ * to the status code and an optional message a <code>Throwable</code> may be
+ * supplied providing more information.
*/
-public class HttpStatusCodeException extends IOException {
-
- private static final long serialVersionUID = 1L;
+public class HttpStatusCodeException extends SlingException {
private final int statusCode;
@@ -32,10 +38,15 @@
this.statusCode = statusCode;
}
- public HttpStatusCodeException(int statusCode, String message, Throwable
cause) {
- super(message);
- initCause(cause);
+ public HttpStatusCodeException(int statusCode, String message,
+ Throwable cause) {
+ super(message, cause);
this.statusCode = statusCode;
+ }
+
+ public HttpStatusCodeException(String message, Throwable cause) {
+ super(message, cause);
+ this.statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
}
public int getStatusCode() {
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/SlingException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/SlingException.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/SlingException.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/SlingException.java
Sun Dec 23 06:37:02 2007
@@ -18,13 +18,18 @@
*/
package org.apache.sling.api;
-import javax.servlet.ServletException;
-
/**
- * The <code>SlingException</code> class defines a general exception that may
- * be thrown when unexpected situations occurr while processing requests.
+ * The <code>SlingException</code> is the base exception used throughout the
+ * Sling API. This exception should only be thrown if there is no more specific
+ * exception defined in the Sling API for the cause and if a cause can be
+ * supplied. Otherwise the more specific exception must be used.
+ * <p>
+ * The <code>SlingException</code> is a <code>RuntimeException</code>
+ * because this exception is not intended to be caught by client code. Rather
+ * this exception (and extensions thereof) should be passed through up to the
+ * actual Sling error and exception handling.
*/
-public class SlingException extends ServletException {
+public class SlingException extends RuntimeException {
/**
* Serial Version ID for pre Java2 RMI
@@ -34,17 +39,17 @@
/**
* Constructs a new Sling exception.
*/
- public SlingException() {
+ protected 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) {
+ protected SlingException(String text) {
super(text);
}
@@ -56,7 +61,7 @@
* <li>include the "root cause" exception
* <li>include a description message
* </ul>
- *
+ *
* @param text the exception text
* @param cause the root cause
*/
@@ -68,10 +73,10 @@
* 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) {
+ protected SlingException(Throwable cause) {
super(cause);
}
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java
Sun Dec 23 06:37:02 2007
@@ -20,8 +20,6 @@
import java.util.HashMap;
-import org.apache.sling.api.SlingHttpServletRequest;
-
/** <code>RequestDispatcherOptions</code> are used in the
* [EMAIL PROTECTED]
SlingHttpServletRequest#getRequestDispatcher(org.apache.sling.api.resource.Resource,
RequestDispatcherOptions)}
* method, to give more control on some aspects of the include/forward
Added:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/QuerySyntaxException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/QuerySyntaxException.java?rev=606559&view=auto
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/QuerySyntaxException.java
(added)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/QuerySyntaxException.java
Sun Dec 23 06:37:02 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.api.resource;
+
+import org.apache.sling.api.SlingException;
+
+/**
+ * The <code>QuerySyntaxException</code> is thrown by the
+ * [EMAIL PROTECTED] ResourceResolver#findResources(String, String)} and
+ * [EMAIL PROTECTED] ResourceResolver#queryResources(String, String)} methods
if the query
+ * syntax is wrong or the requested query language is not available.
+ */
+public class QuerySyntaxException extends SlingException {
+
+ private final String query;
+
+ private final String language;
+
+ public QuerySyntaxException(String message, String query, String language)
{
+ super(message);
+
+ this.query = query;
+ this.language = language;
+ }
+
+ public QuerySyntaxException(String message, String query, String language,
+ Throwable cause) {
+ super(message, cause);
+
+ this.query = query;
+ this.language = language;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
Sun Dec 23 06:37:02 2007
@@ -23,8 +23,6 @@
import javax.servlet.http.HttpServletRequest;
-import org.apache.sling.api.SlingException;
-
/**
* The <code>ResourceResolver</code> defines the service API which may be used
* to resolve [EMAIL PROTECTED] Resource} objects. The resource resolver is
available to
@@ -44,13 +42,17 @@
* [EMAIL PROTECTED] Resource#getURI() resource URI} set to the request
URI.
* [EMAIL PROTECTED] Resource#adaptTo(Class) object} returns
<code>null</code> for
* all classes.
- *
+ *
* @param request The http servlet request object used to resolve the
* resource for.
* @return The [EMAIL PROTECTED] Resource} for the request.
- * @throws SlingException May be thrown if another error occurrs.
+ * @throws AccessControlException if the user authenticated with the
request
+ * does not have enough rights to access the resource to which
+ * the request maps.
+ * @throws SlingException A subclass of this exception is thrown if the
+ * resource to which the request maps cannot be retrieved.
*/
- Resource resolve(HttpServletRequest request) throws SlingException;
+ Resource resolve(HttpServletRequest request);
/**
* Returns a [EMAIL PROTECTED] Resource} object for data located at the
given path.
@@ -60,7 +62,7 @@
* a Java Content Repository, the path could be a
* <code>javax.jcr.Item</code> path from which the resource object is
* loaded.
- *
+ *
* @param path The absolute path to the resource object to be loaded. The
* path may contain relative path specifiers like <code>.</code>
* (current location) and <code>..</code> (parent location),
@@ -69,14 +71,14 @@
* <code>ResourceNotFoundException</code> is thrown.
* @return The <code>Resource</code> object loaded from the path or
* <code>null</code> if the path does not resolve to a resource.
- * @throws java.security.AccessControlException if an item exists at the
- * <code>path</code> but the session of this resource manager
- * has no read access to the item.
+ * @throws AccessControlException if an item exists at the
<code>path</code>
+ * but the session of this resource manager has no read access
+ * to the item.
* @throws SlingException If an error occurrs trying to load the resource
* object from the path or if <code>base</code> is
* <code>null</code> and <code>path</code> is relative.
*/
- Resource getResource(String path) throws SlingException;
+ Resource getResource(String path);
/**
* Returns a [EMAIL PROTECTED] Resource} object for data located at the
given path.
@@ -86,7 +88,7 @@
* a Java Content Repository, the path could be a
* <code>javax.jcr.Item</code> path from which the resource object is
* loaded.
- *
+ *
* @param base The base [EMAIL PROTECTED] Resource} against which a
relative path
* argument given by <code>path</code> is resolved. This
* parameter may be <code>null</code> if the <code>path</code>
@@ -100,14 +102,14 @@
* this method.
* @return The <code>Resource</code> object loaded from the path or
* <code>null</code> if the path does not resolve to a resource.
- * @throws java.security.AccessControlException if an item exists at the
- * <code>path</code> but the session of this resource manager
- * has no read access to the item.
+ * @throws AccessControlException if an item exists at the
<code>path</code>
+ * but the session of this resource manager has no read access
+ * to the item.
* @throws SlingException If an error occurrs trying to load the resource
* object from the path or if <code>base</code> is
* <code>null</code> and <code>path</code> is relative.
*/
- Resource getResource(Resource base, String path) throws SlingException;
+ Resource getResource(Resource base, String path);
/**
* Returns an <code>Iterator</code> of [EMAIL PROTECTED] Resource} objects
loaded
@@ -118,17 +120,15 @@
* reading content from a Java Content Repository, the children could be
the
* [EMAIL PROTECTED] Resource} objects loaded from child items of the
<code>Item</code>
* of the given <code>Resource</code>.
- *
+ *
* @param parent The [EMAIL PROTECTED] Resource Resource} whose children
are requested.
- * If <code>null</code> the children of this request's Resource
- * are returned.
* @return An <code>Iterator</code> of [EMAIL PROTECTED] Resource} objects.
* @throws NullPointerException If <code>parent</code> is
* <code>null</code>.
* @throws SlingException If any error occurs acquiring the child resource
* iterator.
*/
- Iterator<Resource> listChildren(Resource parent) throws SlingException;
+ Iterator<Resource> listChildren(Resource parent);
/**
* Searches for resources using the given query formulated in the given
@@ -140,15 +140,17 @@
* create a JCR <code>Query</code> through the <code>QueryManager</code>.
* The result returned is then based on the <code>NodeIterator</code>
* provided by the query result.
- *
+ *
* @param query The query string to use to find the resources.
* @param language The language in which the query is formulated.
* @return An <code>Iterator</code> of [EMAIL PROTECTED] Resource} objects
matching
* the query.
+ * @throws QuerySyntaxException If the query is not syntactically correct
+ * according to the query language indicator of if the query
+ * language is not supported.
* @throws SlingException If an error occurrs querying for the resources.
*/
- Iterator<Resource> findResources(String query, String language)
- throws SlingException;
+ Iterator<Resource> findResources(String query, String language);
/**
* Queries the storage using the given query formulated in the given
@@ -163,21 +165,23 @@
* the column name and the column value is the JCR <code>Value</code>
* object converted into the respective Java object, such as
* <code>Boolean</code> for a value of property type <em>Boolean</em>.
- *
+ *
* @param query The query string to use to find the resources.
* @param language The language in which the query is formulated.
* @return An <code>Iterator</code> of <code>Map</code> instances
* providing access to the query result.
+ * @throws QuerySyntaxException If the query is not syntactically correct
+ * according to the query language indicator of if the query
+ * language is not supported.
* @throws SlingException If an error occurrs querying for the resources.
*/
- Iterator<Map<String, Object>> queryResources(String query, String language)
- throws SlingException;
+ Iterator<Map<String, Object>> queryResources(String query, String
language);
/**
* Adapts this resource resolver to another type. A JCR based resource
* resolver might support adapting to the JCR Session used by the resolver
* to access the JCR Repository.
- *
+ *
* @param <AdapterType> The generic type to which this resource is adapted
* to
* @param type The Class object of the target type, such as
Added:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/ScriptEvaluationException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/ScriptEvaluationException.java?rev=606559&view=auto
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/ScriptEvaluationException.java
(added)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/ScriptEvaluationException.java
Sun Dec 23 06:37:02 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.api.scripting;
+
+import org.apache.sling.api.SlingException;
+
+/**
+ * The <code>ScriptEvaluationException</code> is thrown by the
+ * [EMAIL PROTECTED] SlingScript#eval(SlingBindings)} method if an error
occurrs evaluating
+ * the script.
+ */
+public class ScriptEvaluationException extends SlingException {
+
+ private final String scriptName;
+
+ public ScriptEvaluationException(String scriptName, String message) {
+ super(message);
+
+ this.scriptName = scriptName;
+ }
+
+ public ScriptEvaluationException(String scriptName, String message,
+ Throwable cause) {
+ super(message, cause);
+
+ this.scriptName = scriptName;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
Sun Dec 23 06:37:02 2007
@@ -18,10 +18,6 @@
*/
package org.apache.sling.api.scripting;
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
import org.apache.sling.api.resource.Resource;
/**
@@ -47,18 +43,18 @@
/**
* Evaluates this script using the bound variables as global variables to
* the script.
- *
+ *
* @param props The [EMAIL PROTECTED] SlingBindings} providing the bound
variables for
* evaluating the script. Any bound variables must conform to
the
* requirements of the [EMAIL PROTECTED] SlingBindings}
predefined variables
* set.
- * @throws IOException if an input or output error occurrs.
- * @throws ServletException if another error occurrs evaluating the script.
- * The exception should encapsulate the error cause. This
- * exception is also called if the <code>props</code>
- * predefined bindings are not compliant with the definition in
- * the [EMAIL PROTECTED] SlingBindings} class.
+ * @throws HttpStatusCodeException May be thrown if an error or status
+ * condition should be purveyed to the client and the request
be
+ * aborted.
+ * @throws ScriptEvaluationException If an error occurrs executing the
+ * script or preparing the script execution. The cause of the
+ * evaluation execption is available as the exception cause.
*/
- void eval(SlingBindings props) throws IOException, ServletException;
+ void eval(SlingBindings props);
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
Sun Dec 23 06:37:02 2007
@@ -18,10 +18,6 @@
*/
package org.apache.sling.api.scripting;
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.request.RequestDispatcherOptions;
@@ -55,8 +51,13 @@
/**
* Same as [EMAIL PROTECTED] #include(String,RequestDispatcherOptions)},
but using
* empty options.
+ *
+ * @throws HttpStatusCodeException May be thrown if an error or status
+ * condition should be purveyed to the client and the request
be
+ * aborted.
+ * @throws SlingException If another error occurrs.
*/
- void include(String path) throws ServletException, IOException;
+ void include(String path);
/**
* Helper method to include the result of processing the request for the
@@ -72,10 +73,11 @@
*
* @param path The path to the resource to include.
* @param options influence the rendering of the included Resource
- * @throws ServletException Forwarded from including the resource
- * @throws IOException Forwarded from including the resource
+ * @throws HttpStatusCodeException May be thrown if an error or status
+ * condition should be purveyed to the client and the request
be
+ * aborted.
+ * @throws SlingException If another error occurrs.
*/
- void include(String path, RequestDispatcherOptions options)
- throws ServletException, IOException;
+ void include(String path, RequestDispatcherOptions options);
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
Sun Dec 23 06:37:02 2007
@@ -16,7 +16,6 @@
*/
package org.apache.sling.api.scripting;
-import org.apache.sling.api.SlingException;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ResourceResolver;
@@ -54,10 +53,12 @@
* [EMAIL PROTECTED] SlingScript} is to be found.
* @return The [EMAIL PROTECTED] SlingScript} or <code>null</code> if no
script can
* be found to handle the request.
+ * @throws AccessControlException If the script to which the request
+ * resolves cannot be accessed due to access control
+ * restrictions.
* @throws SlingException If an error occurrs trying to find a script.
*/
- SlingScript resolveScript(SlingHttpServletRequest request)
- throws SlingException;
+ SlingScript resolveScript(SlingHttpServletRequest request);
/**
* Finds the given name to a [EMAIL PROTECTED] SlingScript}.
@@ -73,8 +74,9 @@
* @param name The script name. Must not be <code>null</code>.
* @return The [EMAIL PROTECTED] SlingScript} to which the name resolved or
* <code>null</code> otherwise.
+ * @throws AccessControlException If the requested script cannot be
accessed
+ * due to access control restrictions.
* @throws SlingException If an error occurrs trying to resolve the name.
*/
- SlingScript findScript(ResourceResolver resourceResolver, String name)
- throws SlingException;
+ SlingScript findScript(ResourceResolver resourceResolver, String name);
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/InvalidServiceFilterSyntaxException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/InvalidServiceFilterSyntaxException.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/InvalidServiceFilterSyntaxException.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/InvalidServiceFilterSyntaxException.java
Sun Dec 23 06:37:02 2007
@@ -22,13 +22,22 @@
/** Thrown when an invalid service filter is used */
public class InvalidServiceFilterSyntaxException extends SlingException {
- private static final long serialVersionUID = 1L;
- public InvalidServiceFilterSyntaxException(String reason) {
+ private final String filter;
+
+ public InvalidServiceFilterSyntaxException(String filter, String reason) {
super(reason);
+
+ this.filter = filter;
}
- public InvalidServiceFilterSyntaxException(String reason, Throwable cause)
{
+ public InvalidServiceFilterSyntaxException(String filter, String reason,
Throwable cause) {
super(reason, cause);
+
+ this.filter = filter;
+ }
+
+ public String getFilter() {
+ return filter;
}
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceLocator.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceLocator.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceLocator.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/services/ServiceLocator.java
Sun Dec 23 06:37:02 2007
@@ -34,13 +34,6 @@
<ServiceType> ServiceType getService(Class<ServiceType> type);
/**
- * Same as getService, but throws a ServiceNotAvailableException if the
- * requested service is not currently available
- */
- <ServiceType> ServiceType getRequiredService(Class<ServiceType> type)
- throws ServiceNotAvailableException;
-
- /**
* Lookup one or several services
*
* @param serviceName The name (interface) of the service.
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
Sun Dec 23 06:37:02 2007
@@ -19,7 +19,6 @@
package org.apache.sling.api.servlets;
import javax.servlet.Servlet;
-import javax.servlet.ServletException;
import org.apache.sling.api.SlingHttpServletRequest;
@@ -33,8 +32,8 @@
* through a <code>RequestDispatcher</code> is handled by the Sling Framework.
* <p>
* The servlet resolver service is available from the
- * [EMAIL PROTECTED] org.apache.sling.api.services.ServiceLocator} using the
interface class
- * as parameter.
+ * [EMAIL PROTECTED] org.apache.sling.api.services.ServiceLocator} using the
interface
+ * class as parameter.
*/
public interface ServletResolver {
@@ -51,11 +50,13 @@
* selection of the servlet.
* @return The servlet whose <code>service</code> method may be called to
* handle the request.
+ * @throws AccessControlException If the script to which the request
+ * resolves cannot be accessed due to access control
+ * restrictions.
* @throws ServletException Is thrown if an error occurrs while trying to
* find an appropriate servlet to handle the request or if no
* servlet could be resolved to handle the request.
*/
- Servlet resolveServlet(SlingHttpServletRequest request)
- throws ServletException;
+ Servlet resolveServlet(SlingHttpServletRequest request);
}
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java
Sun Dec 23 06:37:02 2007
@@ -31,7 +31,6 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.api.HttpStatusCodeException;
Modified:
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/wrappers/SlingRequestPaths.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/wrappers/SlingRequestPaths.java?rev=606559&r1=606558&r2=606559&view=diff
==============================================================================
---
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/wrappers/SlingRequestPaths.java
(original)
+++
incubator/sling/whiteboard/fmeschbe/effective_exceptions/api/src/main/java/org/apache/sling/api/wrappers/SlingRequestPaths.java
Sun Dec 23 06:37:02 2007
@@ -18,7 +18,6 @@
*/
package org.apache.sling.api.wrappers;
-import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
/** This class is not a "wrapper" per se, but computes the correct