You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2009/06/24 16:20:32 UTC

svn commit: r788034 - in /tiles/framework/trunk: tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ tiles-velocity/src/main/java/org/apache/tiles/velocity/template/

Author: apetrelli
Date: Wed Jun 24 14:20:32 2009
New Revision: 788034

URL: http://svn.apache.org/viewvc?rev=788034&view=rev
Log:
TILES-432
Polished tiles-servlet and tiles-velocity again.

Modified:
    tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/NotAServletEnvironmentException.java
    tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletUtil.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/VelocityStyleTilesTool.java

Modified: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/NotAServletEnvironmentException.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/NotAServletEnvironmentException.java?rev=788034&r1=788033&r2=788034&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/NotAServletEnvironmentException.java (original)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/NotAServletEnvironmentException.java Wed Jun 24 14:20:32 2009
@@ -37,8 +37,8 @@
      *
      * @since 2.2.0
      */
-	public NotAServletEnvironmentException() {
-	}
+    public NotAServletEnvironmentException() {
+    }
 
     /**
      * Constructor.
@@ -46,9 +46,9 @@
      * @param message The detail message.
      * @since 2.2.0
      */
-	public NotAServletEnvironmentException(String message) {
-		super(message);
-	}
+    public NotAServletEnvironmentException(String message) {
+        super(message);
+    }
 
     /**
      * Constructor.
@@ -56,9 +56,9 @@
      * @param e The exception to be wrapped.
      * @since 2.2.0
      */
-	public NotAServletEnvironmentException(Exception e) {
-		super(e);
-	}
+    public NotAServletEnvironmentException(Exception e) {
+        super(e);
+    }
 
     /**
      * Constructor.
@@ -67,8 +67,8 @@
      * @param e The exception to be wrapped.
      * @since 2.2.0
      */
-	public NotAServletEnvironmentException(String message, Exception e) {
-		super(message, e);
-	}
+    public NotAServletEnvironmentException(String message, Exception e) {
+        super(message, e);
+    }
 
 }

Modified: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletUtil.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletUtil.java?rev=788034&r1=788033&r2=788034&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletUtil.java (original)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletUtil.java Wed Jun 24 14:20:32 2009
@@ -274,22 +274,22 @@
      * context could not be found.
      * @since 2.2.0
      */
-	public static ServletTilesRequestContext getServletRequest(TilesRequestContext request) {
-		TilesRequestContext currentRequest = request;
-		while (true) {
-			if (currentRequest == null) {
-				throw new NotAServletEnvironmentException("Last Tiles request context is null");
-			}
+    public static ServletTilesRequestContext getServletRequest(TilesRequestContext request) {
+        TilesRequestContext currentRequest = request;
+        while (true) {
+            if (currentRequest == null) {
+                throw new NotAServletEnvironmentException("Last Tiles request context is null");
+            }
 
-			if (currentRequest instanceof ServletTilesRequestContext) {
-				return (ServletTilesRequestContext) currentRequest;
-			}
-			if (!(currentRequest instanceof TilesRequestContextWrapper)) {
-				throw new NotAServletEnvironmentException("Not a Servlet environment, not supported");
-			}
-			currentRequest = ((TilesRequestContextWrapper) currentRequest).getWrappedRequest();
-		}
-	}
+            if (currentRequest instanceof ServletTilesRequestContext) {
+                return (ServletTilesRequestContext) currentRequest;
+            }
+            if (!(currentRequest instanceof TilesRequestContextWrapper)) {
+                throw new NotAServletEnvironmentException("Not a Servlet environment, not supported");
+            }
+            currentRequest = ((TilesRequestContextWrapper) currentRequest).getWrappedRequest();
+        }
+    }
 
     /**
      * Gets a servlet context from a TilesApplicationContext.
@@ -300,11 +300,11 @@
      * servlet-based.
      * @since 2.2.0
      */
-	public static ServletContext getServletContext(TilesApplicationContext applicationContext) {
-		if (applicationContext instanceof ServletTilesApplicationContext) {
-			return (ServletContext) ((ServletTilesApplicationContext) applicationContext).getContext();
-		}
+    public static ServletContext getServletContext(TilesApplicationContext applicationContext) {
+        if (applicationContext instanceof ServletTilesApplicationContext) {
+            return (ServletContext) ((ServletTilesApplicationContext) applicationContext).getContext();
+        }
 
-		throw new NotAServletEnvironmentException("Not a Servlet-based environment");
-	}
+        throw new NotAServletEnvironmentException("Not a Servlet-based environment");
+    }
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/VelocityStyleTilesTool.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/VelocityStyleTilesTool.java?rev=788034&r1=788033&r2=788034&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/VelocityStyleTilesTool.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/VelocityStyleTilesTool.java Wed Jun 24 14:20:32 2009
@@ -29,9 +29,6 @@
 import org.apache.tiles.TilesContainer;
 import org.apache.tiles.servlet.context.ServletUtil;
 import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
 /**
@@ -102,8 +99,7 @@
                 null, getResponse(), getRequest()) {
 
             public boolean render(InternalContextAdapter context, Writer writer)
-                    throws IOException, MethodInvocationException,
-                    ParseErrorException, ResourceNotFoundException {
+                    throws IOException {
                 TilesContainer container = ServletUtil.getCurrentContainer(request, getServletContext());
                 container.render(attribute, velocityContext, request, response, writer);
                 return true;
@@ -126,8 +122,7 @@
                 null, getResponse(), getRequest()) {
 
             public boolean render(InternalContextAdapter context, Writer writer)
-                    throws IOException, MethodInvocationException,
-                    ParseErrorException, ResourceNotFoundException {
+                    throws IOException {
                 TilesContainer container = ServletUtil.getCurrentContainer(request, getServletContext());
                 container.render(definitionName, velocityContext, request, response, writer);
                 return true;
@@ -149,8 +144,7 @@
                 null, getResponse(), getRequest()) {
 
             public boolean render(InternalContextAdapter context, Writer writer)
-                    throws IOException, MethodInvocationException,
-                    ParseErrorException, ResourceNotFoundException {
+                    throws IOException {
                 TilesContainer container = ServletUtil.getCurrentContainer(request, getServletContext());
                 container.renderContext(velocityContext, request, response, writer);
                 return true;