You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2015/08/13 02:35:48 UTC
svn commit: r1695634 [2/3] - in /turbine/core/trunk/src: changes/
java/org/apache/turbine/modules/ java/org/apache/turbine/modules/actions/
java/org/apache/turbine/modules/actions/sessionvalidator/
java/org/apache/turbine/modules/layouts/ java/org/apac...
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/TemplateNavigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/TemplateNavigation.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/TemplateNavigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/TemplateNavigation.java Thu Aug 13 00:35:47 2015
@@ -22,12 +22,9 @@ package org.apache.turbine.modules.navig
import org.apache.ecs.ConcreteElement;
-
import org.apache.turbine.modules.Navigation;
import org.apache.turbine.pipeline.PipelineData;
-import org.apache.turbine.util.RunData;
-
/**
* Base Template Navigation.
*
@@ -43,69 +40,18 @@ public abstract class TemplateNavigation
* method to perform any particular business logic and add
* information to the context.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @throws Exception a generic exception.
- */
- @Deprecated
- protected abstract void doBuildTemplate(RunData data)
- throws Exception;
-
- /**
- * WebMacro Navigations extending this class should overide this
- * method to perform any particular business logic and add
- * information to the context.
- *
* @param data Turbine information.
* @throws Exception a generic exception.
*/
- protected void doBuildTemplate(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildTemplate(data);
- }
-
+ protected abstract void doBuildTemplate(PipelineData pipelineData) throws Exception;
/**
* This Builds the WebMacro/FreeMarker/etc template.
- * @deprecated Use PipelineData version
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @throws Exception a generic exception.
- */
- @Deprecated
- public abstract ConcreteElement buildTemplate(RunData data)
- throws Exception;
-
- /**
- * This Builds the WebMacro/FreeMarker/etc template.
- * Should revert to abstract when RunData goes.
* @param pipelineData Turbine information.
* @return A ConcreteElement.
* @throws Exception a generic exception.
*/
- public ConcreteElement buildTemplate(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- return buildTemplate(data);
- }
-
- /**
- * Calls doBuildTemplate() and then buildTemplate().
- *
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @throws Exception a generic exception.
- */
- @Override
- protected ConcreteElement doBuild(RunData data)
- throws Exception
- {
- doBuildTemplate(data);
- return buildTemplate(data);
- }
+ public abstract ConcreteElement buildTemplate(PipelineData pipelineData) throws Exception;
/**
* Calls doBuildTemplate() and then buildTemplate().
@@ -118,8 +64,7 @@ public abstract class TemplateNavigation
protected ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = getRunData(pipelineData);
- return doBuild(data);
+ doBuildTemplate(pipelineData);
+ return buildTemplate(pipelineData);
}
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java Thu Aug 13 00:35:47 2015
@@ -59,25 +59,7 @@ public class VelocityNavigation
private TemplateService templateService;
/**
- * Velocity Navigations extending this class should overide this
- * method to perform any particular business logic and add
- * information to the context.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @param context Context for web pages.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- protected void doBuildTemplate(RunData data,
- Context context)
- throws Exception
- {
- // empty
- }
-
- /**
- * Velocity Navigations extending this class should overide this
+ * Velocity Navigations extending this class should override this
* method to perform any particular business logic and add
* information to the context.
*
@@ -97,24 +79,6 @@ public class VelocityNavigation
* The actual method that you should override is the one with the
* context in the parameter list.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- protected void doBuildTemplate(RunData data)
- throws Exception
- {
- doBuildTemplate(data, velocity.getContext(data));
- }
-
-
- /**
- * Needs to be implemented to make TemplateNavigation like us.
- * The actual method that you should override is the one with the
- * context in the parameter list.
- *
* @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
@@ -126,33 +90,7 @@ public class VelocityNavigation
}
/**
- * This Builds the Velocity template.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- public ConcreteElement buildTemplate(RunData data)
- throws Exception
- {
- Context context = velocity.getContext(data);
-
- String navigationTemplate = data.getTemplateInfo().getNavigationTemplate();
- String templateName
- = templateService.getNavigationTemplateName(navigationTemplate);
-
- StringElement output = new StringElement();
- output.setFilterState(false);
- output.addElement(
- velocity.handleRequest(context, prefix + templateName));
- return output;
- }
-
- /**
- * This Builds the Velocity template.
+ * This builds the Velocity template.
*
* @param data Turbine information.
* @return A ConcreteElement.
@@ -175,6 +113,4 @@ public class VelocityNavigation
velocity.handleRequest(context, prefix + templateName));
return output;
}
-
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/pages/DefaultPage.java Thu Aug 13 00:35:47 2015
@@ -116,70 +116,6 @@ public class DefaultPage
/**
* Builds the Page.
*
- * @deprecated Use PipelineData version instead
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- public void doBuild(RunData data)
- throws Exception
- {
- // Template pages can use this to set up the context, so it is
- // available to the Action and Screen. It does nothing here.
- doBuildBeforeAction(data);
-
- // If an action has been defined, execute it here. Actions
- // can re-define the template definition.
- if (data.hasAction())
- {
- actionLoader.exec(data, data.getAction());
- }
-
- // if a redirect was setup in data, don't do anything else
- if (StringUtils.isNotEmpty(data.getRedirectURI()))
- {
- return;
- }
-
- // Set the default doctype from the value given in
- // TurbineResources.properties.
- setDefaultDoctype(data);
-
- // Template pages can use this to set up default templates and
- // associated class modules. It does nothing here.
- doBuildAfterAction(data);
-
- String screenName = data.getScreen();
-
- log.debug("Building " + screenName);
-
- // Ask the Screen for its Layout and then execute the Layout.
- // The Screen can override the getLayout() method to re-define
- // the Layout depending on data passed in via the
- // data.parameters object.
- Screen aScreen = screenLoader.getAssembler(screenName);
- String layout = aScreen.getLayout(data);
-
- // If the Layout has been set to be null, attempt to execute
- // the Screen that has been defined.
- if (layout != null)
- {
- layoutLoader.exec(data, layout);
- }
- else
- {
- screenLoader.exec(data, screenName);
- }
-
- // Do any post build actions (overridable by subclasses -
- // does nothing here).
- doPostBuild(data);
- }
-
- /**
- * Builds the Page.
- *
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
@@ -240,57 +176,9 @@ public class DefaultPage
doPostBuild(pipelineData);
}
-
-
- /**
- * Can be used by template Pages to stuff the Context into the
- * RunData so that it is available to the Action module and the
- * Screen module via getContext(). It does nothing here.
- *
- * @deprecated Use PipelineData version instead
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- protected void doBuildBeforeAction(RunData data)
- throws Exception
- {
- // do nothing by default
- }
-
- /**
- * Can be overridden by template Pages to set up data needed to
- * process a template. It does nothing here.
- *
- * @deprecated Use PipelineData version instead
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- protected void doBuildAfterAction(RunData data)
- throws Exception
- {
- // do nothing by default
- }
-
- /**
- * Can be overridden to perform actions when the request is
- * fully processed. It does nothing here.
- * @deprecated Use PipelineData version instead
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- protected void doPostBuild(RunData data)
- throws Exception
- {
- // do nothing by default
- }
-
-
/**
* Can be used by template Pages to stuff the Context into the
- * RunData so that it is available to the Action module and the
+ * PipelineData so that it is available to the Action module and the
* Screen module via getContext(). It does nothing here.
*
* @param data Turbine information.
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/pages/JspPage.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/pages/JspPage.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/pages/JspPage.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/pages/JspPage.java Thu Aug 13 00:35:47 2015
@@ -46,28 +46,6 @@ public class JspPage
* it is available to the Action module and the Screen module
*/
@Override
- protected void doBuildBeforeAction(RunData data)
- throws Exception
- {
- jspService.addDefaultObjects(data);
-
- try
- {
- //We try to set the buffer size from defaults
- data.getResponse().setBufferSize(jspService.getDefaultBufferSize());
- }
- catch (IllegalStateException ise)
- {
- // If the response was already committed, we die silently
- // No logger here?
- }
- }
-
- /**
- * Stuffs some useful objects into the request so that
- * it is available to the Action module and the Screen module
- */
- @Override
protected void doBuildBeforeAction(PipelineData pipelineData)
throws Exception
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/pages/TemplatePage.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/pages/TemplatePage.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/pages/TemplatePage.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/pages/TemplatePage.java Thu Aug 13 00:35:47 2015
@@ -90,13 +90,14 @@ public class TemplatePage
* Works with TemplateService to set up default templates and
* corresponding class modules.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
@Override
- protected void doBuildAfterAction(RunData data)
+ protected void doBuildAfterAction(PipelineData pipelineData)
throws Exception
{
+ RunData data = getRunData(pipelineData);
// The Template Service at this point must fetch the Screen class
// to match a given template. If the Screen class has already been
// set by an action, skip this, because the user has the already
@@ -125,19 +126,4 @@ public class TemplatePage
data.setScreen(screen);
}
}
-
- /**
- * Works with TemplateService to set up default templates and
- * corresponding class modules.
- *
- * @param pipelineData Turbine information.
- * @exception Exception, a generic exception.
- */
- @Override
- protected void doBuildAfterAction(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildAfterAction(data);
- }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/pages/VelocityPage.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/pages/VelocityPage.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/pages/VelocityPage.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/pages/VelocityPage.java Thu Aug 13 00:35:47 2015
@@ -44,39 +44,7 @@ public class VelocityPage
private VelocityService velocity;
/**
- * Stuffs the Context into the RunData so that it is available to
- * the Action module and the Screen module via getContext().
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- protected void doBuildBeforeAction(RunData data)
- throws Exception
- {
- Context context = velocity.getContext(data);
- data.getTemplateInfo()
- .setTemplateContext(VelocityService.CONTEXT, context);
- }
-
- /**
- * Allows the VelocityService to perform post-request actions.
- * (releases the (non-global) tools in the context for reuse later)
- * @deprecated. Use PipelineData version instead.
- *
- */
- @Override
- protected void doPostBuild(RunData data)
- throws Exception
- {
- Context context = velocity.getContext(data);
- velocity.requestFinished(context);
- }
-
-
- /**
- * Stuffs the Context into the RunData so that it is available to
+ * Stuffs the Context into the PipelineData so that it is available to
* the Action module and the Screen module via getContext().
*
* @param data Turbine information.
@@ -103,5 +71,4 @@ public class VelocityPage
Context context = velocity.getContext(pipelineData);
velocity.requestFinished(context);
}
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java Thu Aug 13 00:35:47 2015
@@ -54,46 +54,17 @@ public class BaseJspScreen
/**
* Method that sets up beans and forward the request to the JSP.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return null - the JSP sends the information.
- * @exception Exception, a generic exception.
- */
- public ConcreteElement buildTemplate(RunData data)
- throws Exception
- {
- String screenTemplate = data.getTemplateInfo().getScreenTemplate();
- // get the name of the JSP we want to use
- String templateName
- = templateService.getScreenTemplateName(screenTemplate);
-
- // The Template Service could not find the Screen
- if (StringUtils.isEmpty(templateName))
- {
- log.error("Screen " + screenTemplate + " not found!");
- throw new Exception("Could not find screen for " + screenTemplate);
- }
-
- // let service know whether we are using a layout
- jspService.handleRequest(data, prefix + templateName,
- getLayout(data) == null);
-
- return null;
- }
-
- /**
- * Method that sets up beans and forward the request to the JSP.
- *
* @param data Turbine information.
* @return null - the JSP sends the information.
* @exception Exception, a generic exception.
*/
+ @Override
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
RunData data = getRunData(pipelineData);
String screenTemplate = data.getTemplateInfo().getScreenTemplate();
- // get the name of the JSP we want to use
+ // get the name of the template we want to use
String templateName
= templateService.getScreenTemplateName(screenTemplate);
@@ -114,26 +85,13 @@ public class BaseJspScreen
/**
* Method to be overridden by subclasses to include data in beans, etc.
*
- * @deprecated Use PipelineData version instead.
- * @param data, the Rundata object
- * @exception Exception, a generic exception.
- */
- protected void doBuildTemplate(RunData data)
- throws Exception
- {
- // abstract method
- }
-
- /**
- * Method to be overidden by subclasses to include data in beans, etc.
- *
- * @param data, the Rundata object
+ * @param data, the PipelineData object
* @exception Exception, a generic exception.
*/
+ @Override
protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
// abstract method
}
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java Thu Aug 13 00:35:47 2015
@@ -46,13 +46,14 @@ public class Error extends Screen
/**
* Build screen.
*
- * @deprecated Use PipelineData version instead.
* @param data Turbine information.
* @return ConcreteElement the page with all the error information.
* @throws Exception a generic exception.
*/
- public ConcreteElement doBuild(RunData data) throws Exception
+ @Override
+ public ConcreteElement doBuild(PipelineData pipelineData) throws Exception
{
+ RunData data = getRunData(pipelineData);
data.setTitle("There has been an error!");
Table table = new Table().setBorder(0);
@@ -118,18 +119,4 @@ public class Error extends Screen
}
return null;
}
-
-
- /**
- * Build screen.
- *
- * @param data Turbine information.
- * @return ConcreteElement the page with all the error information.
- * @throws Exception a generic exception.
- */
- public ConcreteElement doBuild(PipelineData pipelineData) throws Exception
- {
- RunData data = getRunData(pipelineData);
- return doBuild(data);
- }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONScreen.java Thu Aug 13 00:35:47 2015
@@ -43,7 +43,7 @@ import org.jabsorb.JSONRPCBridge;
*
* <p>Here is an example from a superclass:
* <code>
- * public void doOutput(RunData data) throws Exception
+ * public void doOutput(PipelineData data) throws Exception
* {
* User user = data.getUser();
*
@@ -87,37 +87,26 @@ public class JSONScreen extends RawScree
private JsonRpcService jsonRpcService;
/**
- * @see org.apache.turbine.modules.screens.RawScreen#getContentType(org.apache.turbine.util.RunData)
- * @deprecated Use PipelineData version instead.
- */
- protected String getContentType(RunData data)
- {
- return JSONRPC_CONTENT_TYPE;
- }
-
- /**
* @see org.apache.turbine.modules.screens.RawScreen#getContentType(org.apache.turbine.pipeline.PipelineData)
*/
+ @Override
protected String getContentType(PipelineData pipelineData)
{
return JSONRPC_CONTENT_TYPE;
}
/**
- * @see org.apache.turbine.modules.screens.RawScreen#doOutput(org.apache.turbine.util.RunData)
- */
-
- /**
* Output the dynamic content.
*
- * @param data The RunData object.
- * @deprecated Use PipelineData version instead.
+ * @param pipelineData The PipelineData object.
*/
- protected void doOutput(RunData data) throws Exception
+ @Override
+ protected void doOutput(PipelineData pipelineData) throws Exception
{
+ RunData data = getRunData(pipelineData);
data.declareDirectResponse();
HttpServletRequest request = data.getRequest();
-
+
String charset = request.getCharacterEncoding();
if(charset == null)
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONSecureScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONSecureScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONSecureScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONSecureScreen.java Thu Aug 13 00:35:47 2015
@@ -20,7 +20,6 @@ package org.apache.turbine.modules.scree
*/
import org.apache.turbine.pipeline.PipelineData;
-import org.apache.turbine.util.RunData;
/**
* An extension to JSONScreen that performs a Security Check before invoking
@@ -29,7 +28,7 @@ import org.apache.turbine.util.RunData;
* the same check, you could make a base screen by extending this class and
* implementing the isAuthorized(). Then each screen that needs to perform the
* same check could extend your base screen.
- *
+ *
* <p>Typically you would extend this class and override the doOutput() method
* to use TurbineJsonRpc to register the POJOs that will provide the functions
* you are making available via JSON-RPC. Use JSONScreen if you <p>do not</b>
@@ -37,7 +36,7 @@ import org.apache.turbine.util.RunData;
*
* <p>Here is an example from a superclass:
* <code>
- * public void doOutput(RunData data) throws Exception
+ * public void doOutput(PipelineData data) throws Exception
* {
* User user = data.getUser();
*
@@ -53,7 +52,7 @@ import org.apache.turbine.util.RunData;
* super.doOutput(data);
* }
* </code>
- *
+ *
* <p>The class MyFunctions would be something like:
* <code>
* public class MySecureJsonFunctions
@@ -81,36 +80,10 @@ public abstract class JSONSecureScreen e
* This method overrides the method in JSONScreen to perform a security
* check prior to producing the output.
*
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- * @deprecated Use PipelineData version instead.
- */
- protected void doOutput(RunData data) throws Exception
- {
- if (isAuthorized(data))
- {
- super.doOutput(data);
- }
- }
-
- /**
- * Override this method to perform the necessary security checks.
- *
- * @param data Turbine information.
- * @return <code>true</code> if the user is authorized to access the screen.
- * @exception Exception A generic exception.
- * @deprecated Use PipelineData version instead.
- */
- protected abstract boolean isAuthorized(RunData data)
- throws Exception;
-
- /**
- * This method overrides the method in JSONScreen to perform a security
- * check prior to producing the output.
- *
* @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
+ @Override
protected void doOutput(PipelineData pipelineData) throws Exception
{
if (isAuthorized(pipelineData))
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java Thu Aug 13 00:35:47 2015
@@ -21,9 +21,7 @@ package org.apache.turbine.modules.scree
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
-
import org.apache.turbine.pipeline.PipelineData;
-import org.apache.turbine.util.RunData;
/**
* Directs errors at the Jsp error template defined in template.error.
@@ -37,29 +35,17 @@ public class JspErrorScreen
extends BaseJspScreen
{
/**
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception a generic exception.
*/
- protected void doBuildTemplate(RunData data)
+ @Override
+ protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
String errorTemplate = Turbine.getConfiguration()
- .getString(TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_JSP);
+ .getString(TurbineConstants.TEMPLATE_ERROR_KEY,
+ TurbineConstants.TEMPLATE_ERROR_JSP);
- setTemplate(data, errorTemplate);
+ setTemplate(pipelineData, errorTemplate);
}
-
- /**
- * @param data Turbine information.
- * @exception Exception a generic exception.
- */
- protected void doBuildTemplate(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildTemplate(data);
- }
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java Thu Aug 13 00:35:47 2015
@@ -33,10 +33,10 @@ import org.apache.turbine.util.RunData;
* that output raw binary data. For example, it may be extended into
* a Screen that outputs a SVG file or a SWF (Flash Player format)
* movie. The only thing one has to do is to implement the two
- * methods <code>getContentType(RunData data)</code> and
- * <code>doOutput(RunData data)</code> (see below).
+ * methods <code>getContentType(PipelineData data)</code> and
+ * <code>doOutput(PipelineData data)</code> (see below).
*
- * <p> You migth want to take a look at the ImageServer screen class
+ * <p> You might want to take a look at the ImageServer screen class
* contained in the TDK.<br>
*
* @author <a href="mailto:rkoenig@chez.com">Regis Koenig</a>
@@ -49,106 +49,47 @@ public abstract class RawScreen extends
* Build the Screen. This method actually makes a call to the
* doOutput() method in order to generate the Screen content.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception, a generic exception.
- */
- protected final ConcreteElement doBuild(RunData data)
- throws Exception
- {
- data.getResponse().setContentType(getContentType(data));
- data.declareDirectResponse();
- doOutput(data);
- return null;
- }
-
- /**
- * Build the Screen. This method actually makes a call to the
- * doOutput() method in order to generate the Screen content.
- *
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
+ @Override
protected final ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
RunData data = getRunData(pipelineData);
- return doBuild(data);
+ data.getResponse().setContentType(getContentType(pipelineData));
+ data.declareDirectResponse();
+ doOutput(pipelineData);
+ return null;
}
-
/**
* Set the content type. This method should be overridden to
* actually set the real content-type header of the output.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A String with the content type.
*/
- protected abstract String getContentType(RunData data);
-
- /**
- * Set the content type. This method should be overridden to
- * actually set the real content-type header of the output.
- *
- * @param data Turbine information.
- * @return A String with the content type.
- */
- protected String getContentType(PipelineData pipelineData)
- {
- RunData data = getRunData(pipelineData);
- return getContentType(data);
- }
-
-
- /**
- * Actually output the dynamic content. The OutputStream can be
- * accessed like this: <pre>OutputStream out =
- * data.getResponse().getOutputStream();</pre>.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- protected abstract void doOutput(RunData data)
- throws Exception;
+ protected abstract String getContentType(PipelineData pipelineData);
/**
* Actually output the dynamic content. The OutputStream can be
* accessed like this: <pre>OutputStream out =
* data.getResponse().getOutputStream();</pre>.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
- protected void doOutput(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doOutput(data);
- }
-
-
- /**
- * The layout must be set to null.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A null String.
- */
- public final String getLayout(RunData data)
- {
- return null;
- }
+ protected abstract void doOutput(PipelineData pipelineData) throws Exception;
/**
* The layout must be set to null.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A null String.
*/
+ @Override
public final String getLayout(PipelineData pipelineData)
{
return null;
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java Thu Aug 13 00:35:47 2015
@@ -65,71 +65,24 @@ public abstract class TemplateScreen
/**
* This method should be overridden by subclasses that wish to add
* specific business logic.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception A generic exception.
*/
- protected abstract void doBuildTemplate(RunData data)
+ protected abstract void doBuildTemplate(PipelineData pipelineData)
throws Exception;
/**
- * This method should be overridden by subclasses that wish to add
- * specific business logic.
- * Should revert to abstract when RunData has gone.
- * @param data Turbine information.
- * @exception Exception A generic exception.
- */
- protected void doBuildTemplate(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildTemplate(data);
- }
-
- /**
* This method should be implemented by Base template classes. It
* should contain the specific template service code to generate
* the template.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A ConcreteElement.
* @exception Exception A generic exception.
*/
- public abstract ConcreteElement buildTemplate(RunData data)
+ public abstract ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception;
/**
- * This method should be implemented by Base template classes. It
- * should contain the specific template service code to generate
- * the template.
- * Should revert to abstract when RunData goes.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception A generic exception.
- */
- public ConcreteElement buildTemplate(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- return buildTemplate(data);
- }
-
-
- /**
- * This method can be overridden to write code that executes when
- * the template has been built (called from a finally clause, so
- * executes regardless of whether an exception is thrown or not)
- *
- * @deprecated Use PipelineData version instead.
- */
- protected void doPostBuildTemplate(RunData data)
- {
- // empty
- }
-
- /**
* This method can be overridden to write code that executes when
* the template has been built (called from a finally clause, so
* executes regardless of whether an exception is thrown or not)
@@ -139,42 +92,15 @@ public abstract class TemplateScreen
// empty
}
-
- /**
- * This method is called by the Screenloader to construct the
- * Screen.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception A generic exception.
- */
- protected ConcreteElement doBuild(RunData data)
- throws Exception
- {
- ConcreteElement out = null;
-
- try
- {
- doBuildTemplate(data);
- out = buildTemplate(data);
- }
- finally
- {
- doPostBuildTemplate(data);
- }
-
- return out;
- }
-
/**
* This method is called by the Screenloader to construct the
* Screen.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A ConcreteElement.
* @exception Exception A generic exception.
*/
+ @Override
protected ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
@@ -193,8 +119,6 @@ public abstract class TemplateScreen
return out;
}
-
-
/**
* This method is used when you want to short circuit a Screen and
* change the template that will be executed next. <b>Note that the current
@@ -203,12 +127,12 @@ public abstract class TemplateScreen
* to be the same one as the next screen, then you should use the
* TemplateScreen.doRedirect() method.</b>
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @param template The name of the next template.
*/
- public static void setTemplate(RunData data, String template)
+ public static void setTemplate(PipelineData pipelineData, String template)
{
+ RunData data = (RunData)pipelineData;
data.getTemplateInfo().setScreenTemplate(template);
try
{
@@ -225,25 +149,6 @@ public abstract class TemplateScreen
}
/**
- * This method is used when you want to short circuit a Screen and
- * change the template that will be executed next. <b>Note that the current
- * context will be applied to the next template that is executed.
- * If you want to have the context executed for the next screen,
- * to be the same one as the next screen, then you should use the
- * TemplateScreen.doRedirect() method.</b>
- *
- * @param data Turbine information.
- * @param template The name of the next template.
- */
- public static void setTemplate(PipelineData pipelineData, String template)
- {
- //Map runDataMap = (Map) pipelineData.get(RunData.class);
- //RunData data = (RunData)runDataMap.get(RunData.class);
- RunData data = (RunData)pipelineData;
- setTemplate(data, template);
- }
-
- /**
* You can call this within a Screen to cause an internal redirect
* to happen. It essentially allows you to stop execution in one
* Screen and instantly execute another Screen. Don't worry, this
@@ -257,35 +162,7 @@ public abstract class TemplateScreen
* executing the other Screen. If there is an error, you can
* doRedirect() back to the original Screen.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @param screen Name of screen to redirect to.
- * @param template Name of template.
- * @exception Exception A generic exception.
- */
- public void doRedirect(RunData data, String screen, String template)
- throws Exception
- {
- log.debug("doRedirect(data, " + screen + ", " + template + ")");
- setTemplate(data, template);
- screenLoader.exec(data, screen);
- }
-
- /**
- * You can call this within a Screen to cause an internal redirect
- * to happen. It essentially allows you to stop execution in one
- * Screen and instantly execute another Screen. Don't worry, this
- * does not do a HTTP redirect and also if you have anything added
- * in the Context, it will get carried over.
- *
- * <p>
- *
- * This class is useful if you have a Screen that submits to
- * another Screen and you want it to do error validation before
- * executing the other Screen. If there is an error, you can
- * doRedirect() back to the original Screen.
- *
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @param screen Name of screen to redirect to.
* @param template Name of template.
* @exception Exception A generic exception.
@@ -293,13 +170,11 @@ public abstract class TemplateScreen
public void doRedirect(PipelineData pipelineData, String screen, String template)
throws Exception
{
- RunData data = getRunData(pipelineData);
log.debug("doRedirect(data, " + screen + ", " + template + ")");
- setTemplate(data, template);
+ setTemplate(pipelineData, template);
screenLoader.exec(pipelineData, screen);
}
-
/**
* You can call this within a Screen to cause an internal redirect
* to happen. It essentially allows you to stop execution in one
@@ -314,32 +189,7 @@ public abstract class TemplateScreen
* executing the other Screen. If there is an error, you can
* doRedirect() back to the original Screen.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @param template Name of template.
- * @exception Exception A generic exception.
- */
- public void doRedirect(RunData data, String template)
- throws Exception
- {
- doRedirect(data, templateService.getScreenName(template), template);
- }
-
- /**
- * You can call this within a Screen to cause an internal redirect
- * to happen. It essentially allows you to stop execution in one
- * Screen and instantly execute another Screen. Don't worry, this
- * does not do a HTTP redirect and also if you have anything added
- * in the Context, it will get carried over.
- *
- * <p>
- *
- * This class is useful if you have a Screen that submits to
- * another Screen and you want it to do error validation before
- * executing the other Screen. If there is an error, you can
- * doRedirect() back to the original Screen.
- *
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @param template Name of template.
* @exception Exception A generic exception.
*/
@@ -348,6 +198,4 @@ public abstract class TemplateScreen
{
doRedirect(pipelineData, templateService.getScreenName(template), template);
}
-
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityCachedScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityCachedScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityCachedScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityCachedScreen.java Thu Aug 13 00:35:47 2015
@@ -50,55 +50,7 @@ public class VelocityCachedScreen
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
- public ConcreteElement buildTemplate(RunData data)
- throws Exception
- {
- Context context = velocity.getContext(data);
-
- String screenTemplate = data.getTemplateInfo().getScreenTemplate();
- String templateName
- = templateService.getScreenTemplateName(screenTemplate);
-
- // The Template Service could not find the Screen
- if (StringUtils.isEmpty(templateName))
- {
- log.error("Screen " + screenTemplate + " not found!");
- throw new Exception("Could not find screen for " + screenTemplate);
- }
-
- try
- {
- velocity.handleRequest(context,
- prefix + templateName,
- data.getOut());
-
- }
- catch (Exception e)
- {
- // If there is an error, build a $processingException and
- // attempt to call the error.vm template in the screens
- // directory.
- context.put (TurbineConstants.PROCESSING_EXCEPTION_PLACEHOLDER, e.toString());
- context.put (TurbineConstants.STACK_TRACE_PLACEHOLDER, ExceptionUtils.getStackTrace(e));
-
- templateName = conf.getString(TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_VM);
-
- velocity.handleRequest(context,
- prefix + templateName,
- data.getOut());
- }
-
- return null;
- }
-
- /**
- * This builds the Velocity template.
- *
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception, a generic exception.
- */
+ @Override
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java Thu Aug 13 00:35:47 2015
@@ -47,60 +47,11 @@ public class VelocityDirectScreen
/**
* This builds the Velocity template.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception, a generic exception.
- */
- public ConcreteElement buildTemplate(RunData data)
- throws Exception
- {
- Context context = velocity.getContext(data);
-
- String screenTemplate = data.getTemplateInfo().getScreenTemplate();
- String templateName
- = templateService.getScreenTemplateName(screenTemplate);
-
- // The Template Service could not find the Screen
- if (StringUtils.isEmpty(templateName))
- {
- log.error("Screen " + screenTemplate + " not found!");
- throw new Exception("Could not find screen for " + screenTemplate);
- }
-
- try
- {
- velocity.handleRequest(context,
- prefix + templateName,
- data.getResponse().getOutputStream());
-
- }
- catch (Exception e)
- {
- // If there is an error, build a $processingException and
- // attempt to call the error.vm template in the screens
- // directory.
- context.put (TurbineConstants.PROCESSING_EXCEPTION_PLACEHOLDER, e.toString());
- context.put (TurbineConstants.STACK_TRACE_PLACEHOLDER, ExceptionUtils.getStackTrace(e));
-
- templateName = conf.getString(TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_VM);
-
- velocity.handleRequest(context,
- prefix + templateName,
- data.getResponse().getOutputStream());
- }
-
- return null;
- }
-
- /**
- * This builds the Velocity template.
- *
* @param data Turbine information.
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
+ @Override
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java Thu Aug 13 00:35:47 2015
@@ -39,38 +39,23 @@ public class VelocityErrorScreen
/**
* Implement this to add information to the context.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @param context Context for web pages.
* @exception Exception a generic exception.
*/
- protected void doBuildTemplate(RunData data, Context context)
+ @Override
+ protected void doBuildTemplate(PipelineData pipelineData, Context context)
throws Exception
{
+ RunData data = getRunData(pipelineData);
context.put (TurbineConstants.PROCESSING_EXCEPTION_PLACEHOLDER,
- data.getStackTraceException().toString());
+ data.getStackTraceException().toString());
context.put (TurbineConstants.STACK_TRACE_PLACEHOLDER,
- data.getStackTrace());
+ data.getStackTrace());
String errorTemplate = conf.getString(TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_VM);
-
- setTemplate(data, errorTemplate);
- }
+ TurbineConstants.TEMPLATE_ERROR_VM);
- /**
- * Implement this to add information to the context.
- *
- * @param pipelineData Turbine information.
- * @param context Context for web pages.
- * @exception Exception a generic exception.
- */
- protected void doBuildTemplate(PipelineData pipelineData, Context context)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildTemplate(data);
+ setTemplate(pipelineData, errorTemplate);
}
-
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java Thu Aug 13 00:35:47 2015
@@ -29,14 +29,13 @@ import org.apache.turbine.annotation.Tur
import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.template.TemplateService;
-import org.apache.turbine.services.velocity.TurbineVelocity;
import org.apache.turbine.services.velocity.VelocityService;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
/**
* Base Velocity Screen. The buildTemplate() assumes the template
- * parameter has been set in the RunData object. This provides the
+ * parameter has been set in the PipelineData object. This provides the
* ability to execute several templates from one Screen.
*
* <p>
@@ -72,24 +71,6 @@ public class VelocityScreen
* method to perform any particular business logic and add
* information to the context.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @param context Context for web pages.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- protected void doBuildTemplate(RunData data,
- Context context)
- throws Exception
- {
- // empty
- }
-
- /**
- * Velocity Screens extending this class should overide this
- * method to perform any particular business logic and add
- * information to the context.
- *
* @param pipelineData Turbine information.
* @param context Context for web pages.
* @exception Exception, a generic exception.
@@ -101,24 +82,6 @@ public class VelocityScreen
// empty
}
-
- /**
- * Needs to be implemented to make TemplateScreen like us. The
- * actual method that you should override is the one with the
- * context in the parameter list.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- protected void doBuildTemplate(RunData data)
- throws Exception
- {
- doBuildTemplate(data, velocity.getContext(data));
- }
-
/**
* Needs to be implemented to make TemplateScreen like us. The
* actual method that you should override is the one with the
@@ -137,76 +100,7 @@ public class VelocityScreen
/**
* This builds the Velocity template.
*
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return A ConcreteElement.
- * @exception Exception, a generic exception.
- */
- @Deprecated
- @Override
- public ConcreteElement buildTemplate(RunData data)
- throws Exception
- {
- String screenData = null;
-
- Context context = velocity.getContext(data);
-
- String screenTemplate = data.getTemplateInfo().getScreenTemplate();
- String templateName
- = templateService.getScreenTemplateName(screenTemplate);
-
- // The Template Service could not find the Screen
- if (StringUtils.isEmpty(templateName))
- {
- log.error("Screen " + screenTemplate + " not found!");
- throw new Exception("Could not find screen for " + screenTemplate);
- }
-
- try
- {
- // if a layout has been defined return the results, otherwise
- // send the results directly to the output stream.
- if (getLayout(data) == null)
- {
- velocity.handleRequest(context,
- prefix + templateName,
- data.getResponse().getOutputStream());
- }
- else
- {
- screenData =
- velocity.handleRequest(context, prefix + templateName);
- }
- }
- catch (Exception e)
- {
- // If there is an error, build a $processingException and
- // attempt to call the error.vm template in the screens
- // directory.
- context.put (TurbineConstants.PROCESSING_EXCEPTION_PLACEHOLDER, e.toString());
- context.put (TurbineConstants.STACK_TRACE_PLACEHOLDER, ExceptionUtils.getStackTrace(e));
-
- templateName = conf.getString(TurbineConstants.TEMPLATE_ERROR_KEY,
- TurbineConstants.TEMPLATE_ERROR_VM);
-
- screenData = velocity.handleRequest(context, prefix + templateName);
- }
-
- // package the response in an ECS element
- StringElement output = new StringElement();
- output.setFilterState(false);
-
- if (screenData != null)
- {
- output.addElement(screenData);
- }
- return output;
- }
-
- /**
- * This builds the Velocity template.
- *
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
@@ -270,33 +164,4 @@ public class VelocityScreen
}
return output;
}
-
- /**
- * Return the Context needed by Velocity.
- *
- * @param data Turbine information.
- * @return A Context.
- *
- * @deprecated Use TurbineVelocity.getContext(data)
- */
- @Deprecated
- public static Context getContext(RunData data)
- {
- return TurbineVelocity.getContext(data);
- }
-
- /**
- * Return the Context needed by Velocity.
- *
- * @param data Turbine information.
- * @return A Context.
- *
- * @deprecated Use TurbineVelocity.getContext(pipelineData)
- */
- @Deprecated
- public static Context getContext(PipelineData pipelineData)
- {
- return TurbineVelocity.getContext(pipelineData);
- }
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java Thu Aug 13 00:35:47 2015
@@ -22,8 +22,6 @@ package org.apache.turbine.modules.scree
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.velocity.TurbineVelocity;
-import org.apache.turbine.util.RunData;
-
import org.apache.velocity.context.Context;
/**
@@ -47,55 +45,23 @@ public abstract class VelocitySecureScre
/**
* Implement this to add information to the context.
*
- * @deprecated Use PipelineData version instead.
* @param data Turbine information.
* @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- protected abstract void doBuildTemplate(RunData data,
+ @Override
+ protected abstract void doBuildTemplate(PipelineData pipelineData,
Context context)
throws Exception;
/**
- * Implement this to add information to the context.
- *
- * @param data Turbine information.
- * @param context Context for web pages.
- * @exception Exception, a generic exception.
- */
- protected void doBuildTemplate(PipelineData pipelineData,
- Context context)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- doBuildTemplate(data);
- }
-
-
- /**
- * This method overrides the method in VelocityScreen to
- * perform a security check first.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @exception Exception, a generic exception.
- */
- protected void doBuildTemplate(RunData data)
- throws Exception
- {
- if (isAuthorized(data))
- {
- doBuildTemplate(data, TurbineVelocity.getContext(data));
- }
- }
-
- /**
* This method overrides the method in VelocityScreen to
* perform a security check first.
*
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
+ @Override
protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
@@ -105,21 +71,6 @@ public abstract class VelocitySecureScre
}
}
-
-
- /**
- * Implement this method to perform the security check needed.
- * You should set the template in this method that you want the
- * user to be sent to if they're unauthorized.
- *
- * @deprecated Use PipelineData version instead.
- * @param data Turbine information.
- * @return True if the user is authorized to access the screen.
- * @exception Exception, a generic exception.
- */
- protected abstract boolean isAuthorized(RunData data)
- throws Exception;
-
/**
* Implement this method to perform the security check needed.
* You should set the template in this method that you want the
@@ -130,13 +81,6 @@ public abstract class VelocitySecureScre
* @return True if the user is authorized to access the screen.
* @exception Exception, a generic exception.
*/
- protected boolean isAuthorized(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- return isAuthorized(data);
- }
-
-
-
+ protected abstract boolean isAuthorized(PipelineData pipelineData)
+ throws Exception;
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java Thu Aug 13 00:35:47 2015
@@ -23,10 +23,8 @@ package org.apache.turbine.modules.scree
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.ElementContainer;
-
import org.apache.ecs.html.A;
import org.apache.fulcrum.parser.ParameterParser;
-
import org.apache.turbine.modules.Screen;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.util.RunData;
@@ -54,12 +52,14 @@ public class InvalidState
/**
* Build the Screen.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
- public ConcreteElement doBuild(RunData data)
+ @Override
+ public ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
+ RunData data = getRunData(pipelineData);
ElementContainer body = new ElementContainer();
ElementContainer message = new ElementContainer();
@@ -86,18 +86,4 @@ public class InvalidState
body.addElement(message);
return body;
}
-
- /**
- * Build the Screen.
- *
- * @param pipelineData Turbine information.
- * @exception Exception, a generic exception.
- */
- public ConcreteElement doBuild(PipelineData pipelineData)
- throws Exception
- {
- RunData data = getRunData(pipelineData);
- return doBuild(data);
- }
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java Thu Aug 13 00:35:47 2015
@@ -20,10 +20,8 @@ package org.apache.turbine.services.asse
* under the License.
*/
-import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -54,8 +52,7 @@ public abstract class JavaBaseFactory<T
* A cache for previously obtained Class instances, which we keep in order
* to reduce the Class.forName() overhead (which can be sizable).
*/
- private final Map<String, Class<T>> classCache =
- Collections.synchronizedMap(new HashMap<String, Class<T>>());
+ private final ConcurrentHashMap<String, Class<T>> classCache = new ConcurrentHashMap<String, Class<T>>();
/**
* Get an Assembler.
@@ -75,10 +72,9 @@ public abstract class JavaBaseFactory<T
{
for (String p : packages)
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(p).append('.').append(packageName).append('.').append(name);
-
String className = sb.toString();
log.debug("Trying " + className);
@@ -86,9 +82,9 @@ public abstract class JavaBaseFactory<T
try
{
Class<T> servClass = classCache.get(className);
- if(servClass == null)
+ if (servClass == null)
{
- servClass = (Class<T>) Class.forName(className.toString());
+ servClass = (Class<T>) Class.forName(className);
classCache.put(className, servClass);
}
assembler = servClass.newInstance();
@@ -141,6 +137,7 @@ public abstract class JavaBaseFactory<T
*
* @return a Loader
*/
+ @Override
public abstract Loader<T> getLoader();
/**
@@ -148,6 +145,7 @@ public abstract class JavaBaseFactory<T
*
* @return the size of the cache in bytes
*/
+ @Override
public int getCacheSize()
{
return getLoader().getCacheSize();
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/jsonrpc/JSONProcessor.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/jsonrpc/JSONProcessor.java?rev=1695634&r1=1695633&r2=1695634&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/jsonrpc/JSONProcessor.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/jsonrpc/JSONProcessor.java Thu Aug 13 00:35:47 2015
@@ -1,7 +1,6 @@
package org.apache.turbine.services.jsonrpc;
import java.io.CharArrayWriter;
-import java.text.ParseException;
import javax.servlet.http.HttpServletRequest;
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=1695634&r1=1695633&r2=1695634&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 Thu Aug 13 00:35:47 2015
@@ -23,7 +23,6 @@ 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;
@@ -38,9 +37,6 @@ public interface JspService
/** The name used to specify this service in Turbine.properties */
String SERVICE_NAME = "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";
@@ -63,50 +59,14 @@ 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
+ * @param pipelineData the Turbine PipelineData 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 occurred while executing the JSP
- *
- * @deprecated Use the PipelineData version.
- */
- void handleRequest(RunData data, 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
- *
- * @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 pipelineData A PipelineData Object
* @param templateName The template to execute
* @param isForward whether to perform a forward or include.
*
@@ -118,7 +78,7 @@ public interface JspService
/**
* executes the JSP given by templateName.
*
- * @param data A RunData Object
+ * @param pipelineData A PipelineData Object
* @param templateName The template to execute
*
* @throws TurbineException If a problem occurred while executing the JSP
@@ -134,7 +94,7 @@ public interface JspService
int getDefaultBufferSize();
/**
- * 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/TurbineJsp.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/jsp/TurbineJsp.java?rev=1695634&r1=1695633&r2=1695634&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 Thu Aug 13 00:35:47 2015
@@ -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;
/**
@@ -50,19 +49,7 @@ public abstract class TurbineJsp
* 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
- */
- public static void addDefaultObjects(RunData data)
- {
- 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.
- *
- * @param data the turbine pipelinedData object
+ * @param pipelineData the Turbine PipelineData object
*/
public static void addDefaultObjects(PipelineData pipelineData)
{
@@ -72,38 +59,7 @@ public abstract class TurbineJsp
/**
* executes the JSP given by templateName.
*
- * @deprecated Use the PipelineData version.
- * @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 static void handleRequest(RunData data, String templateName, boolean isForward)
- throws TurbineException
- {
- getService().handleRequest(data, templateName, isForward);
- }
-
- /**
- * executes the JSP given by templateName.
- *
- * @deprecated Use the PipelineData version.
- * @param data A RunData Object
- * @param templateName The template to execute
- *
- * @throws TurbineException If a problem occurred while executing the JSP
- */
- public static void handleRequest(RunData data, String templateName)
- throws TurbineException
- {
- getService().handleRequest(data, templateName);
- }
-
- /**
- * executes the JSP given by templateName.
- *
- * @param data A RunData Object
+ * @param pipelineData A PipelineData Object
* @param templateName The template to execute
* @param isForward whether to perform a forward or include.
*
@@ -118,7 +74,7 @@ public abstract class TurbineJsp
/**
* executes the JSP given by templateName.
*
- * @param data A RunData Object
+ * @param pipelineData A PipelineData Object
* @param templateName The template to execute
*
* @throws TurbineException If a problem occurred while executing the JSP
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=1695634&r1=1695633&r2=1695634&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 Thu Aug 13 00:35:47 2015
@@ -94,32 +94,9 @@ public class TurbineJspService
* 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
- *
- * @deprecated Use the PipelineData version.
- */
- public void addDefaultObjects(RunData data)
- {
- 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 pipelinedData object
+ * @param pipelineData the Turbine PipelineData object
*/
+ @Override
public void addDefaultObjects(PipelineData pipelineData)
{
HttpServletRequest req = pipelineData.get(Turbine.class, HttpServletRequest.class);
@@ -141,6 +118,7 @@ public class TurbineJspService
*
* @return The default buffer size.
*/
+ @Override
public int getDefaultBufferSize()
{
return bufferSize;
@@ -149,33 +127,23 @@ public class TurbineJspService
/**
* executes the JSP given by templateName.
*
- * @param data A RunData Object
- * @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
- {
- handleRequest(data, templateName, false);
- }
-
- /**
- * executes the JSP given by templateName.
- *
- * @param data A RunData Object
- * @param templateName the filename of the template.
+ * @param pipelineData A PipelineData Object
+ * @param templateName The template to execute
* @param isForward whether to perform a forward or include.
- * @throws TurbineException Any exception thrown while processing will be
- * wrapped into a TurbineException and rethrown.
*
- * @deprecated Use the PipelineData version.
+ * @throws TurbineException If a problem occurred while executing the JSP
*/
- public void handleRequest(RunData data, String templateName, boolean isForward)
+ @Override
+ 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.");
+ }
+
+ RunData data = (RunData)pipelineData;
+
/** template name with relative path */
String relativeTemplateName = getRelativeTemplateName(templateName);
@@ -205,8 +173,7 @@ public class TurbineJspService
}
catch (Exception e)
{
- // as JSP service is in Alpha stage, let's try hard to send the
- // error message to the browser, to speed up debugging
+ // Let's try hard to send the error message to the browser, to speed up debugging
try
{
data.getResponse().getWriter().print("Error encountered processing a template: "
@@ -228,31 +195,12 @@ public class TurbineJspService
/**
* 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 pipelineData A PipelineData Object
* @param templateName The template to execute
*
* @throws TurbineException If a problem occurred while executing the JSP
*/
+ @Override
public void handleRequest(PipelineData pipelineData, String templateName)
throws TurbineException
{
@@ -319,7 +267,7 @@ public class TurbineJspService
}
/**
- * 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>
@@ -327,6 +275,7 @@ public class TurbineJspService
* @param template
* @return String
*/
+ @Override
public String getRelativeTemplateName(String template)
{
template = warnAbsolute(template);