Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r27 - trunk: . src/main/java/com/artilekt/modules/webwork src/test/java/com/artilekt/modules/jetmailer

jetmailer
Discussion topic

Back to topic list

svn commit: r27 - trunk: . src/main/java/com/artilekt/modules/webwork src/test/java/com/artilekt/modules/jetmailer

Reply

Author volenin
Full name Vladimir Olenin
Date 2006-09-05 14:05:40 PDT
Message Author: volenin
Date: 2006-09-05 14:05:40-0700
New Revision: 27

Added:
   trunk/src/main/java/​com/artilekt/modules​/webwork/FreemarkerM​anager.java
   trunk/src/main/java/​com/artilekt/modules​/webwork/SimpleViewA​ction.java
Modified:
   trunk/pom.xml
   trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a

Log:
TemplateServiceTest fixed and updated

Modified: trunk/pom.xml
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/po​m.xml?view=diff&​rev=27&p1=trunk/​pom.xml&p2=trunk​/pom.xml&r1=26​&r2=27
====================​====================​====================​==================
--- trunk/pom.xml (original)
+++ trunk/pom.xml 2006-09-05 14:05:40-0700
@@ -2,10 +2,10 @@
   xsi:schemaLocation="http://maven.apache.​org/POM/4.0.0 http://maven.apache.​org/maven-v4_0_0.xsd​">
   <modelVersion>​4.0.0</modelVersi​on>
   <groupId>com.a​rtilekt</groupId​>
- <artifactId>je​tmailer</artifact​Id>
+ <artifactId>jq​c</artifactId>​
   <packaging>jar​</packaging>
   <version>1.0.0​</version>
- <name>JetMailer components</name>
+ <name>Java Quality Components</name>
   <url>http://jetmailer.wor​dpress.com/</url​>
   <build>
     <resources>

Added: trunk/src/main/java/​com/artilekt/modules​/webwork/FreemarkerM​anager.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/main/java/com/arti​lekt/modules/webwork​/FreemarkerManager.j​ava?view=auto&re​v=27
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/main/java/​com/artilekt/modules​/webwork/FreemarkerM​anager.java 2006-09-05 14:05:40-0700
@@ -0,0 +1,80 @@
+package com.artilekt.modules.webwork;
+
+import com.opensymphony.web​work.views.freemarke​r.ScopesHashModel;
+import com.opensymphony.xwo​rk.util.OgnlValueSta​ck;
+import freemarker.cache.Mul​tiTemplateLoader;
+import freemarker.cache.Tem​plateLoader;
+import freemarker.cache.Web​appTemplateLoader;
+import freemarker.ext.beans​.BeansWrapper;
+import freemarker.ext.servl​et.HttpRequestParame​tersHashModel;
+import freemarker.ext.servl​et.HttpSessionHashMo​del;
+import freemarker.template.*;
+import org.springframework.​web.context.WebAppli​cationContext;
+import org.springframework.​web.context.support.​WebApplicationContex​tUtils;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.H​ttpServletRequest;
+import javax.servlet.http.H​ttpServletResponse;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: volenin
+ * Date: Apr 4, 2006
+ * Time: 10:15:24 AM
+ */
+public class FreemarkerManager extends com.opensymphony.web​work.views.freemarke​r.FreemarkerManager {
+
+ public void populateContext(ScopesHashModel model, OgnlValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
+ super.populateContext(model, stack, action, request, response);
+ model.put("param", new HttpRequestParameter​sHashModel(request))​;
+ model.put("sess", new HttpSessionHashModel​(request.getSession(​), getObjectWrapper()));
+ }
+
+
+ protected Configuration createConfiguration(​ServletContext servletContext) throws TemplateException {
+ Configuration config = super.createConfigur​ation(servletContext​);
+
+ config.setTagSyntax(​Configuration.AUTO_D​ETECT_TAG_SYNTAX);
+ config.setSharedVari​able("beans", new SpringBeansModel(ser​vletContext, getObjectWrapper()));
+ config.setTemplateEx​ceptionHandler(Templ​ateExceptionHandler.​RETHROW_HANDLER);
+
+ return config;
+ }
+
+
+ protected TemplateLoader getTemplateLoader(Se​rvletContext servletContext) {
+ TemplateLoader wwLoader = super.getTemplateLoa​der(servletContext);​
+ String templatePath = servletContext.getIn​itParameter("WebappT​emplatePath");
+ if (templatePath == null) {
+ templatePath = servletContext.getIn​itParameter("webappT​emplatePath");
+ }
+ if (templatePath != null) {
+ TemplateLoader templatePathLoader = new WebappTemplateLoader​(servletContext, templatePath);
+ return new MultiTemplateLoader(new TemplateLoader[]{
+ templatePathLoader,
+ wwLoader
+ });
+ }
+ return wwLoader;
+ }
+
+
+ private static class SpringBeansModel implements TemplateHashModel {
+ private WebApplicationContext appContext;
+ private BeansWrapper beansWrapper;
+
+ public SpringBeansModel(ServletContext servletContext, BeansWrapper beansWrapper) {
+ this.appContext = WebApplicationContex​tUtils.getRequiredWe​bApplicationContext(​servletContext);
+ this.beansWrapper = beansWrapper;
+ }
+
+ public TemplateModel get(String string) throws TemplateModelException {
+ return beansWrapper.wrap(ap​pContext.getBean(str​ing));
+ }
+
+ public boolean isEmpty() throws TemplateModelException {
+ return appContext.getBeanDe​finitionCount() <= 0;
+ }
+ }
+
+}

Added: trunk/src/main/java/​com/artilekt/modules​/webwork/SimpleViewA​ction.java
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/main/java/com/arti​lekt/modules/webwork​/SimpleViewAction.ja​va?view=auto&rev​=27
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/main/java/​com/artilekt/modules​/webwork/SimpleViewA​ction.java 2006-09-05 14:05:40-0700
@@ -0,0 +1,31 @@
+package com.artilekt.modules.webwork;
+
+import com.opensymphony.xwo​rk.ActionContext;
+import com.opensymphony.xwo​rk.ActionProxy;
+import com.opensymphony.xwo​rk.ActionSupport;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: volenin
+ * Date: Mar 30, 2006
+ * Time: 3:08:21 PM
+ */
+public class SimpleViewAction extends ActionSupport {
+ private String result = SUCCESS;
+
+ public String execute() throws Exception {
+ return result;
+ }
+
+
+ public String getActionURI() {
+ ActionProxy action = ActionContext.getCon​text().getActionInvo​cation().getProxy();​
+ String url = action.getNamespace(​)+"/"+action.getActi​onName();
+ if (url.startsWith("/")) url = url.substring(1, url.length());
+ return url;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+}

Modified: trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a
Url: http://jetmailer.tig​ris.org/source/brows​e/jetmailer/trunk/sr​c/test/java/com/arti​lekt/modules/jetmail​er/SimpleEmailDispat​cherTest.java?view=d​iff&rev=27&p​1=trunk/src/test/jav​a/com/artilekt/modul​es/jetmailer/SimpleE​mailDispatcherTest.j​ava&p2=trunk/src​/test/java/com/artil​ekt/modules/jetmaile​r/SimpleEmailDispatc​herTest.java&r1=​26&r2=27
====================​====================​====================​==================
--- trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a (original)
+++ trunk/src/test/java/​com/artilekt/modules​/jetmailer/SimpleEma​ilDispatcherTest.jav​a 2006-09-05 14:05:40-0700
@@ -60,7 +60,7 @@
   }
 
   protected String getBeanFactorySelectorPath() {
- return "classpath*:com/arti​lekt/**/beanRefFacto​ry.xml";
+ return "classpath:com/artil​ekt/modules/jetmaile​r/beanRefFactory.xml​";
   }
 
   public static void main(String[] args) throws Exception {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r27 - trunk: . src/main/java/com/artilekt/modules/webwork src/test/java/com/artilekt/modules/jetmailer volenin Vladimir Olenin 2006-09-05 14:05:40 PDT
Messages per page: