Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:grails/grails-core

  • Loading branch information...
commit 26d2da457056c1baa0dceff864e14a381e09596f 2 parents c2534e5 + 374bcf8
@graemerocher graemerocher authored
Showing with 1,588 additions and 1,542 deletions.
  1. +18 −18 .classpath
  2. +1 −1  bin/startGrails
  3. +2 −2 bin/startGrails.bat
  4. +1 −1  build.gradle
  5. +3 −3 build.properties
  6. +1 −1  dependencies.txt
  7. +18 −18 grails.ipr
  8. BIN  lib/{org.springframework.aop-3.0.2.RELEASE.jar → org.springframework.aop-3.0.3.RELEASE.jar}
  9. BIN  lib/{org.springframework.asm-3.0.2.RELEASE.jar → org.springframework.asm-3.0.3.RELEASE.jar}
  10. BIN  lib/org.springframework.aspects-3.0.2.RELEASE.jar
  11. BIN  lib/org.springframework.aspects-3.0.3.RELEASE.jar
  12. BIN  lib/{org.springframework.beans-3.0.2.RELEASE.jar → org.springframework.beans-3.0.3.RELEASE.jar}
  13. BIN  lib/{org.springframework.context-3.0.2.RELEASE.jar → org.springframework.context-3.0.3.RELEASE.jar}
  14. BIN  ...ngframework.context.support-3.0.2.RELEASE.jar → org.springframework.context.support-3.0.3.RELEASE.jar}
  15. BIN  lib/{org.springframework.core-3.0.2.RELEASE.jar → org.springframework.core-3.0.3.RELEASE.jar}
  16. BIN  lib/{org.springframework.expression-3.0.2.RELEASE.jar → org.springframework.expression-3.0.3.RELEASE.jar}
  17. BIN  lib/org.springframework.instrument-3.0.2.RELEASE.jar
  18. BIN  lib/org.springframework.instrument-3.0.3.RELEASE.jar
  19. BIN  lib/org.springframework.instrument.tomcat-3.0.2.RELEASE.jar
  20. BIN  lib/org.springframework.instrument.tomcat-3.0.3.RELEASE.jar
  21. BIN  lib/{org.springframework.jdbc-3.0.2.RELEASE.jar → org.springframework.jdbc-3.0.3.RELEASE.jar}
  22. BIN  lib/{org.springframework.jms-3.0.2.RELEASE.jar → org.springframework.jms-3.0.3.RELEASE.jar}
  23. BIN  lib/{org.springframework.orm-3.0.2.RELEASE.jar → org.springframework.orm-3.0.3.RELEASE.jar}
  24. BIN  lib/{org.springframework.oxm-3.0.2.RELEASE.jar → org.springframework.oxm-3.0.3.RELEASE.jar}
  25. BIN  lib/{org.springframework.test-3.0.2.RELEASE.jar → org.springframework.test-3.0.3.RELEASE.jar}
  26. BIN  ...org.springframework.transaction-3.0.2.RELEASE.jar → org.springframework.transaction-3.0.3.RELEASE.jar}
  27. BIN  lib/{org.springframework.web-3.0.2.RELEASE.jar → org.springframework.web-3.0.3.RELEASE.jar}
  28. BIN  ...org.springframework.web.servlet-3.0.2.RELEASE.jar → org.springframework.web.servlet-3.0.3.RELEASE.jar}
  29. +17 −17 maven/grails.pom.in
  30. +3 −3 samples/petclinic-mvc/ivy.xml
  31. +3 −3 samples/petclinic/application.properties
  32. +1 −1  scripts/DependencyReport.groovy
  33. +19 −5 src/java/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClassProperty.java
  34. +1 −1  src/java/org/codehaus/groovy/grails/compiler/injection/GrailsASTUtils.java
  35. +6 −2 src/java/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsDomainBinder.java
  36. +3 −1 src/java/org/codehaus/groovy/grails/orm/hibernate/cfg/gorm.xsd
  37. +18 −18 src/java/org/codehaus/groovy/grails/resolve/IvyDependencyManager.groovy
  38. +123 −121 src/java/org/codehaus/groovy/grails/web/servlet/DefaultGrailsApplicationAttributes.java
  39. +55 −47 src/java/org/codehaus/groovy/grails/web/servlet/ErrorHandlingServlet.java
  40. +6 −5 src/java/org/codehaus/groovy/grails/web/servlet/FlashScope.java
  41. +54 −49 src/java/org/codehaus/groovy/grails/web/servlet/GrailsApplicationAttributes.java
  42. +22 −26 src/java/org/codehaus/groovy/grails/web/servlet/GrailsControllerHandlerMapping.java
  43. +2 −1  src/java/org/codehaus/groovy/grails/web/servlet/GrailsDispatcherServlet.java
  44. +61 −52 src/java/org/codehaus/groovy/grails/web/servlet/GrailsFlashScope.java
  45. +13 −19 src/java/org/codehaus/groovy/grails/web/servlet/GrailsRequestContext.java
  46. +6 −10 src/java/org/codehaus/groovy/grails/web/servlet/GrailsUrlPathHelper.java
  47. +60 −62 src/java/org/codehaus/groovy/grails/web/servlet/HttpHeaders.java
  48. +22 −22 src/java/org/codehaus/groovy/grails/web/servlet/WebRequestDelegatingRequestContext.java
  49. +5 −11 src/java/org/codehaus/groovy/grails/web/servlet/WrappedResponseHolder.java
  50. +23 −21 src/java/org/codehaus/groovy/grails/web/servlet/filter/GrailsReloadServletFilter.java
  51. +5 −5 src/java/org/codehaus/groovy/grails/web/servlet/filter/ResourceCopier.java
  52. +3 −7 src/java/org/codehaus/groovy/grails/web/servlet/mvc/AbstractTokenResponseHandler.java
  53. +11 −9 src/java/org/codehaus/groovy/grails/web/servlet/mvc/CommandObjectEnablingPostProcessor.java
  54. +80 −81 src/java/org/codehaus/groovy/grails/web/servlet/mvc/GrailsControllerHelper.java
  55. +95 −88 src/java/org/codehaus/groovy/grails/web/servlet/mvc/GrailsHttpSession.java
  56. +130 −146 src/java/org/codehaus/groovy/grails/web/servlet/mvc/GrailsParameterMap.groovy
  57. +19 −19 src/java/org/codehaus/groovy/grails/web/servlet/mvc/GrailsUrlHandlerMapping.java
  58. +147 −150 src/java/org/codehaus/groovy/grails/web/servlet/mvc/GrailsWebRequest.java
  59. +2 −5 src/java/org/codehaus/groovy/grails/web/servlet/mvc/ParameterInitializationCallback.java
  60. +23 −33 src/java/org/codehaus/groovy/grails/web/servlet/mvc/SimpleGrailsController.java
  61. +173 −174 src/java/org/codehaus/groovy/grails/web/servlet/mvc/SimpleGrailsControllerHelper.java
  62. +9 −9 src/java/org/codehaus/groovy/grails/web/servlet/mvc/SynchronizerToken.groovy
  63. +4 −7 src/java/org/codehaus/groovy/grails/web/servlet/mvc/TokenResponseHandler.java
  64. +9 −8 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/CannotRedirectException.groovy
  65. +13 −17 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/ControllerExecutionException.java
  66. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/GrailsMVCException.java
  67. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/IncompatibleParameterCountException.java
  68. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/InvalidUriException.java
  69. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/NoClosurePropertyForURIException.java
  70. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/NoViewNameDefinedException.java
  71. +18 −20 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/UnknownControllerException.java
  72. +19 −21 src/java/org/codehaus/groovy/grails/web/servlet/mvc/exceptions/UnsupportedReturnValueException.java
  73. +6 −9 src/java/org/codehaus/groovy/grails/web/servlet/view/GrailsViewResolver.java
  74. +70 −70 src/java/org/codehaus/groovy/grails/web/servlet/view/GroovyPageView.java
  75. +8 −7 src/java/org/codehaus/groovy/grails/web/servlet/view/NullView.java
  76. +1 −1  src/test/grails/util/GrailsUtilTests.java
  77. +25 −0 src/test/org/codehaus/groovy/grails/compiler/injection/GrailsASTUtilsTests.groovy
  78. +47 −0 src/test/org/codehaus/groovy/grails/orm/hibernate/ComponentMappingTests.groovy
  79. +5 −7 src/test/org/codehaus/groovy/grails/orm/hibernate/IdInheritanceTests.groovy
  80. +4 −3 src/test/org/codehaus/groovy/grails/orm/hibernate/MappingDslTests.groovy
View
36 .classpath
@@ -59,24 +59,24 @@
<classpathentry kind="lib" path="lib/groovy-all-1.7.3.jar"/>
<classpathentry kind="lib" path="lib/aspectjrt-1.6.8.jar"/>
<classpathentry kind="lib" path="lib/aspectjweaver-1.6.8.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.aop-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.asm-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.aspects-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.beans-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.context-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.context.support-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.core-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.expression-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.instrument-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.instrument.tomcat-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.jdbc-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.jms-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.orm-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.oxm-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.test-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.transaction-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.web-3.0.2.RELEASE.jar"/>
- <classpathentry kind="lib" path="lib/org.springframework.web.servlet-3.0.2.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.aop-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.asm-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.aspects-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.beans-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.context-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.context.support-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.core-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.expression-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.instrument-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.instrument.tomcat-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.jdbc-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.jms-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.orm-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.oxm-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.test-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.transaction-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.web-3.0.3.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/org.springframework.web.servlet-3.0.3.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/org.springframework.webflow-2.0.8.RELEASE.jar"/>
<classpathentry kind="output" path="target/eclipse/bin-output"/>
</classpath>
View
2  bin/startGrails
@@ -114,7 +114,7 @@ fi
if [ -z "$GROOVY_CONF" ]; then
GROOVY_CONF="$GRAILS_HOME/conf/groovy-starter.conf"
fi
-STARTER_CLASSPATH="$GRAILS_HOME/lib/groovy-all-1.7.3.jar:$GRAILS_HOME/dist/grails-bootstrap-1.3.2.BUILD-SNAPSHOT.jar"
+STARTER_CLASSPATH="$GRAILS_HOME/lib/groovy-all-1.7.3.jar:$GRAILS_HOME/dist/grails-bootstrap-1.3.2.jar"
# Allow access to Cocoa classes on OS X
if $darwin; then
View
4 bin/startGrails.bat
@@ -106,7 +106,7 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
-set STARTER_CLASSPATH=%GRAILS_HOME%\lib\groovy-all-1.7.3.jar;%GRAILS_HOME%\dist\grails-bootstrap-1.3.2.BUILD-SNAPSHOT.jar
+set STARTER_CLASSPATH=%GRAILS_HOME%\lib\groovy-all-1.7.3.jar;%GRAILS_HOME%\dist\grails-bootstrap-1.3.2.jar
if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"
@@ -127,7 +127,7 @@ set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar
if "%JAVA_OPTS%" == "" set JAVA_OPTS=-Xmx512m -XX:MaxPermSize=96m
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.home="%GRAILS_HOME%"
-set JAVA_OPTS=%JAVA_OPTS% -Dgrails.version="1.3.2.BUILD-SNAPSHOT"
+set JAVA_OPTS=%JAVA_OPTS% -Dgrails.version="1.3.2"
set JAVA_OPTS=%JAVA_OPTS% -Dbase.dir="."
set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"
View
2  build.gradle
@@ -9,7 +9,7 @@ buildscript {
apply id: 'groovy'
-version = '1.3.2.BUILD-SNAPSHOT'
+version = '1.3.2'
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
View
6 build.properties
@@ -1,5 +1,5 @@
-grails.version=1.3.2.BUILD-SNAPSHOT
-bundlor.grails.version=1.3.2.BUILD-SNAPSHOT
+grails.version=1.3.2
+bundlor.grails.version=1.3.2
grails.src.commons=src/commons
grails.src.groovy=src/groovy
@@ -17,7 +17,7 @@ bundlor.jndi.version=1.2.0
bundlor.servlet.jsp.version=2.1.0
bundlor.radeox.version=1.0.0.b2
bundlor.groovy.version=1.7.3
-bundlor.spring.version=3.0.2.RELEASE
+bundlor.spring.version=3.0.3.RELEASE
bundlor.ant.version=1.7.1
bundlor.ivy.version=2.0.0
bundlor.gant.version=1.9.2
View
2  dependencies.txt
@@ -148,7 +148,7 @@ The following libraries are included in Grails because they are required either
- required for running Grails applications
* org.springframework.*.jar
-- Spring Framework 3.0.2 (http://www.springframework.org) Apache 2.0 License
+- Spring Framework 3.0.3 (http://www.springframework.org) Apache 2.0 License
- required for building Grails core
- required for the command line tools (Gant)
- required for running Grails applications
View
36 grails.ipr
@@ -526,24 +526,24 @@
<root url="jar://$PROJECT_DIR$/lib/org.springframework.webflow-2.0.8.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/org.springframework.js-2.0.8.RELEASE.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/org.springframework.binding-2.0.8.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.web.servlet-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.web-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.instrument.tomcat-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.transaction-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.test-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.oxm-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.instrument-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.context.support-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.orm-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.beans-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.jms-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.jdbc-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.core-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.aspects-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.expression-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.context-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.asm-3.0.2.RELEASE.jar!/" />
- <root url="jar://$PROJECT_DIR$/lib/org.springframework.aop-3.0.2.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.web.servlet-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.web-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.instrument.tomcat-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.transaction-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.test-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.oxm-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.instrument-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.context.support-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.orm-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.beans-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.jms-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.jdbc-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.core-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.aspects-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.expression-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.context-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.asm-3.0.3.RELEASE.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/org.springframework.aop-3.0.3.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
View
BIN  ...org.springframework.aop-3.0.2.RELEASE.jar → ...org.springframework.aop-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...org.springframework.asm-3.0.2.RELEASE.jar → ...org.springframework.asm-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.aspects-3.0.2.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.aspects-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...g.springframework.beans-3.0.2.RELEASE.jar → ...g.springframework.beans-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...springframework.context-3.0.2.RELEASE.jar → ...springframework.context-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...amework.context.support-3.0.2.RELEASE.jar → ...amework.context.support-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...rg.springframework.core-3.0.2.RELEASE.jar → ...rg.springframework.core-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...ingframework.expression-3.0.2.RELEASE.jar → ...ingframework.expression-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.instrument-3.0.2.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.instrument-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.instrument.tomcat-3.0.2.RELEASE.jar
Binary file not shown
View
BIN  lib/org.springframework.instrument.tomcat-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...rg.springframework.jdbc-3.0.2.RELEASE.jar → ...rg.springframework.jdbc-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...org.springframework.jms-3.0.2.RELEASE.jar → ...org.springframework.jms-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...org.springframework.orm-3.0.2.RELEASE.jar → ...org.springframework.orm-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...org.springframework.oxm-3.0.2.RELEASE.jar → ...org.springframework.oxm-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...rg.springframework.test-3.0.2.RELEASE.jar → ...rg.springframework.test-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...ngframework.transaction-3.0.2.RELEASE.jar → ...ngframework.transaction-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...org.springframework.web-3.0.2.RELEASE.jar → ...org.springframework.web-3.0.3.RELEASE.jar
Binary file not shown
View
BIN  ...ngframework.web.servlet-3.0.2.RELEASE.jar → ...ngframework.web.servlet-3.0.3.RELEASE.jar
Binary file not shown
View
34 maven/grails.pom.in
@@ -100,7 +100,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -114,7 +114,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -128,7 +128,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -142,7 +142,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -156,7 +156,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -170,7 +170,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -184,7 +184,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -198,7 +198,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -212,7 +212,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -226,7 +226,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -240,7 +240,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -254,7 +254,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -268,7 +268,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -283,7 +283,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -297,7 +297,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -311,7 +311,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
@@ -325,7 +325,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>3.0.2.RELEASE</version>
+ <version>3.0.3.RELEASE</version>
<scope>runtime</scope>
<exclusions>
<!-- We have JCL-over-SLF4J instead. -->
View
6 samples/petclinic-mvc/ivy.xml
@@ -8,16 +8,16 @@
<conf name="runtime" extends="compile"/>
</configurations>
<dependencies>
- <dependency org="org.grails" name="grails-bootstrap" rev="1.3.1" conf="runtime">
+ <dependency org="org.grails" name="grails-bootstrap" rev="1.3.2" conf="runtime">
<exclude org="org.springframework" module="spring-instrument-classloading" name="*" type="*" ext="*" conf="" matcher="exact"/>
<exclude org="javax.validation" module="com.springsource.javax.validation" name="*" type="*" ext="*" conf="" matcher="exact"/>
</dependency>
- <dependency org="org.grails" name="grails-gorm" rev="1.3.1" conf="runtime">
+ <dependency org="org.grails" name="grails-gorm" rev="1.3.2" conf="runtime">
<exclude org="org.springframework" module="spring-instrument-classloading" name="*" type="*" ext="*" conf="" matcher="exact"/>
<exclude org="javax.validation" module="com.springsource.javax.validation" name="*" type="*" ext="*" conf="" matcher="exact"/>
</dependency>
- <dependency org="org.grails" name="grails-web" rev="1.3.1" conf="runtime">
+ <dependency org="org.grails" name="grails-web" rev="1.3.2" conf="runtime">
<exclude org="org.springframework" module="spring-instrument-classloading" name="*" type="*" ext="*" conf="" matcher="exact"/>
<exclude org="javax.validation" module="com.springsource.javax.validation" name="*" type="*" ext="*" conf="" matcher="exact"/>
View
6 samples/petclinic/application.properties
@@ -1,8 +1,8 @@
#Grails Metadata file
#Thu Oct 01 11:54:33 CEST 2009
-app.grails.version=1.3.1
+app.grails.version=1.3.2
app.name=petclinic
app.servlet.version=2.4
app.version=0.1
-plugins.hibernate=1.3.1
-plugins.tomcat=1.3.1
+plugins.hibernate=1.3.2
+plugins.tomcat=1.3.2
View
2  scripts/DependencyReport.groovy
@@ -42,7 +42,7 @@ target(dependencyReport:"Produces a dependency report for the current Grails app
}
def conf = args.trim() ?: 'build, compile, provided, runtime, test'
- ivy.report(organisation:grailsAppName, module:grailsAppName,todir:targetDir, conf:conf)
+ ivy.report(organisation:'org.grails.internal', module:grailsAppName,todir:targetDir, conf:conf)
println "Dependency report output to [$targetDir]"
}
View
24 src/java/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClassProperty.java
@@ -539,25 +539,39 @@ public ComponentDomainClass(Class<?> type) {
PropertyDescriptor[] descriptors = getPropertyDescriptors();
List tmp = getPropertyValue(GrailsDomainClassProperty.TRANSIENT, List.class);
- if (tmp!=null) transients = tmp;
- properties = createDomainClassProperties(this,descriptors);
+ if (tmp != null) transients = tmp;
+ properties = createDomainClassProperties(descriptors);
constraints = GrailsDomainConfigurationUtil.evaluateConstraints(getClazz(), properties);
DomainClassGrailsPlugin.registerConstraintsProperty(getMetaClass(), this);
}
- private GrailsDomainClassProperty[] createDomainClassProperties(
- @SuppressWarnings("hiding") ComponentDomainClass type, PropertyDescriptor[] descriptors) {
+ private GrailsDomainClassProperty[] createDomainClassProperties(PropertyDescriptor[] descriptors) {
List<DefaultGrailsDomainClassProperty> props = new ArrayList<DefaultGrailsDomainClassProperty>();
+ Collection<String> embeddedNames = getEmbeddedList();
for (int i = 0; i < descriptors.length; i++) {
PropertyDescriptor descriptor = descriptors[i];
if (isPersistentProperty(descriptor)) {
- props.add(new DefaultGrailsDomainClassProperty(type,descriptor));
+ DefaultGrailsDomainClassProperty property = new DefaultGrailsDomainClassProperty(
+ this, descriptor);
+ props.add(property);
+ if (embeddedNames.contains(property.getName())) {
+ property.setEmbedded(true);
+ }
}
}
return props.toArray(new GrailsDomainClassProperty[props.size()]);
}
+ @SuppressWarnings("unchecked")
+ private Collection<String> getEmbeddedList() {
+ Object potentialList = GrailsClassUtils.getStaticPropertyValue(getClazz(), "embedded");
+ if (potentialList instanceof Collection) {
+ return (Collection<String>)potentialList;
+ }
+ return Collections.emptyList();
+ }
+
private boolean isPersistentProperty(PropertyDescriptor descriptor) {
String propertyName = descriptor.getName();
return GrailsDomainConfigurationUtil.isNotConfigurational(descriptor) && !transients.contains(propertyName);
View
2  src/java/org/codehaus/groovy/grails/compiler/injection/GrailsASTUtils.java
@@ -114,8 +114,8 @@ public static String getFullName(ClassNode classNode) {
public static ClassNode getFurthestParent(ClassNode classNode) {
ClassNode parent = classNode.getSuperClass();
while (parent != null && !getFullName(parent).equals("java.lang.Object")) {
- parent = parent.getSuperClass();
classNode = parent;
+ parent = parent.getSuperClass();
}
return classNode;
}
View
8 src/java/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsDomainBinder.java
@@ -743,7 +743,7 @@ private static void bindDependentKeyValue(GrailsDomainClassProperty property, De
GrailsDomainClass refDomainClass = property.getDomainClass();
final Mapping mapping = getMapping(refDomainClass.getClazz());
if ((shouldCollectionBindWithJoinColumn(property) && hasCompositeIdentifier(mapping)) ||
- (hasCompositeIdentifier(mapping) && property.isManyToMany())) {
+ (hasCompositeIdentifier(mapping) && property.isManyToMany())) {
CompositeIdentity ci = (CompositeIdentity) mapping.getIdentity();
bindCompositeIdentifierToManyToOne(property, key, ci, refDomainClass, EMPTY_PATH);
}
@@ -1663,7 +1663,7 @@ else if (!"ordinal".equalsIgnoreCase(enumType)) {
Column column = new Column();
if (property.getDomainClass().isRoot()) {
- column.setNullable(property.isOptional());
+ column.setNullable(property.isOptional());
} else {
Mapping mapping = getMapping(property.getDomainClass());
if(mapping == null || mapping.getTablePerHierarchy()) {
@@ -1795,6 +1795,10 @@ else if (currentGrailsProp.isManyToOne()) {
bindManyToOne(currentGrailsProp, (ManyToOne) value, path, mappings);
}
}
+ else if (currentGrailsProp.isEmbedded()) {
+ value = new Component(persistentClass);
+ bindComponent((Component) value, currentGrailsProp, true, mappings);
+ }
else {
if (LOG.isDebugEnabled())
LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as SimpleValue");
View
4 src/java/org/codehaus/groovy/grails/orm/hibernate/cfg/gorm.xsd
@@ -18,9 +18,11 @@
<xsd:attribute name="message-source-ref" type="xsd:string" use="required" />
<xsd:attribute name="lob-handler-ref" type="xsd:string" />
<xsd:attribute name="transaction-manager-ref" type="xsd:string" />
+ <xsd:attribute name="config-location" type="xsd:string" />
+ <xsd:attribute name="config-class" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
-</xsd:schema>
+</xsd:schema>
View
36 src/java/org/codehaus/groovy/grails/resolve/IvyDependencyManager.groovy
@@ -242,7 +242,7 @@ public class IvyDependencyManager extends AbstractIvyDependencyManager implement
"org.grails:grails-web:$grailsVersion",
"org.slf4j:slf4j-api:1.5.8",
"org.slf4j:slf4j-log4j12:1.5.8",
- "org.springframework:org.springframework.test:3.0.2.RELEASE"
+ "org.springframework:org.springframework.test:3.0.3.RELEASE"
docs "org.xhtmlrenderer:core-renderer:R8",
"com.lowagie:itext:2.0.8",
@@ -277,22 +277,22 @@ public class IvyDependencyManager extends AbstractIvyDependencyManager implement
"org.grails:grails-resources:$grailsVersion",
"org.grails:grails-spring:$grailsVersion",
"org.grails:grails-web:$grailsVersion",
- "org.springframework:org.springframework.core:3.0.2.RELEASE",
- "org.springframework:org.springframework.aop:3.0.2.RELEASE",
- "org.springframework:org.springframework.aspects:3.0.2.RELEASE",
- "org.springframework:org.springframework.asm:3.0.2.RELEASE",
- "org.springframework:org.springframework.beans:3.0.2.RELEASE",
- "org.springframework:org.springframework.context:3.0.2.RELEASE",
- "org.springframework:org.springframework.context.support:3.0.2.RELEASE",
- "org.springframework:org.springframework.expression:3.0.2.RELEASE",
- "org.springframework:org.springframework.instrument:3.0.2.RELEASE",
- "org.springframework:org.springframework.jdbc:3.0.2.RELEASE",
- "org.springframework:org.springframework.jms:3.0.2.RELEASE",
- "org.springframework:org.springframework.orm:3.0.2.RELEASE",
- "org.springframework:org.springframework.oxm:3.0.2.RELEASE",
- "org.springframework:org.springframework.transaction:3.0.2.RELEASE",
- "org.springframework:org.springframework.web:3.0.2.RELEASE",
- "org.springframework:org.springframework.web.servlet:3.0.2.RELEASE",
+ "org.springframework:org.springframework.core:3.0.3.RELEASE",
+ "org.springframework:org.springframework.aop:3.0.3.RELEASE",
+ "org.springframework:org.springframework.aspects:3.0.3.RELEASE",
+ "org.springframework:org.springframework.asm:3.0.3.RELEASE",
+ "org.springframework:org.springframework.beans:3.0.3.RELEASE",
+ "org.springframework:org.springframework.context:3.0.3.RELEASE",
+ "org.springframework:org.springframework.context.support:3.0.3.RELEASE",
+ "org.springframework:org.springframework.expression:3.0.3.RELEASE",
+ "org.springframework:org.springframework.instrument:3.0.3.RELEASE",
+ "org.springframework:org.springframework.jdbc:3.0.3.RELEASE",
+ "org.springframework:org.springframework.jms:3.0.3.RELEASE",
+ "org.springframework:org.springframework.orm:3.0.3.RELEASE",
+ "org.springframework:org.springframework.oxm:3.0.3.RELEASE",
+ "org.springframework:org.springframework.transaction:3.0.3.RELEASE",
+ "org.springframework:org.springframework.web:3.0.3.RELEASE",
+ "org.springframework:org.springframework.web.servlet:3.0.3.RELEASE",
"org.slf4j:slf4j-api:1.5.8") {
transitive = false
}
@@ -301,7 +301,7 @@ public class IvyDependencyManager extends AbstractIvyDependencyManager implement
// dependencies needed for running tests
test "junit:junit:4.8.1",
"org.grails:grails-test:$grailsVersion",
- "org.springframework:org.springframework.test:3.0.2.RELEASE"
+ "org.springframework:org.springframework.test:3.0.3.RELEASE"
// dependencies needed at runtime only
runtime "org.aspectj:aspectjweaver:1.6.8",
View
244 src/java/org/codehaus/groovy/grails/web/servlet/DefaultGrailsApplicationAttributes.java
@@ -1,11 +1,11 @@
/* Copyright 2004-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,25 +43,23 @@
import org.springframework.web.util.UrlPathHelper;
/**
- * Implementation of the GrailsApplicationAttributes interface that holds knowledge about how to obtain
- * certain attributes from either the ServletContext or the HttpServletRequest instance.
+ * Holds knowledge about how to obtain certain attributes from either the ServletContext
+ * or the HttpServletRequest instance.
*
* @see org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
*
* @author Graeme Rocher
* @since 0.3
- *
- * Created: 17-Jan-2006
*/
public class DefaultGrailsApplicationAttributes implements GrailsApplicationAttributes {
-
- private static Log LOG = LogFactory.getLog(DefaultGrailsApplicationAttributes.class);
+
+ private static Log LOG = LogFactory.getLog(DefaultGrailsApplicationAttributes.class);
private UrlPathHelper urlHelper = new UrlPathHelper();
-
+
private ServletContext context;
private ApplicationContext appContext;
-
+
// Beans used very often
private GroovyPagesTemplateEngine pagesTemplateEngine;
private GrailsApplication grailsApplication;
@@ -71,8 +69,8 @@
public DefaultGrailsApplicationAttributes(ServletContext context) {
this.context = context;
- if(context != null) {
- this.appContext = (ApplicationContext)context.getAttribute(APPLICATION_CONTEXT);
+ if (context != null) {
+ appContext = (ApplicationContext)context.getAttribute(APPLICATION_CONTEXT);
}
initBeans();
}
@@ -80,40 +78,42 @@ public DefaultGrailsApplicationAttributes(ServletContext context) {
public ApplicationContext getApplicationContext() {
return appContext;
}
-
+
private void initBeans() {
- if(appContext != null) {
- this.pagesTemplateEngine=(GroovyPagesTemplateEngine)fetchBeanFromAppCtx(GroovyPagesTemplateEngine.BEAN_ID);
- this.pluginManager=(GrailsPluginManager)fetchBeanFromAppCtx(GrailsPluginManager.BEAN_NAME);
- this.grailsApplication=(GrailsApplication)fetchBeanFromAppCtx(GrailsApplication.APPLICATION_ID);
- this.groovyPagesUriService = (GroovyPagesUriService)fetchBeanFromAppCtx(GroovyPagesUriService.BEAN_ID);
- this.messageSource = (MessageSource)fetchBeanFromAppCtx("messageSource");
- } else {
- LOG.warn("ApplicationContext not found in " + APPLICATION_CONTEXT + " attribute of servlet context.");
- }
- if(this.groovyPagesUriService==null) {
- this.groovyPagesUriService = new DefaultGroovyPagesUriService();
- }
- }
-
- private Object fetchBeanFromAppCtx(String name) {
- try {
- return appContext.getBean(name);
- } catch(BeansException e) {
- LOG.warn("Bean named '" + name + "' is missing.");
- return null;
- }
+ if (appContext != null) {
+ pagesTemplateEngine = fetchBeanFromAppCtx(GroovyPagesTemplateEngine.BEAN_ID);
+ pluginManager = fetchBeanFromAppCtx(GrailsPluginManager.BEAN_NAME);
+ grailsApplication = fetchBeanFromAppCtx(GrailsApplication.APPLICATION_ID);
+ groovyPagesUriService = fetchBeanFromAppCtx(GroovyPagesUriService.BEAN_ID);
+ messageSource = fetchBeanFromAppCtx("messageSource");
+ }
+ else {
+ LOG.warn("ApplicationContext not found in " + APPLICATION_CONTEXT + " attribute of servlet context.");
+ }
+ if (groovyPagesUriService == null) {
+ groovyPagesUriService = new DefaultGroovyPagesUriService();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T fetchBeanFromAppCtx(String name) {
+ try {
+ return (T)appContext.getBean(name);
+ }
+ catch(BeansException e) {
+ LOG.warn("Bean named '" + name + "' is missing.");
+ return null;
+ }
}
public String getPluginContextPath(HttpServletRequest request) {
GroovyObject controller = getController(request);
- if(controller != null) {
+ if (controller != null) {
String path = pluginManager.getPluginPathForInstance(controller);
return path == null ? "" : path;
}
- else {
- return "";
- }
+
+ return "";
}
public GroovyObject getController(ServletRequest request) {
@@ -121,76 +121,75 @@ public GroovyObject getController(ServletRequest request) {
}
public String getControllerUri(ServletRequest request) {
- return "/"+getControllerName(request);
+ return "/" + getControllerName(request);
}
private String getControllerName(ServletRequest request) {
- String controllerName = (String) request.getAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE);
- if(controllerName==null || controllerName.length() == 0) {
- GroovyObject controller = getController(request);
- if(controller != null) {
- controllerName = (String)controller.getProperty(ControllerDynamicMethods.CONTROLLER_NAME_PROPERTY);
- request.setAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE, controllerName);
- }
- }
+ String controllerName = (String) request.getAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE);
+ if (controllerName == null || controllerName.length() == 0) {
+ GroovyObject controller = getController(request);
+ if (controller != null) {
+ controllerName = (String)controller.getProperty(ControllerDynamicMethods.CONTROLLER_NAME_PROPERTY);
+ request.setAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE, controllerName);
+ }
+ }
return controllerName != null ? controllerName : "";
}
/**
- *
* @deprecated Use {@link org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest#getContextPath() instead}
* @param request The Servlet Reqest
* @return The Application URI
*/
@Deprecated
public String getApplicationUri(ServletRequest request) {
- String appUri = (String) request.getAttribute(GrailsApplicationAttributes.APP_URI_ATTRIBUTE);
- if(appUri==null) {
- appUri=this.urlHelper.getContextPath((HttpServletRequest)request);
- }
- return appUri;
+ String appUri = (String) request.getAttribute(GrailsApplicationAttributes.APP_URI_ATTRIBUTE);
+ if (appUri == null) {
+ appUri = urlHelper.getContextPath((HttpServletRequest)request);
+ }
+ return appUri;
}
public ServletContext getServletContext() {
- return this.context;
+ return context;
}
public FlashScope getFlashScope(ServletRequest request) {
- if(request instanceof HttpServletRequest) {
- HttpServletRequest servletRequest = (HttpServletRequest) request;
- HttpSession session = servletRequest.getSession(false);
- FlashScope fs;
- if(session != null) {
- fs = (FlashScope)session.getAttribute(FLASH_SCOPE);
+ if (!(request instanceof HttpServletRequest)) {
+ return null;
+ }
+
+ HttpServletRequest servletRequest = (HttpServletRequest) request;
+ HttpSession session = servletRequest.getSession(false);
+ FlashScope fs;
+ if (session != null) {
+ fs = (FlashScope)session.getAttribute(FLASH_SCOPE);
+ }
+ else {
+ fs = (FlashScope)request.getAttribute(FLASH_SCOPE);
+ }
+ if (fs == null) {
+ fs = new GrailsFlashScope();
+ if (session!=null) {
+ session.setAttribute(FLASH_SCOPE,fs);
}
else {
- fs = (FlashScope)request.getAttribute(FLASH_SCOPE);
- }
- if(fs == null) {
- fs = new GrailsFlashScope();
- if(session!=null) {
- session.setAttribute(FLASH_SCOPE,fs);
- }
- else {
- request.setAttribute(FLASH_SCOPE,fs);
- }
+ request.setAttribute(FLASH_SCOPE,fs);
}
- return fs;
}
- return null;
+ return fs;
}
- public String getTemplateUri(CharSequence templateName, ServletRequest request) {
- return groovyPagesUriService.getTemplateURI(getControllerName(request), templateName.toString());
- }
+ public String getTemplateUri(CharSequence templateName, ServletRequest request) {
+ return groovyPagesUriService.getTemplateURI(getControllerName(request), templateName.toString());
+ }
- public String getViewUri(String viewName, HttpServletRequest request) {
+ public String getViewUri(String viewName, HttpServletRequest request) {
return groovyPagesUriService.getDeployedViewURI(getControllerName(request), viewName);
- }
+ }
public String getControllerActionUri(ServletRequest request) {
GroovyObject controller = getController(request);
-
return (String)controller.getProperty(ControllerDynamicMethods.ACTION_URI_PROPERTY);
}
@@ -199,53 +198,56 @@ public Errors getErrors(ServletRequest request) {
}
public GroovyPagesTemplateEngine getPagesTemplateEngine() {
- if(pagesTemplateEngine != null) {
- return pagesTemplateEngine;
- } else {
- throw new GroovyPagesException("No bean named ["+GroovyPagesTemplateEngine.BEAN_ID+"] defined in Spring application context!");
- }
+ if (pagesTemplateEngine != null) {
+ return pagesTemplateEngine;
+ }
+
+ throw new GroovyPagesException("No bean named [" + GroovyPagesTemplateEngine.BEAN_ID +
+ "] defined in Spring application context!");
}
public GrailsApplication getGrailsApplication() {
return grailsApplication;
}
-
+
public GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,String tagName) {
- return getTagLibraryForTag(request, response, tagName, GroovyPage.DEFAULT_NAMESPACE);
- }
-
- public GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,String tagName, String namespace) {
- String nonNullNamesapce = namespace == null ? GroovyPage.DEFAULT_NAMESPACE : namespace;
- String fullTagName = nonNullNamesapce + ":" + tagName;
-
- GrailsTagLibClass tagLibClass = (GrailsTagLibClass) getGrailsApplication().getArtefactForFeature(
+ return getTagLibraryForTag(request, response, tagName, GroovyPage.DEFAULT_NAMESPACE);
+ }
+
+ public GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,String tagName, String namespace) {
+ String nonNullNamesapce = namespace == null ? GroovyPage.DEFAULT_NAMESPACE : namespace;
+ String fullTagName = nonNullNamesapce + ":" + tagName;
+
+ GrailsTagLibClass tagLibClass = (GrailsTagLibClass) getGrailsApplication().getArtefactForFeature(
TagLibArtefactHandler.TYPE, fullTagName);
- if(tagLibClass == null)return null;
- return (GroovyObject)getApplicationContext()
- .getBean(tagLibClass.getFullName());
- }
-
- public Writer getOut(HttpServletRequest request) {
- return (Writer)request.getAttribute(OUT);
- }
-
- public void setOut(HttpServletRequest request, Writer out2) {
- request.setAttribute(OUT, out2);
- }
-
- public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
- return groovyPagesUriService.getNoSuffixViewURI(controller, viewName);
- }
-
- public String getTemplateURI(GroovyObject controller, String templateName) {
- return groovyPagesUriService.getTemplateURI(controller, templateName);
- }
-
- public GroovyPagesUriService getGroovyPagesUriService() {
- return groovyPagesUriService;
- }
-
- public MessageSource getMessageSource() {
- return messageSource;
- }
+ if (tagLibClass == null) {
+ return null;
+ }
+
+ return (GroovyObject)getApplicationContext().getBean(tagLibClass.getFullName());
+ }
+
+ public Writer getOut(HttpServletRequest request) {
+ return (Writer)request.getAttribute(OUT);
+ }
+
+ public void setOut(HttpServletRequest request, Writer out2) {
+ request.setAttribute(OUT, out2);
+ }
+
+ public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
+ return groovyPagesUriService.getNoSuffixViewURI(controller, viewName);
+ }
+
+ public String getTemplateURI(GroovyObject controller, String templateName) {
+ return groovyPagesUriService.getTemplateURI(controller, templateName);
+ }
+
+ public GroovyPagesUriService getGroovyPagesUriService() {
+ return groovyPagesUriService;
+ }
+
+ public MessageSource getMessageSource() {
+ return messageSource;
+ }
}
View
102 src/java/org/codehaus/groovy/grails/web/servlet/ErrorHandlingServlet.java
@@ -14,13 +14,21 @@
*/
package org.codehaus.groovy.grails.web.servlet;
-import com.opensymphony.module.sitemesh.*;
-import com.opensymphony.sitemesh.*;
-import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
-import com.opensymphony.sitemesh.compatability.DecoratorMapper2DecoratorSelector;
-import com.opensymphony.sitemesh.compatability.HTMLPage2Content;
-import org.codehaus.groovy.grails.web.errors.GrailsWrappedRuntimeException;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Collections;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver;
+import org.codehaus.groovy.grails.web.errors.GrailsWrappedRuntimeException;
import org.codehaus.groovy.grails.web.mapping.UrlMappingInfo;
import org.codehaus.groovy.grails.web.mapping.UrlMappingsHolder;
import org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException;
@@ -29,8 +37,8 @@
import org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException;
import org.codehaus.groovy.grails.web.sitemesh.FactoryHolder;
import org.codehaus.groovy.grails.web.util.IncludeResponseWrapper;
-import org.codehaus.groovy.grails.web.util.WebUtils;
import org.codehaus.groovy.grails.web.util.IncludedContent;
+import org.codehaus.groovy.grails.web.util.WebUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -38,31 +46,35 @@
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
-import javax.servlet.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.Writer;
-import java.io.PrintWriter;
-import java.io.OutputStreamWriter;
-import java.util.Collections;
+import com.opensymphony.module.sitemesh.Factory;
+import com.opensymphony.module.sitemesh.HTMLPage;
+import com.opensymphony.module.sitemesh.Page;
+import com.opensymphony.module.sitemesh.PageParser;
+import com.opensymphony.sitemesh.Decorator;
+import com.opensymphony.sitemesh.DecoratorSelector;
+import com.opensymphony.sitemesh.compatability.DecoratorMapper2DecoratorSelector;
+import com.opensymphony.sitemesh.compatability.HTMLPage2Content;
+import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
/**
- * A servlet for handling errors
+ * A servlet for handling errors.
*
* @author mike
* @since 1.0-RC1
*/
public class ErrorHandlingServlet extends GrailsDispatcherServlet {
- private static final long serialVersionUID = 8792197458391395589L;
- private static final String TEXT_HTML = "text/html";
+
+ private static final long serialVersionUID = 8792197458391395589L;
+ private static final String TEXT_HTML = "text/html";
private static final String GSP_SUFFIX = ".gsp";
private static final String JSP_SUFFIX = ".jsp";
+ @Override
protected HttpServletRequest checkMultipart(HttpServletRequest request) throws MultipartException {
return request; // ignore multipart requests when an error occurs
}
+ @Override
protected void doDispatch(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
int statusCode;
@@ -74,22 +86,22 @@ protected void doDispatch(final HttpServletRequest request, final HttpServletRes
}
Throwable t = null;
- if(request.getAttribute("javax.servlet.error.exception") != null) {
+ if (request.getAttribute("javax.servlet.error.exception") != null) {
t = (Throwable)request.getAttribute("javax.servlet.error.exception");
- if(!(t instanceof GrailsWrappedRuntimeException) && request.getAttribute("exception") == null) {
+ if (!(t instanceof GrailsWrappedRuntimeException) && request.getAttribute("exception") == null) {
request.setAttribute("exception", new GrailsWrappedRuntimeException(getServletContext(), t));
}
}
final UrlMappingsHolder urlMappingsHolder = lookupUrlMappings();
UrlMappingInfo matchedInfo = null;
- if(t!=null) {
+ if (t != null) {
matchedInfo = urlMappingsHolder.matchStatusCode(statusCode, t);
- if(matchedInfo == null) {
+ if (matchedInfo == null) {
matchedInfo = urlMappingsHolder.matchStatusCode(statusCode, GrailsExceptionResolver.getRootCause(t));
}
}
- if(matchedInfo == null) {
+ if (matchedInfo == null) {
matchedInfo = urlMappingsHolder.matchStatusCode(statusCode);
}
final UrlMappingInfo urlMappingInfo = matchedInfo;
@@ -99,25 +111,25 @@ protected void doDispatch(final HttpServletRequest request, final HttpServletRes
grailsWebRequestFilter.setServletContext(getServletContext());
grailsWebRequestFilter.doFilter(request, response, new FilterChain() {
+ @SuppressWarnings("unchecked")
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException {
final GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.getRequestAttributes();
urlMappingInfo.configure(webRequest);
String viewName = urlMappingInfo.getViewName();
- if(viewName == null || viewName.endsWith(GSP_SUFFIX) || viewName.endsWith(JSP_SUFFIX)) {
+ if (viewName == null || viewName.endsWith(GSP_SUFFIX) || viewName.endsWith(JSP_SUFFIX)) {
IncludedContent includeResult = WebUtils.includeForUrlMappingInfo(request, response, urlMappingInfo, Collections.EMPTY_MAP);
- if(includeResult.getRedirectURL()!=null) {
+ if (includeResult.getRedirectURL()!=null) {
response.sendRedirect(includeResult.getRedirectURL());
}
else {
layoutIncludedResponse(webRequest, includeResult, request, response);
}
-
}
else {
ViewResolver viewResolver = WebUtils.lookupViewResolver(getServletContext());
- if(viewResolver != null) {
+ if (viewResolver != null) {
View v;
try {
v = WebUtils.resolveView(request, urlMappingInfo, viewName, viewResolver);
@@ -125,13 +137,12 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
v.render(Collections.EMPTY_MAP, request, includeResponse);
IncludedContent content = new IncludedContent(includeResponse.getContentType(), includeResponse.getContent());
layoutIncludedResponse(webRequest,content, request, response);
-
- } catch (Exception e) {
+ }
+ catch (Exception e) {
throw new UrlMappingException("Error mapping onto view ["+viewName+"]: " + e.getMessage(),e);
}
}
}
-
}
});
}
@@ -145,20 +156,21 @@ private void layoutIncludedResponse(GrailsWebRequest webRequest, IncludedContent
PageParser parser = getPageParser(factory, response);
Page p = parser != null ? parser.parse(includeResult.getContentAsCharArray()) : null;
String layout = p != null ? p.getProperty("meta.layout") : null;
- if(layout != null && p != null) {
+ if (layout != null && p != null) {
final HTMLPage2Content content = new HTMLPage2Content((HTMLPage) p);
- DecoratorSelector decoratorSelector = new DecoratorMapper2DecoratorSelector(factory.getDecoratorMapper());
- SiteMeshWebAppContext webAppContext = new SiteMeshWebAppContext(request, response, webRequest.getServletContext());
- com.opensymphony.sitemesh.Decorator d = decoratorSelector.selectDecorator(content, webAppContext);
+ DecoratorSelector decoratorSelector = new DecoratorMapper2DecoratorSelector(
+ factory.getDecoratorMapper());
+ SiteMeshWebAppContext webAppContext = new SiteMeshWebAppContext(
+ request, response, webRequest.getServletContext());
+ Decorator d = decoratorSelector.selectDecorator(content, webAppContext);
- if(d!=null) {
+ if (d != null) {
response.setContentType(includeResult.getContentType());
d.render(content, webAppContext);
}
else {
writeOriginal(response, includeResult);
}
-
}
else {
writeOriginal(response, includeResult);
@@ -184,9 +196,9 @@ private void writeOriginal(HttpServletResponse response, IncludedContent include
}
private PageParser getPageParser(Factory factory, HttpServletResponse response) {
- if(factory!=null) {
+ if (factory != null) {
PageParser pageParser = factory.getPageParser(response.getContentType() != null ? response.getContentType() : "text/html");
- if(pageParser == null) {
+ if (pageParser == null) {
pageParser = factory.getPageParser("text/html;charset=UTF-8");
}
return pageParser;
@@ -194,7 +206,6 @@ private PageParser getPageParser(Factory factory, HttpServletResponse response)
return null;
}
-
private void renderDefaultResponse(HttpServletResponse response, int statusCode) throws IOException {
if (statusCode == 404) {
renderDefaultResponse(response, statusCode, "Not Found", "Page not found.");
@@ -210,23 +221,20 @@ private void renderDefaultResponse(HttpServletResponse response, int statusCode,
Writer writer = response.getWriter();
-
writer.write("<HTML>\n<HEAD>\n<TITLE>Error " + statusCode + " - " + title);
writer.write("</TITLE>\n<BODY>\n<H2>Error " + statusCode + " - " + title + ".</H2>\n");
writer.write(text + "<BR/>");
- for (int i = 0; i < 20; i++)
+ for (int i = 0; i < 20; i++) {
writer.write("\n<!-- Padding for IE -->");
+ }
writer.write("\n</BODY>\n</HTML>\n");
writer.flush();
}
private UrlMappingsHolder lookupUrlMappings() {
- WebApplicationContext wac =
- WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
-
- return (UrlMappingsHolder)wac.getBean(UrlMappingsHolder.BEAN_ID);
- }
-
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
+ return (UrlMappingsHolder)wac.getBean(UrlMappingsHolder.BEAN_ID);
+ }
}
View
11 src/java/org/codehaus/groovy/grails/web/servlet/FlashScope.java
@@ -1,11 +1,11 @@
/* Copyright 2004-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,16 +18,17 @@
import java.util.Map;
/**
- * An interface that represents flash scope and allows a flash scope map to be set to the next
+ * Represents flash scope and allows a flash scope map to be set to the next
* state. Flash scope essentially allows variables to be maintained for the next state and the next
* state only, what this means is if objects are stored inside FlashScope on the first call to
* "next()" they will be still there, but on the subsequent call they will be cleared unless they
* have been set again since the last call to "next()"
*
* @author Graeme Rocher
- * @since 07-Feb-2006
*/
+@SuppressWarnings("unchecked")
public interface FlashScope extends Map, Serializable {
+
/**
* Sets the flash scope to the next state upon a new request
*/
View
103 src/java/org/codehaus/groovy/grails/web/servlet/GrailsApplicationAttributes.java
@@ -1,3 +1,17 @@
+/* Copyright 2004-2005 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.codehaus.groovy.grails.web.servlet;
import groovy.lang.GroovyObject;
@@ -16,14 +30,13 @@
import org.springframework.validation.Errors;
/**
- * An interface defining the names of and methods to retrieve Grails specific request and servlet attributes
+ * Defines the names of and methods to retrieve Grails specific request and servlet attributes.
*
* @author Graeme Rocher
- * @since 17-Jan-2006
*/
public interface GrailsApplicationAttributes extends ApplicationAttributes {
- String PATH_TO_VIEWS = "/WEB-INF/grails-app/views";
+ String PATH_TO_VIEWS = "/WEB-INF/grails-app/views";
String GSP_TEMPLATE_ENGINE = "org.codehaus.groovy.grails.GSP_TEMPLATE_ENGINE";
String CONTENT_FORMAT = "org.codehaus.groovy.grails.CONTENT_FORMAT";
String REQUEST_FORMATS = "org.codehaus.groovy.grails.REQUEST_FORMATS";
@@ -45,7 +58,6 @@
String CONTROLLER_NAME_ATTRIBUTE = "org.codehaus.groovy.grails.CONTROLLER_NAME_ATTRIBUTE";
String APP_URI_ATTRIBUTE = "org.codehaus.groovy.grails.APP_URI_ATTRIBUTE";
-
/**
* Retrieves the plugin context path for the current request. The plugin context path is the path
* used by plugins to reference resources such as javascript, CSS and so forth
@@ -63,24 +75,21 @@
GroovyObject getController(ServletRequest request);
/**
- *
* @param request
* @return The uri of the controller within the request
*/
String getControllerUri(ServletRequest request);
/**
- *
* @param request
* @return The uri of the application relative to the server root
*/
String getApplicationUri(ServletRequest request);
-
- String getTemplateURI(GroovyObject controller, String templateName);
+ String getTemplateURI(GroovyObject controller, String templateName);
+
+ String getNoSuffixViewURI(GroovyObject controller, String viewName);
- String getNoSuffixViewURI(GroovyObject controller, String viewName);
-
/**
* Retrieves the servlet context instance
* @return The servlet context instance
@@ -93,84 +102,80 @@
* @return The FlashScope instance
*/
FlashScope getFlashScope(ServletRequest request);
-
+
/**
- *
* @param templateName
* @param request
* @return The uri of a named template for the current controller
*/
String getTemplateUri(CharSequence templateName, ServletRequest request);
-
- /**
- * Retrieves the uri of a named view
- *
- * @param viewName The name of the view
- * @param request The request instance
- * @return The name of the view
- */
- String getViewUri(String viewName, HttpServletRequest request);
/**
+ * Retrieves the uri of a named view
*
+ * @param viewName The name of the view
+ * @param request The request instance
+ * @return The name of the view
+ */
+ String getViewUri(String viewName, HttpServletRequest request);
+
+ /**
* @param request
* @return The uri of the action called within the controller
*/
String getControllerActionUri(ServletRequest request);
/**
- *
* @param request
* @return The errors instance contained within the request
*/
Errors getErrors(ServletRequest request);
/**
- *
* @return Retrieves the shared GSP template engine
*/
GroovyPagesTemplateEngine getPagesTemplateEngine();
/**
- * Retrieves a Grails tag library from the request for the named tag in
+ * Retrieves a Grails tag library from the request for the named tag in
* the default namespace GroovyPage.DEFAULT_NAMESPACE
- *
+ *
* @param request the request instance
* @param response the response instancte
* @param tagName The name of the tag that contains the tag library
- *
+ *
* @return An instance of the tag library or null if not found
*/
- GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,String tagName);
+ GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response, String tagName);
/**
- * Retrieves a Grails tag library from the request for the named tag in a
+ * Retrieves a Grails tag library from the request for the named tag in a
* given namespace.
- *
+ *
* @param request the request instance
* @param response the response instancte
* @param tagName The name of the tag that contains the tag library
* @param namespace The namespace of the tag
- *
+ *
* @return An instance of the tag library or null if not found
*/
- GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,String tagName, String namespace);
-
-
- /**
- * Holds the current response write for the request
- * @return The held response writer
- */
- Writer getOut(HttpServletRequest request);
-
- /**
- * Sets the current write for the request
- * @param currentRequest The request
- * @param out2 The writer
- */
- void setOut(HttpServletRequest currentRequest, Writer out2);
-
- GroovyPagesUriService getGroovyPagesUriService();
-
- MessageSource getMessageSource();
+ GroovyObject getTagLibraryForTag(HttpServletRequest request, HttpServletResponse response,
+ String tagName, String namespace);
+
+ /**
+ * Holds the current response write for the request
+ * @return The held response writer
+ */
+ Writer getOut(HttpServletRequest request);
+
+ /**
+ * Sets the current write for the request
+ * @param currentRequest The request
+ * @param out2 The writer
+ */
+ void setOut(HttpServletRequest currentRequest, Writer out2);
+
+ GroovyPagesUriService getGroovyPagesUriService();
+
+ MessageSource getMessageSource();
}
View
48 src/java/org/codehaus/groovy/grails/web/servlet/GrailsControllerHandlerMapping.java
@@ -15,6 +15,11 @@
package org.codehaus.groovy.grails.web.servlet;
import grails.util.Environment;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
import org.codehaus.groovy.grails.commons.ControllerArtefactHandler;
import org.codehaus.groovy.grails.commons.GrailsApplication;
import org.codehaus.groovy.grails.commons.GrailsControllerClass;
@@ -24,16 +29,13 @@
import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
import org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter;
+import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.util.UrlPathHelper;
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
/**
- * A handler mapping that matches Grails' SimpleController class
+ * Matches Grails' SimpleController class.
*
* @author Graeme Rocher
* @since 1.2
@@ -44,38 +46,39 @@
private GrailsApplication grailsApplication;
private UrlPathHelper urlHelper = new GrailsUrlPathHelper();
+ @Override
protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
String uri = urlHelper.getPathWithinApplication(request);
- if(logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled()) {
logger.debug("Looking up Grails controller for URI ["+uri+"]");
}
GrailsControllerClass controllerClass = (GrailsControllerClass) grailsApplication.getArtefactForFeature(
- ControllerArtefactHandler.TYPE, uri);
+ ControllerArtefactHandler.TYPE, uri);
return getHandlerForControllerClass(controllerClass, request);
}
/**
- * Obtains the handler for the given controller class
+ * Obtains the handler for the given controller class.
*
* @param controllerClass The controller class
* @param request The HttpServletRequest
* @return The handler
*/
- protected Object getHandlerForControllerClass(GrailsControllerClass controllerClass, HttpServletRequest request) {
- if(controllerClass!=null) {
+ protected Object getHandlerForControllerClass(GrailsControllerClass controllerClass,
+ @SuppressWarnings("unused") HttpServletRequest request) {
+ if (controllerClass != null) {
try {
return getWebApplicationContext().getBean(MAIN_CONTROLLER_BEAN, Controller.class);
}
catch (NoSuchBeanDefinitionException e) {
- // ignore
+ // ignore
}
}
return null;
}
-
@Override
protected final HandlerExecutionChain getHandlerExecutionChain(Object handler, HttpServletRequest request) {
if (handler instanceof HandlerExecutionChain) {
@@ -83,27 +86,22 @@ protected final HandlerExecutionChain getHandlerExecutionChain(Object handler, H
chain.addInterceptors(lookupInterceptors(getWebApplicationContext()));
return chain;
}
- else {
- return new HandlerExecutionChain(handler, lookupInterceptors(getWebApplicationContext()));
- }
+ return new HandlerExecutionChain(handler, lookupInterceptors(getWebApplicationContext()));
}
+ @SuppressWarnings("unchecked")
@Override
protected void extendInterceptors(List interceptors) {
setInterceptors(establishInterceptors(getWebApplicationContext()));
}
protected HandlerInterceptor[] lookupInterceptors(WebApplicationContext applicationContext) {
- HandlerInterceptor[] interceptors;
- if(Environment.getCurrent()==Environment.DEVELOPMENT) {
- interceptors = establishInterceptors(applicationContext);
+ if (Environment.getCurrent() == Environment.DEVELOPMENT) {
+ return establishInterceptors(applicationContext);
}
- else {
- interceptors = this.getAdaptedInterceptors();
- }
- return interceptors;
+ return getAdaptedInterceptors();
}
/**
@@ -113,10 +111,9 @@ protected void extendInterceptors(List interceptors) {
* @return An array of HandlerInterceptor instances
*/
protected HandlerInterceptor[] establishInterceptors(WebApplicationContext webContext) {
- HandlerInterceptor[] interceptors;
String[] interceptorNames = webContext.getBeanNamesForType(HandlerInterceptor.class);
String[] webRequestInterceptors = webContext.getBeanNamesForType( WebRequestInterceptor.class);
- interceptors = new HandlerInterceptor[interceptorNames.length+webRequestInterceptors.length];
+ HandlerInterceptor[] interceptors = new HandlerInterceptor[interceptorNames.length + webRequestInterceptors.length];
// Merge the handler and web request interceptors into a single
// array. Note that we start with the web request interceptors
@@ -124,8 +121,7 @@ protected void extendInterceptors(List interceptors) {
// web request interceptor) is invoked before the user-defined
// filters (which are attached to a handler interceptor). This
// should ensure that the Hibernate session is in the proper
- // state if and when users access the database within their
- // filters.
+ // state if and when users access the database within their filters.
int j = 0;
for (String webRequestInterceptor : webRequestInterceptors) {
interceptors[j++] = new WebRequestHandlerInterceptorAdapter((WebRequestInterceptor) webContext.getBean(webRequestInterceptor));
View
3  src/java/org/codehaus/groovy/grails/web/servlet/GrailsDispatcherServlet.java
@@ -69,6 +69,7 @@
* @since Jul 2, 2005
*/
public class GrailsDispatcherServlet extends DispatcherServlet {
+
private static final long serialVersionUID = 8295472557856192662L;
private GrailsApplication application;
protected HandlerInterceptor[] interceptors;
@@ -177,6 +178,7 @@ protected WebApplicationContext createWebApplicationContext(WebApplicationContex
protected HandlerInterceptor[] establishInterceptors(WebApplicationContext webContext) {
String[] interceptorNames = webContext.getBeanNamesForType(HandlerInterceptor.class);
String[] webRequestInterceptors = webContext.getBeanNamesForType( WebRequestInterceptor.class);
+ @SuppressWarnings("hiding")
HandlerInterceptor[] interceptors = new HandlerInterceptor[interceptorNames.length + webRequestInterceptors.length];
// Merge the handler and web request interceptors into a single array. Note that we
@@ -439,4 +441,3 @@ public HandlerExecutionChain getHandler(HttpServletRequest request, boolean cach
return super.getHandler(request, cache);
}
}
-
View
113 src/java/org/codehaus/groovy/grails/web/servlet/GrailsFlashScope.java
@@ -1,11 +1,11 @@
/* Copyright 2004-2005 the original author or authors.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,29 +16,34 @@
import groovy.lang.GroovySystem;
import groovy.lang.MetaClass;
-import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest;
-import org.springframework.web.context.request.RequestContextHolder;
-import javax.servlet.http.HttpSession;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import javax.servlet.http.HttpSession;
+
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest;
+import org.springframework.web.context.request.RequestContextHolder;
+
/**
- * Grails implementation of Flash scope (@see org.codehaus.groovy.grails.web.servlet.FlashScope)
+ * Grails implementation of Flash scope (@see org.codehaus.groovy.grails.web.servlet.FlashScope).
*
* @author Graeme Rocher
- * @since 07-Feb-2006
*/
+@SuppressWarnings("unchecked")
public class GrailsFlashScope implements FlashScope {
- private static final long serialVersionUID = 1457772347769500476L;
- private Map current = new ConcurrentHashMap();
+
+ private static final long serialVersionUID = 1457772347769500476L;
+ private Map current = new ConcurrentHashMap();
private Map next = new ConcurrentHashMap();
public static final String ERRORS_PREFIX = "org.codehaus.groovy.grails.ERRORS_";
private static final String ERRORS_PROPERTY = "errors";
- public GrailsFlashScope() {
- }
-
public void next() {
current.clear();
current = new ConcurrentHashMap(next);
@@ -57,23 +62,22 @@ private void reassociateObjectsWithErrors(Map scope) {
reassociateObjectsWithErrors((Map) value);
}
reassociateObjectWithErrors(scope, value);
-
}
}
private void reassociateObjectWithErrors(Map scope, Object value) {
- if(value instanceof Collection) {
- Collection values = (Collection)value;
- for (Object current : values) {
- reassociateObjectWithErrors(scope, current);
+ if (value instanceof Collection) {
+ Collection values = (Collection)value;
+ for (Object val : values) {
+ reassociateObjectWithErrors(scope, val);
}
}
else {
String errorsKey = ERRORS_PREFIX + System.identityHashCode(value);
Object errors = scope.get(errorsKey);
- if(value!=null && errors != null) {
+ if (value!=null && errors != null) {
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(value.getClass());
- if(mc.hasProperty(value, ERRORS_PROPERTY)!=null) {
+ if (mc.hasProperty(value, ERRORS_PROPERTY)!=null) {
mc.setProperty(value, ERRORS_PROPERTY, errors);
}
}
@@ -111,7 +115,7 @@ public Collection values() {
public void putAll(Map t) {
for (Map.Entry<Object, Object> entry : ((Map<Object,Object>)t).entrySet()) {
put(entry.getKey(), entry.getValue());
- }
+ }
}
public Set entrySet() {
@@ -129,65 +133,70 @@ public Set keySet() {
}
public Object get(Object key) {
- if(next.containsKey(key))
+ if (next.containsKey(key)) {
return next.get(key);
+ }
return current.get(key);
}
public Object remove(Object key) {
- if(current.containsKey(key))
+ if (current.containsKey(key)) {
return current.remove(key);
- else
- return next.remove(key);
+ }
+
+ return next.remove(key);
}
public Object put(Object key, Object value) {
// create the session if it doesn't exist
registerWithSessionIfNecessary();
- if(current.containsKey(key)) {
+ if (current.containsKey(key)) {
current.remove(key);
}
storeErrorsIfPossible(next,value);
- if(value == null)
+ if (value == null) {
return next.remove(key);
- else
- return next.put(key,value);
+ }
+
+ return next.put(key,value);
}
private void storeErrorsIfPossible(Map scope,Object value) {
- if(value != null) {
+ if (value == null) {
+ return;
+ }
- if(value instanceof Collection) {
- Collection values = (Collection)value;
- for (Object current : values) {
- storeErrorsIfPossible(scope, current);
- }
+ if (value instanceof Collection) {
+ Collection values = (Collection)value;
+ for (Object val : values) {
+ storeErrorsIfPossible(scope, val);
}
- else if(value instanceof Map) {
- Map map = (Map)value;
- Collection keys = new LinkedList(map.keySet());
- for (Object key : keys) {
- Object val = map.get(key);
- storeErrorsIfPossible(map, val);
- }
+ }
+ else if (value instanceof Map) {
+ Map map = (Map)value;
+ Collection keys = new LinkedList(map.keySet());
+ for (Object key : keys) {
+ Object val = map.get(key);
+ storeErrorsIfPossible(map, val);
}
- else {
- MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(value.getClass());
- if(mc.hasProperty(value, ERRORS_PROPERTY)!=null) {
- Object errors = mc.getProperty(value, ERRORS_PROPERTY);
- if(errors != null) {
- scope.put(ERRORS_PREFIX + System.identityHashCode(value), errors);
- }
+ }
+ else {
+ MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(value.getClass());
+ if (mc.hasProperty(value, ERRORS_PROPERTY)!=null) {
+ Object errors = mc.getProperty(value, ERRORS_PROPERTY);
+ if (errors != null) {
+ scope.put(ERRORS_PREFIX + System.identityHashCode(value), errors);
}
}
-
}
}
private void registerWithSessionIfNecessary() {
GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes();
HttpSession session = webRequest.getCurrentRequest().getSession(true);
- if(session.getAttribute(GrailsApplicationAttributes.FLASH_SCOPE) == null) session.setAttribute(GrailsApplicationAttributes.FLASH_SCOPE, this);
+ if (session.getAttribute(GrailsApplicationAttributes.FLASH_SCOPE) == null) {
+ session.setAttribute(GrailsApplicationAttributes.FLASH_SCOPE, this);
+ }
}
}
View
32 src/java/org/codehaus/groovy/grails/web/servlet/GrailsRequestContext.java
@@ -14,78 +14,73 @@
*/
package org.codehaus.groovy.grails.web.servlet;
-import org.springframework.context.ApplicationContext;
+import java.io.Writer;
+import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.io.Writer;
-import java.util.Map;
+
+import org.springframework.context.ApplicationContext;
/**
- * An interface that defines the methods and objects available
- * during a Grails request context
+ * Defines the methods and objects available during a Grails request context.
*
* @author Graeme Rocher
* @since 0.6
- *
- * <p/>
- * Created: Jul 20, 2007
- * Time: 6:28:17 PM
*/
public interface GrailsRequestContext {
/**
- * The request object
+ * The request object.
* @return The request object
*/
HttpServletRequest getRequest();
/**
- * The response object
+ * The response object.
* @return The response object
*/
HttpServletResponse getResponse();
/**
- * The session object
+ * The session object.
* @return The session object
*/
HttpSession getSession();
/**
- * The servletContext object
+ * The servletContext object.
* @return The servletContext Object
*/
ServletContext getServletContext();
/**
- * The params object
+ * The params object.
* @return The params object
*/
+ @SuppressWarnings("unchecked")
Map getParams();
/**
- * The ApplicationContext instance
+ * The ApplicationContext instance.
*
* @return The ApplicationCOntext
*/
ApplicationContext getApplicationContext();
/**
- * The response writer
+ * The response writer.
* @return The response writer
*/
Writer getOut();
-
/**
* @return The Action name
*/
String getActionName();
-
/**
* @return The Controller Name
*/
@@ -95,5 +90,4 @@
* @return The Request URI
*/
String getRequestURI();
-
}
View
16 src/java/org/codehaus/groovy/grails/web/servlet/GrailsUrlPathHelper.java
@@ -14,34 +14,30 @@
*/
package org.codehaus.groovy.grails.web.servlet;
-import org.springframework.web.util.UrlPathHelper;
-
import javax.servlet.http.HttpServletRequest;
+import org.springframework.web.util.UrlPathHelper;
+