jvanzyl 01/07/12 13:32:28
Modified: src/java/org/apache/turbine RunData.java Turbine.java
Removed: src/java/org/apache/turbine TemplatePage.java
src/java/org/apache/turbine/services/jsp/tags
BodyAttributesTag.java BodyTag.java HeadTag.java
NavigationTag.java ScreenTag.java
TemplateLinkTag.java
src/java/org/apache/turbine/services/jsp/util JspLink.java
JspNavigation.java JspScreenPlaceholder.java
Log:
- removing problematic classes for now, mostly jsp code
- more changes to reflect changes in rendering system
Revision Changes Path
1.3 +3 -6 jakarta-turbine/src/java/org/apache/turbine/RunData.java
Index: RunData.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/RunData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RunData.java 2001/07/10 16:29:49 1.2
+++ RunData.java 2001/07/12 20:32:02 1.3
@@ -88,7 +88,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bernie Hoeneisen</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: RunData.java,v 1.2 2001/07/10 16:29:49 jvanzyl Exp $
+ * @version $Id: RunData.java,v 1.3 2001/07/12 20:32:02 jvanzyl Exp $
*/
public interface RunData
{
@@ -253,11 +253,8 @@
*/
public void setScreen(String screen);
- //!! This should be changed to getTargetTemplate
- // as a template will start the whole display pipeline
- // in the classic pipeline the 'screen' template which
- // is specified by the 'template' parameters starts
- // the whole chain of events. jvz
+ public String getTarget();
+ public void setTarget(String template);
/**
* Convenience method for a template info that
1.65 +79 -60 jakarta-turbine/src/java/org/apache/turbine/Turbine.java
Index: Turbine.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- Turbine.java 2001/07/10 03:43:29 1.64
+++ Turbine.java 2001/07/12 20:32:04 1.65
@@ -61,6 +61,7 @@
import java.util.Properties;
import java.util.Vector;
import java.util.Iterator;
+import java.util.Hashtable;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -110,7 +111,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Turbine.java,v 1.64 2001/07/10 03:43:29 jvanzyl Exp $
+ * @version $Id: Turbine.java,v 1.65 2001/07/12 20:32:04 jvanzyl Exp $
*/
public class Turbine
extends HttpServlet
@@ -246,12 +247,29 @@
// application running under Turbine but we are trying,
// for the time being to work in a BC fashion.
moduleLoader = new ModuleLoader();
- moduleLoader.addModuleType(ACTIONS);
- moduleLoader.addModuleType(PAGES);
- moduleLoader.addModuleType(NAVIGATIONS);
- moduleLoader.addModuleType(LAYOUTS);
- moduleLoader.addModuleType(SCREENS);
+ Configuration moduleTypes = configuration.subset("module.default");
+
+ Iterator j = moduleTypes.getKeys();
+
+ // Make container for default modules
+ defaultModules = new Hashtable();
+
+ while (j.hasNext())
+ {
+ String moduleType = (String) j.next();
+ String defaultModule = moduleTypes.getString(moduleType);
+
+ Log.debug("Adding module type " + moduleType +
+ " with a default of " + defaultModule);
+
+ moduleLoader.addModuleType(moduleType);
+
+ // Add the default module for the particular
+ // module type to our container for module defaults.
+ defaultModules.put(moduleType, defaultModule);
+ }
+
// Add the default set of modules which live within
// the org.apache.turbine.module namespace.
moduleLoader.addModulePackage(DEFAULT_MODULE_PACKAGE);
@@ -266,6 +284,14 @@
{
moduleLoader.addModulePackage((String) i.next());
}
+
+ // Setup the default pipeline. There will be a pipeline
+ // per (sub)app, just like there will be a module loader
+ // per app, but we'll set a standard one up here for
+ // now.
+ pipeline = (Pipeline) Class.forName(configuration.getString(
+
"pipeline.default","org.apache.turbine.pipeline.ClassicPipeline"))
+ .newInstance();
}
catch ( Exception e )
{
@@ -351,10 +377,9 @@
init(data);
// Get the instance of the Session Validator.
- SessionValidator sessionValidator;
- sessionValidator = (SessionValidator) moduleLoader
- .getModule(ACTIONS,
- configuration.getString(ACTION_SESSION_VALIDATOR));
+ SessionValidator sessionValidator =
+ (SessionValidator) moduleLoader.getModule(ACTIONS,
+ configuration.getString(ACTION_SESSION_VALIDATOR));
// if this is the redirected stage of the initial request,
// check that the session is now not new.
@@ -380,8 +405,9 @@
String key = (String) e.nextElement();
if (!key.equals(REDIRECTED_PATHINFO_NAME))
{
- String value =
+ String value =
(String) data.getParameters().getString ( key );
+
duri.addPathInfo((String)key, (String)value );
}
}
@@ -488,11 +514,6 @@
// screen other than Login, you need to change that within
// TurbineResources.properties...screen.homepage; or, you
// can specify your own SessionValidator action.
-
- /* no reason to get what we already have (sessionValidator)
- moduleLoader.getModule(ACTIONS,
- configuration.getString(ACTION_SESSION_VALIDATOR)).execute(data);
- */
sessionValidator.execute(data);
// Put the Access Control List into the RunData object, so
@@ -502,53 +523,38 @@
// information.
moduleLoader.getModule(ACTIONS,
configuration.getString(ACTION_ACCESS_CONTROLLER)).execute(data);
-
- // Start the execution phase. DefaultPage will execute the
- // appropriate action as well as get the Layout from the
- // Screen and then execute that. The Layout is then
- // responsible for executing the Navigation and Screen
- // modules.
- //
- // Note that by default, this cannot be overridden from
- // parameters passed in via post/query data. This is for
- // security purposes. You should really never need more
- // than just the default page. If you do, add logic to
- // DefaultPage to do what you want.
-
- String defaultPage = TurbineTemplate.getDefaultPageModule();
- Log.debug("Default Page Module: " + defaultPage);
+ // Now these stages of execution are fixed right now, but they
+ // should be configurable. Each of the stages here
+ // should be defined in a Valve and the pipeline
+ // should execute each valve. Following the patterns
+ // in catalina there is also a ValveContext which
+ // can alter the execution path of the valves. What
+ // is listed below here could eventually be anything :-)
+ pipeline.preExecuteAction(data);
+ pipeline.executeAction(data);
+ pipeline.postExecuteAction(data);
+ pipeline.execute(data);
+ pipeline.finished(data);
- if (defaultPage == null)
- {
- // In this case none of the template services are running.
- // The application may be using ECS for views, or a
- // decendent of RawScreen is trying to produce output.
- // If there is a 'page.default' property in the TR.props
- // then use that, otherwise return DefaultPage which will
- // handle ECS view scenerios and RawScreen scenerios. The
- // app developer can still specify the 'page.default'
- // if they wish but the DefaultPage should work in
- // most cases.
- defaultPage = configuration.getString(
- PAGE_DEFAULT, DEFAULT_PAGE_MODULE);
- }
-
- moduleLoader.getModule(PAGES, defaultPage).execute(data);
-
// If a module has set data.acl = null, remove acl from
- // the session.
+ // the session.
+ //!! This should be moved into the pipeline!
if ( data.getACL() == null )
{
data.getSession().removeValue(
AccessControlList.SESSION_KEY);
}
-
+
+ //!! temp hack the pipeline will deal with the output
+ data.declareDirectResponse();
+
try
{
- if ( data.isPageSet() == false &&
- data.isOutSet() == false )
+ if ( data.isPageSet() == false && data.isOutSet() == false )
+ {
throw new Exception ( "Nothing to output" );
+ }
// We are all done! if isPageSet() output that way
// otherwise, data.getOut() has already been written
@@ -566,17 +572,16 @@
data.getStatusCode() == 302 ) &&
data.getRedirectURI() != null )
{
- data.getResponse()
- .sendRedirect ( data.getRedirectURI() );
+ data.getResponse().sendRedirect(data.getRedirectURI());
}
// Set the status code.
- data.getResponse().setStatus ( data.getStatusCode() );
+ data.getResponse().setStatus (data.getStatusCode());
// Output the Page.
- data.getPage().output (data.getOut());
+ data.getPage().output(data.getOut());
}
}
- catch ( Exception e )
+ catch (Exception e)
{
// The output stream was probably closed by the client
// end of things ie: the client clicked the Stop
@@ -653,7 +658,7 @@
Throwable t)
{
// make sure that the stack trace makes it the log
- Log.error("Turbine.handleException: "+t.getMessage());
+ Log.error("Turbine.handleException: " + t.getMessage());
Log.error(t);
String mimeType = "text/plain";
@@ -681,7 +686,8 @@
data.getResponse().setContentType( data.getContentType() );
data.getResponse().setStatus ( data.getStatusCode() );
- if( data.isPageSet() )
+
+ if(data.isPageSet())
{
data.getOut().print ( data.getPage().toString() );
}
@@ -801,6 +807,12 @@
*/
private static ModuleLoader moduleLoader;
+ //!! this will have to be done on a per app basis
+ // when the app service is checked in. jvz.
+ private static Hashtable defaultModules;
+
+ private static Pipeline pipeline;
+
/**
* Get the ModuleLoader for this Turbine webapp.
* Eventually we will want to be able to grab a ModuleLoader
@@ -812,7 +824,7 @@
{
return moduleLoader;
}
-
+
/**
* Save some information about this servlet so that
* it can be utilized by object instances that do not
@@ -949,4 +961,11 @@
{
return configuration;
}
+
+ // New module stuff
+
+ public static String getDefaultModule(String moduleType)
+ {
+ return (String) defaultModules.get(moduleType);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]