View Javadoc

1   /*
2   Wotonomy: OpenStep design patterns for pure Java applications.
3   Copyright (C) 2000 Blacksmith, Inc.
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, see http://www.gnu.org
17  */
18  
19  package net.wotonomy.web;
20  
21  import net.wotonomy.foundation.internal.NetworkClassLoader;
22  
23  /***
24  * A pure java implementation that corresponds 
25  * to the abstract class WORequestHandler.
26  *
27  * @author michael@mpowers.net
28  * @author $Author: cgruber $
29  * @version $Revision: 905 $
30  */
31  public abstract class WORequestHandler
32  {
33  	private NetworkClassLoader loader;
34  	
35  	/***
36  	* Default constructor.
37  	*/
38  	public WORequestHandler()
39  	{
40  		loader = new NetworkClassLoader( WOApplication.application().getClass().getClassLoader() );
41  	}
42  	
43  	/***
44  	* Dispatches the request and returns the response.
45  	*/
46      abstract public WOResponse handleRequest (WORequest aRequest);    
47      
48  	/***
49  	* Gets the specified class, loading it if it has not already been
50  	* loaded or if it has been modified.  Returns null if not found.
51  	* Because this method is not in the specification, it has only 
52  	* package access.
53  	*/
54  	Class loadClass( String aName )
55  	{
56          try
57          {
58              return loader.loadClass( aName, true );
59          }
60          catch ( ClassNotFoundException cnfe )
61  		{
62  			return null;
63  		}
64  	}
65  
66  //    void lock ()
67  //    void unlock ()
68  }