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 2010/06/28 20:42:05 UTC
svn commit: r958672 - in
/turbine/core/trunk/src/java/org/apache/turbine/modules/screens:
JSONScreen.java JSONSecureScreen.java
Author: tv
Date: Mon Jun 28 18:42:04 2010
New Revision: 958672
URL: http://svn.apache.org/viewvc?rev=958672&view=rev
Log:
Added Pipeline support
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JSONSecureScreen.java
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=958672&r1=958671&r2=958672&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 Mon Jun 28 18:42:04 2010
@@ -19,15 +19,15 @@ package org.apache.turbine.modules.scree
* under the License.
*/
+import java.io.BufferedReader;
+import java.io.CharArrayWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
-import java.io.BufferedReader;
import java.io.PrintWriter;
-import java.io.CharArrayWriter;
import javax.servlet.http.HttpServletRequest;
-import org.apache.turbine.modules.screens.RawScreen;
+import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.jsonrpc.TurbineJsonRpc;
import org.apache.turbine.util.RunData;
@@ -81,19 +81,24 @@ public class JSONScreen extends RawScree
protected final static int BUFFER_SIZE = 4096;
- /*
- * (non-Javadoc)
- *
+ /**
* @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;
}
- /*
- * (non-Javadoc)
- *
+ /**
+ * @see org.apache.turbine.modules.screens.RawScreen#getContentType(org.apache.turbine.pipeline.PipelineData)
+ */
+ protected String getContentType(PipelineData pipelineData)
+ {
+ return JSONRPC_CONTENT_TYPE;
+ }
+
+ /**
* @see org.apache.turbine.modules.screens.RawScreen#doOutput(org.apache.turbine.util.RunData)
*/
@@ -101,6 +106,7 @@ public class JSONScreen extends RawScree
* Output the dynamic content.
*
* @param data The RunData object.
+ * @deprecated Use PipelineData version instead.
*/
protected void doOutput(RunData data) throws Exception
{
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=958672&r1=958671&r2=958672&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 Mon Jun 28 18:42:04 2010
@@ -19,7 +19,7 @@ package org.apache.turbine.modules.scree
* under the License.
*/
-import org.apache.turbine.modules.screens.JSONScreen;
+import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.util.RunData;
/**
@@ -83,6 +83,7 @@ public abstract class JSONSecureScreen e
*
* @param data Turbine information.
* @exception Exception, a generic exception.
+ * @deprecated Use PipelineData version instead.
*/
protected void doOutput(RunData data) throws Exception
{
@@ -98,7 +99,33 @@ public abstract class JSONSecureScreen e
* @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.
+ */
+ protected void doOutput(PipelineData pipelineData) throws Exception
+ {
+ if (isAuthorized(pipelineData))
+ {
+ super.doOutput(pipelineData);
+ }
+ }
+
+ /**
+ * Override this method to perform the necessary security checks.
+ *
+ * @param pipelineData Turbine information.
+ * @return <code>true</code> if the user is authorized to access the screen.
+ * @exception Exception A generic exception.
+ */
+ protected abstract boolean isAuthorized(PipelineData pipelineData)
+ throws Exception;
}