Author: tv
Date: Wed Sep 18 12:01:48 2013
New Revision: 1524377
URL: http://svn.apache.org/r1524377
Log:
Add missing method signatures
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/JspService.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/JspService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/jsp/JspService.java?rev=1524377&r1=1524376&r2=1524377&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/jsp/JspService.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/jsp/JspService.java
Wed Sep 18 12:01:48 2013
@@ -21,8 +21,8 @@ package org.apache.turbine.services.jsp;
*/
+import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.Service;
-
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.TurbineException;
@@ -41,6 +41,9 @@ public interface JspService
/** The key used to store an instance of RunData in the request */
String RUNDATA = "rundata";
+ /** The key used to store an instance of PipelineData in the request */
+ String PIPELINE_DATA = "pdata";
+
/** The key used to store an instance of JspLink in the request */
String LINK = "link";
@@ -60,18 +63,29 @@ public interface JspService
* Adds some convenience objects to the request. For example an instance
* of JspLink which can be used to generate links to other templates.
*
+ * @deprecated Use the PipelineData version.
* @param data the turbine rundata object
*/
void addDefaultObjects(RunData data);
/**
+ * Adds some convenience objects to the request. For example an instance
+ * of JspLink which can be used to generate links to other templates.
+ *
+ * @param data the turbine pipelinedData object
+ */
+ void addDefaultObjects(PipelineData pipelineData);
+
+ /**
* executes the JSP given by templateName.
*
* @param data A RunData Object
* @param templateName The template to execute
* @param isForward whether to perform a forward or include.
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
+ *
+ * @deprecated Use the PipelineData version.
*/
void handleRequest(RunData data, String templateName, boolean isForward)
throws TurbineException;
@@ -82,12 +96,37 @@ public interface JspService
* @param data A RunData Object
* @param templateName The template to execute
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
+ *
+ * @deprecated Use the PipelineData version.
*/
void handleRequest(RunData data, String templateName)
throws TurbineException;
/**
+ * executes the JSP given by templateName.
+ *
+ * @param data A RunData Object
+ * @param templateName The template to execute
+ * @param isForward whether to perform a forward or include.
+ *
+ * @throws TurbineException If a problem occurred while executing the JSP
+ */
+ void handleRequest(PipelineData pipelineData, String templateName, boolean
isForward)
+ throws TurbineException;
+
+ /**
+ * executes the JSP given by templateName.
+ *
+ * @param data A RunData Object
+ * @param templateName The template to execute
+ *
+ * @throws TurbineException If a problem occurred while executing the JSP
+ */
+ void handleRequest(PipelineData pipelineData, String templateName)
+ throws TurbineException;
+
+ /**
* Returns the default buffer size of the JspService
*
* @return The default buffer size.
@@ -104,5 +143,4 @@ public interface JspService
* @return the template with a relative path
*/
String getRelativeTemplateName(String template);
-
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java?rev=1524377&r1=1524376&r2=1524377&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java
Wed Sep 18 12:01:48 2013
@@ -23,7 +23,6 @@ package org.apache.turbine.services.jsp;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.TurbineServices;
-
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.TurbineException;
@@ -59,7 +58,6 @@ public abstract class TurbineJsp
getService().addDefaultObjects(data);
}
-
/**
* Adds some convenience objects to the request. For example an instance
* of JspLink which can be used to generate links to other templates.
@@ -68,10 +66,7 @@ public abstract class TurbineJsp
*/
public static void addDefaultObjects(PipelineData pipelineData)
{
- //Map runDataMap = (Map) pipelineData.get(RunData.class);
- //RunData data = (RunData)runDataMap.get(RunData.class);
- RunData runData = (RunData)pipelineData;
- addDefaultObjects(runData);
+ getService().addDefaultObjects(pipelineData);
}
/**
@@ -82,7 +77,7 @@ public abstract class TurbineJsp
* @param templateName The template to execute
* @param isForward whether to perform a forward or include.
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
*/
public static void handleRequest(RunData data, String templateName,
boolean isForward)
throws TurbineException
@@ -97,7 +92,7 @@ public abstract class TurbineJsp
* @param data A RunData Object
* @param templateName The template to execute
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
*/
public static void handleRequest(RunData data, String templateName)
throws TurbineException
@@ -112,15 +107,12 @@ public abstract class TurbineJsp
* @param templateName The template to execute
* @param isForward whether to perform a forward or include.
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
*/
public static void handleRequest(PipelineData pipelineData, String
templateName, boolean isForward)
throws TurbineException
{
- //Map runDataMap = (Map) pipelineData.get(RunData.class);
- //RunData data = (RunData)runDataMap.get(RunData.class);
- RunData runData = (RunData)pipelineData;
- handleRequest(runData, templateName, isForward);
+ getService().handleRequest(pipelineData, templateName, isForward);
}
/**
@@ -129,18 +121,14 @@ public abstract class TurbineJsp
* @param data A RunData Object
* @param templateName The template to execute
*
- * @throws TurbineException If a problem occured while executing the JSP
+ * @throws TurbineException If a problem occurred while executing the JSP
*/
public static void handleRequest(PipelineData pipelineData, String
templateName)
throws TurbineException
{
- if(!(pipelineData instanceof RunData)){
- throw new RuntimeException("Can't cast to rundata from pipeline
data.");
- }
- handleRequest((RunData)pipelineData, templateName);
+ getService().handleRequest(pipelineData, templateName);
}
-
/**
* Returns the default buffer size of the JspService
*
@@ -152,7 +140,7 @@ public abstract class TurbineJsp
}
/**
- * Searchs for a template in the default.template path[s] and
+ * Searches for a template in the default.template path[s] and
* returns the template name with a relative path which is required
* by <a
href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)">javax.servlet.RequestDispatcher</a>
*
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java?rev=1524377&r1=1524376&r2=1524377&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
Wed Sep 18 12:01:48 2013
@@ -25,7 +25,6 @@ import java.io.File;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.configuration.Configuration;
@@ -33,6 +32,7 @@ import org.apache.commons.lang.StringUti
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.turbine.Turbine;
+import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.pull.ApplicationTool;
import org.apache.turbine.services.pull.tools.TemplateLink;
@@ -91,29 +91,38 @@ public class TurbineJspService
}
/**
- * Performs early initialization of this Turbine service.
+ * Adds some convenience objects to the request. For example an instance
+ * of TemplateLink which can be used to generate links to other templates.
*
- * @param config The ServletConfiguration from Turbine
+ * @param data the turbine rundata object
*
- * @throws InitializationException Something went wrong when starting up.
- * @deprecated use init() instead.
+ * @deprecated Use the PipelineData version.
*/
- @Deprecated
- public void init(ServletConfig config)
- throws InitializationException
+ public void addDefaultObjects(RunData data)
{
- init();
+ HttpServletRequest req = data.getRequest();
+
+ //
+ // This is a place where an Application Pull Tool is used
+ // in a regular Java Context. We have no Pull Service with the
+ // Jsp Paging stuff, but we can run our Application Tool by Hand:
+ //
+ ApplicationTool templateLink = new TemplateLink();
+ templateLink.init(data);
+
+ req.setAttribute(LINK, templateLink);
+ req.setAttribute(RUNDATA, data);
}
/**
* Adds some convenience objects to the request. For example an instance
* of TemplateLink which can be used to generate links to other templates.
*
- * @param data the turbine rundata object
+ * @param data the turbine pipelinedData object
*/
- public void addDefaultObjects(RunData data)
+ public void addDefaultObjects(PipelineData pipelineData)
{
- HttpServletRequest req = data.getRequest();
+ HttpServletRequest req = pipelineData.get(Turbine.class,
HttpServletRequest.class);
//
// This is a place where an Application Pull Tool is used
@@ -121,10 +130,10 @@ public class TurbineJspService
// Jsp Paging stuff, but we can run our Application Tool by Hand:
//
ApplicationTool templateLink = new TemplateLink();
- templateLink.init(data);
+ templateLink.init(pipelineData);
req.setAttribute(LINK, templateLink);
- req.setAttribute(RUNDATA, data);
+ req.setAttribute(PIPELINE_DATA, pipelineData);
}
/**
@@ -144,6 +153,8 @@ public class TurbineJspService
* @param templateName the filename of the template.
* @throws TurbineException Any exception thrown while processing will be
* wrapped into a TurbineException and rethrown.
+ *
+ * @deprecated Use the PipelineData version.
*/
public void handleRequest(RunData data, String templateName)
throws TurbineException
@@ -157,8 +168,10 @@ public class TurbineJspService
* @param data A RunData Object
* @param templateName the filename of the template.
* @param isForward whether to perform a forward or include.
- * @throws TurbineException Any exception trown while processing will be
+ * @throws TurbineException Any exception thrown while processing will be
* wrapped into a TurbineException and rethrown.
+ *
+ * @deprecated Use the PipelineData version.
*/
public void handleRequest(RunData data, String templateName, boolean
isForward)
throws TurbineException
@@ -206,13 +219,47 @@ public class TurbineJspService
}
// pass the exception to the caller according to the general
- // contract for tamplating services in Turbine
+ // contract for templating services in Turbine
throw new TurbineException(
"Error encountered processing a template: " + templateName, e);
}
}
/**
+ * executes the JSP given by templateName.
+ *
+ * @param data A RunData Object
+ * @param templateName The template to execute
+ * @param isForward whether to perform a forward or include.
+ *
+ * @throws TurbineException If a problem occurred while executing the JSP
+ */
+ public void handleRequest(PipelineData pipelineData, String templateName,
boolean isForward)
+ throws TurbineException
+ {
+ if(!(pipelineData instanceof RunData))
+ {
+ throw new RuntimeException("Can't cast to rundata from pipeline
data.");
+ }
+
+ handleRequest((RunData)pipelineData, templateName, isForward);
+ }
+
+ /**
+ * executes the JSP given by templateName.
+ *
+ * @param data A RunData Object
+ * @param templateName The template to execute
+ *
+ * @throws TurbineException If a problem occurred while executing the JSP
+ */
+ public void handleRequest(PipelineData pipelineData, String templateName)
+ throws TurbineException
+ {
+ handleRequest(pipelineData, templateName, false);
+ }
+
+ /**
* This method sets up the template cache.
*/
private void initJsp()