You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/01/27 03:47:19 UTC

svn commit: r1236497 - in /openejb/site/trunk: content/tomcat-jms.mdtext lib/path.pm lib/view.pm

Author: dblevins
Date: Fri Jan 27 02:47:19 2012
New Revision: 1236497

URL: http://svn.apache.org/viewvc?rev=1236497&view=rev
Log:
The ability to include other pages.
A Tomcat JMS themed page

Added:
    openejb/site/trunk/content/tomcat-jms.mdtext
Modified:
    openejb/site/trunk/lib/path.pm
    openejb/site/trunk/lib/view.pm

Added: openejb/site/trunk/content/tomcat-jms.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-jms.mdtext?rev=1236497&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-jms.mdtext (added)
+++ openejb/site/trunk/content/tomcat-jms.mdtext Fri Jan 27 02:47:19 2012
@@ -0,0 +1,53 @@
+Title: Tomcat JMS
+
+Tomcat + Java EE = TomEE, the Java Enterprise Edition of Tomcat.  With TomEE you get Tomcat with JMS added and integrated and ready to go!
+
+In a plain Servlet, Filter or Listener you can do fun things like injection of JMS Topics or Queues:
+
+    import javax.annotation.Resource;
+    import javax.servlet.http.HttpServlet;
+    import javax.jms.Topic;
+    import javax.jms.Queue;
+    import javax.jms.ConnectionFactory;
+
+    public class MyServet extends HttpServlet {
+
+        @Resource(name = "foo")
+        private Topic fooTopic;
+
+        @Resource(name = "bar")
+        private Queue barQueue;
+
+        @Resource
+        private ConnectionFactory connectionFactory;
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            //...
+
+            Connection connection = connectionFactory.createConnection();
+            connection.start();
+
+            // Create a Session
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+            // Create a MessageProducer from the Session to the Topic or Queue
+            MessageProducer producer = session.createProducer(fooTopic);
+            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+            // Create a message
+            TextMessage message = session.createTextMessage("Hello World!");
+
+            // Tell the producer to send the message
+            producer.send(message);
+
+            //...
+        }
+
+    }
+
+No need to add even a single library!  In the above scenario even the "foo" Topic and the "bar" Queue would be automatically created with no configuration necessary.
+
+[Download](downloads.html) TomEE and you're minutes away from a functioning JMS application on Tomcat.
+
+{include:apache-tomee.mdtext}
\ No newline at end of file

Modified: openejb/site/trunk/lib/path.pm
URL: http://svn.apache.org/viewvc/openejb/site/trunk/lib/path.pm?rev=1236497&r1=1236496&r2=1236497&view=diff
==============================================================================
--- openejb/site/trunk/lib/path.pm (original)
+++ openejb/site/trunk/lib/path.pm Fri Jan 27 02:47:19 2012
@@ -14,7 +14,6 @@ our @patterns = (
     [qr!^/index\.html$!, news_page =>
       {
         blog     => ASF::Value::Blogs->new(blog => "openejb", limit=> 3),
-        twitter  => ASF::Value::Twitter->new(name => 'ApacheTomEE', limit => 6),
       },
     ],
 

Modified: openejb/site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/openejb/site/trunk/lib/view.pm?rev=1236497&r1=1236496&r2=1236497&view=diff
==============================================================================
--- openejb/site/trunk/lib/view.pm (original)
+++ openejb/site/trunk/lib/view.pm Fri Jan 27 02:47:19 2012
@@ -81,6 +81,16 @@ sub basic {
 
     my $template_path = "templates/$args{template}";
 
+    my @includes = ($args{content} =~ m/{include:([^ ]+?)}/g);
+
+    foreach my $include (@includes) {
+        my %a = ();
+        read_text_file("content/$include", \%a);
+        my $text = $a{content};
+        $args{headers}{title} = $a{headers}{title} unless $args{headers}{title};
+        $args{content} =~ s/{include:$include}/$text/g;
+    }
+
     my $rendered = Dotiac::DTL->new($template_path)->render(\%args);
     return ($rendered, 'html', \%args);
 }