You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/07/24 16:54:35 UTC
svn commit: rev 23212 - in avalon/trunk/planet/facilities/http: api/src/main/org/apache/avalon/http impl/src/main/org/apache/avalon/http/impl test/src/main/test/http util/src/main/org/apache/avalon/http/util
Author: niclas
Date: Sat Jul 24 07:54:34 2004
New Revision: 23212
Added:
avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandler.java
- copied, changed from rev 23211, avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/Handler.java
avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandlerException.java
- copied, changed from rev 23109, avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HandlerException.java
avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/AbstractHttpRequestHandler.java
- copied, changed from rev 23211, avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/HttpHandler.java
Removed:
avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/Handler.java
avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HandlerException.java
avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/HttpHandler.java
Modified:
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/AvalonLogSink.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ComponentModelHolder.java
avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultModelListener.java
avalon/trunk/planet/facilities/http/test/src/main/test/http/TestComponent.java
Log:
More work done on the URL mapping of components in the Http facility.
Copied: avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandler.java (from rev 23211, avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/Handler.java)
==============================================================================
--- avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/Handler.java (original)
+++ avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandler.java Sat Jul 24 07:54:34 2004
@@ -32,7 +32,7 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/04/04 15:00:56 $
*/
-public interface Handler
+public interface HttpRequestHandler
{
/**
* Called by the container to allow the handler to respond to
@@ -52,5 +52,5 @@
*
*/
public void service( ServletRequest request, ServletResponse response )
- throws HandlerException, IOException;
+ throws HttpRequestHandlerException, IOException;
}
Copied: avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandlerException.java (from rev 23109, avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HandlerException.java)
==============================================================================
--- avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HandlerException.java (original)
+++ avalon/trunk/planet/facilities/http/api/src/main/org/apache/avalon/http/HttpRequestHandlerException.java Sat Jul 24 07:54:34 2004
@@ -23,8 +23,7 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/04/04 15:00:56 $
*/
-public class HandlerException
- extends Exception
+public class HttpRequestHandlerException extends Exception
{
private final Throwable m_cause;
@@ -34,7 +33,7 @@
*
* @param message The detail message for this exception.
*/
- public HandlerException( final String message )
+ public HttpRequestHandlerException( final String message )
{
this( message, null );
}
@@ -45,7 +44,7 @@
* @param message The detail message for this exception.
* @param cause the root cause of the exception
*/
- public HandlerException( final String message, final Throwable cause )
+ public HttpRequestHandlerException( final String message, final Throwable cause )
{
super( message );
m_cause = cause;
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/AvalonLogSink.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/AvalonLogSink.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/AvalonLogSink.java Sat Jul 24 07:54:34 2004
@@ -28,7 +28,8 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version 1.0
*/
-public class AvalonLogSink extends AbstractLogEnabled implements LogSink
+public class AvalonLogSink extends AbstractLogEnabled
+ implements LogSink
{
/**
* Stop the logging channel. This implementation does nothing
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ComponentModelHolder.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ComponentModelHolder.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/ComponentModelHolder.java Sat Jul 24 07:54:34 2004
@@ -26,7 +26,7 @@
import javax.servlet.UnavailableException;
import org.apache.avalon.composition.model.ComponentModel;
-import org.apache.avalon.http.Handler;
+import org.apache.avalon.http.HttpRequestHandler;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.servlet.ServletHandler;
@@ -125,11 +125,11 @@
}
}
- private Handler getHandler() throws ServletException
+ private HttpRequestHandler getHandler() throws ServletException
{
try
{
- return (Handler) m_model.resolve();
+ return (HttpRequestHandler) m_model.resolve();
}
catch( Throwable e )
{
Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultModelListener.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultModelListener.java (original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/DefaultModelListener.java Sat Jul 24 07:54:34 2004
@@ -33,7 +33,7 @@
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.http.HttpService;
-import org.apache.avalon.http.Handler;
+import org.apache.avalon.http.HttpRequestHandler;
/**
@@ -148,14 +148,14 @@
{
ComponentModel component = (ComponentModel) model;
Class clazz = component.getDeploymentClass();
- if( Handler.class.isAssignableFrom( clazz ) )
+ if( HttpRequestHandler.class.isAssignableFrom( clazz ) )
{
if( flag )
{
if( getLogger().isInfoEnabled() )
{
getLogger().info(
- "component: " + component + " is a Handler" );
+ "component: " + component + " is a HttpRequestHandler" );
}
m_server.register( component );
}
Modified: avalon/trunk/planet/facilities/http/test/src/main/test/http/TestComponent.java
==============================================================================
--- avalon/trunk/planet/facilities/http/test/src/main/test/http/TestComponent.java (original)
+++ avalon/trunk/planet/facilities/http/test/src/main/test/http/TestComponent.java Sat Jul 24 07:54:34 2004
@@ -35,8 +35,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.avalon.http.HandlerException;
-import org.apache.avalon.http.util.HttpHandler;
+import org.apache.avalon.http.HttpRequestHandlerException;
+import org.apache.avalon.http.util.AbstractHttpRequestHandler;
/**
* HTTP Handler component that receives and processes http service
@@ -46,7 +46,7 @@
* @avalon.service type="org.apache.avalon.http.Handler"
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
*/
-public class TestComponent extends HttpHandler
+public class TestComponent extends AbstractHttpRequestHandler
implements LogEnabled, Serviceable, Configurable
{
//----------------------------------------------------------
@@ -113,7 +113,7 @@
*/
public void doGet(HttpServletRequest request,
HttpServletResponse response)
- throws IOException, HandlerException {
+ throws IOException, HttpRequestHandlerException {
int count = m_counter.increment();
Copied: avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/AbstractHttpRequestHandler.java (from rev 23211, avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/HttpHandler.java)
==============================================================================
--- avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/HttpHandler.java (original)
+++ avalon/trunk/planet/facilities/http/util/src/main/org/apache/avalon/http/util/AbstractHttpRequestHandler.java Sat Jul 24 07:54:34 2004
@@ -35,14 +35,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Cookie;
-import org.apache.avalon.http.Handler;
-import org.apache.avalon.http.HandlerException;
+import org.apache.avalon.http.HttpRequestHandler;
+import org.apache.avalon.http.HttpRequestHandlerException;
/**
*
* Provides an abstract class to be subclassed to create
* an HTTP handlers suitable for a Web site. A subclass of
- * <code>HttpHandler</code> must override at least
+ * <code>AbstractHttpRequestHandler</code> must override at least
* one method, usually one of these:
*
* <ul>
@@ -65,8 +65,8 @@
* @version $Revision: 1.1 $
*
*/
-public abstract class HttpHandler
- implements Handler, java.io.Serializable
+public abstract class AbstractHttpRequestHandler
+ implements HttpRequestHandler, java.io.Serializable
{
private static final String METHOD_DELETE = "DELETE";
private static final String METHOD_HEAD = "HEAD";
@@ -88,7 +88,7 @@
* Does nothing, because this is an abstract class.
*
*/
- public HttpHandler() { }
+ public AbstractHttpRequestHandler() { }
/**
* Called by the server (via the <code>service</code> method) to
@@ -155,7 +155,7 @@
*
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
String protocol = request.getProtocol();
String msg = lStrings.getString("http.method_get_not_supported");
@@ -223,12 +223,12 @@
* @param response the response object that the component
* uses to return the headers to the clien
* @exception IOException if an input or output error occurs
- * @exception HandlerException if the request for the HEAD
+ * @exception HttpRequestHandlerException if the request for the HEAD
* could not be handled
*/
protected void doHead(HttpServletRequest request, HttpServletResponse response )
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
NoBodyResponse resp = new NoBodyResponse(response);
doGet(request, resp);
@@ -283,13 +283,13 @@
* @exception IOException if an input or output error is
* detected when the component handles
* the request
- * @exception HandlerException if the request for the POST
+ * @exception HttpRequestHandlerException if the request for the POST
* could not be handled
* @see javax.servlet.ServletOutputStream
* @see javax.servlet.ServletResponse#setContentType
*/
protected void doPost( HttpServletRequest request, HttpServletResponse response )
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
String protocol = request.getProtocol();
String msg = lStrings.getString("http.method_post_not_supported");
@@ -343,13 +343,13 @@
* while the component is handling the
* PUT request
*
- * @exception HandlerException if the request for the PUT
+ * @exception HttpRequestHandlerException if the request for the PUT
* cannot be handled
*
*/
protected void doPut(HttpServletRequest request, HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
String protocol = request.getProtocol();
String msg = lStrings.getString("http.method_put_not_supported");
@@ -394,13 +394,13 @@
* while the component is handling the
* DELETE request
*
- * @exception HandlerException if the request for the
+ * @exception HttpRequestHandlerException if the request for the
* DELETE cannot be handled
*
*/
protected void doDelete(HttpServletRequest request,
HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
String protocol = request.getProtocol();
String msg = lStrings.getString("http.method_delete_not_supported");
@@ -465,12 +465,12 @@
* while the component is handling the
* OPTIONS request
*
- * @exception HandlerException if the request for the
+ * @exception HttpRequestHandlerException if the request for the
* OPTIONS cannot be handled
*
*/
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
Method[] methods = getAllDeclaredMethods(this.getClass());
@@ -542,11 +542,11 @@
* @exception IOException if an input or output error occurs
* while the component is handling the
* TRACE request
- * @exception HandlerException if the request for the
+ * @exception HttpRequestHandlerException if the request for the
* TRACE cannot be handled
*/
protected void doTrace(HttpServletRequest request, HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
int responseLength;
@@ -592,12 +592,12 @@
* @exception IOException if an input or output error occurs
* while the component is handling the
* TRACE request
- * @exception HandlerException if the request for the
+ * @exception HttpRequestHandlerException if the request for the
* TRACE cannot be handled
* @see javax.servlet.Servlet#service
*/
protected void service(HttpServletRequest request, HttpServletResponse response)
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
String method = request.getMethod();
@@ -690,7 +690,7 @@
* while the component is handling the
* TRACE request
*
- * @exception HandlerException if the request for the
+ * @exception HttpRequestHandlerException if the request for the
* TRACE cannot be handled
*
*
@@ -698,7 +698,7 @@
*
*/
public void service(ServletRequest request, ServletResponse response )
- throws HandlerException, IOException
+ throws HttpRequestHandlerException, IOException
{
HttpServletRequest httpRequest;
HttpServletResponse httpResponse;
@@ -710,7 +710,7 @@
}
catch (ClassCastException e)
{
- throw new HandlerException("non-HTTP request or response");
+ throw new HttpRequestHandlerException("non-HTTP request or response");
}
service( httpRequest, httpResponse );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org