geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r502081 - in /geronimo/samples/branches/2.0-M2: geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/ samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/sampl...
Date Thu, 01 Feb 2007 02:30:47 GMT
Author: prasad
Date: Wed Jan 31 18:30:47 2007
New Revision: 502081

URL: http://svn.apache.org/viewvc?view=rev&rev=502081
Log:
* do a jndi lookup of bean since injection will fail for Jetty
* open source and javadoc in new window

Modified:
    geronimo/samples/branches/2.0-M2/geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/header.html
    geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/samples/calculator/CalculatorServlet.java
    geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/header.html

Modified: geronimo/samples/branches/2.0-M2/geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/header.html
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0-M2/geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/header.html?view=diff&rev=502081&r1=502080&r2=502081
==============================================================================
--- geronimo/samples/branches/2.0-M2/geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/header.html
(original)
+++ geronimo/samples/branches/2.0-M2/geronimo-samples-archetype/src/main/resources/archetype-resources/sample-war/src/main/webapp/header.html
Wed Jan 31 18:30:47 2007
@@ -58,10 +58,10 @@
                  
         </td>
         <td valign="top" align="right">
-            <a href="xref/index.html"><img src="./images/menu_src_off_116x19.gif"
width="116" height="19" border="0"></a>
+            <a href="xref/index.html" target="source_window"><img src="./images/menu_src_off_116x19.gif"
width="116" height="19" border="0"></a>
         </td>
         <td valign="top" align="right">
-            <a href="apidocs/index.html"><img src="./images/menu_javadoc_off_116x19.gif"
width="116" height="19" border="0"></a>
+            <a href="apidocs/index.html" target="source_window"><img src="./images/menu_javadoc_off_116x19.gif"
width="116" height="19" border="0"></a>
         </td>
     </tr>
 </table>

Modified: geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/samples/calculator/CalculatorServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/samples/calculator/CalculatorServlet.java?view=diff&rev=502081&r1=502080&r2=502081
==============================================================================
--- geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/samples/calculator/CalculatorServlet.java
(original)
+++ geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/java/org/apache/geronimo/samples/calculator/CalculatorServlet.java
Wed Jan 31 18:30:47 2007
@@ -23,6 +23,10 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+
 import org.apache.geronimo.samples.slsb.calculator.CalculatorLocal;
 
 /**
@@ -33,7 +37,7 @@
  * The ejb container will route every request to different bean instances.
  */
 
- // @EJB(name="CalculatorLocal", beanInterface=CalculatorLocal.class)
+// @EJB(name="CalculatorLocal", beanInterface=CalculatorLocal.class)
 
 public class CalculatorServlet extends HttpServlet {
 
@@ -43,6 +47,28 @@
 
     public void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
+
+        if ( calc == null ) {
+            //
+            // This is needed for Jetty container in Geronimo because it doesn't handle @EJB
injection yet.
+            //
+            Context initialContext = null;
+            try {
+                initialContext = new InitialContext();
+            }
+            catch ( Exception e ) {
+                System.out.println("Cannot get initial context for JNDI: " + e.getMessage());
+                return;
+            }
+
+            try {
+                calc = (CalculatorLocal) initialContext.lookup("java:comp/env/org.apache.geronimo.samples.calculator.CalculatorServlet/calc");
+            }
+            catch ( Exception e ) {
+                System.out.println(e);
+                return;
+            }
+        }
 
         try {
             String firstNumber = req.getParameter("firstNumber");

Modified: geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/header.html
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/header.html?view=diff&rev=502081&r1=502080&r2=502081
==============================================================================
--- geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/header.html
(original)
+++ geronimo/samples/branches/2.0-M2/samples/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/header.html
Wed Jan 31 18:30:47 2007
@@ -58,10 +58,10 @@
                 &nbsp;
         </td>
         <td valign="top" align="right">
-            <a href="xref/index.html"><img src="./images/menu_src_off_116x19.gif"
width="116" height="19" border="0"></a>
+            <a href="xref/index.html" target="source_window"><img src="./images/menu_src_off_116x19.gif"
width="116" height="19" border="0"></a>
         </td>
         <td valign="top" align="right">
-            <a href="apidocs/index.html"><img src="./images/menu_javadoc_off_116x19.gif"
width="116" height="19" border="0"></a>
+            <a href="apidocs/index.html" target="source_window"><img src="./images/menu_javadoc_off_116x19.gif"
width="116" height="19" border="0"></a>
         </td>
     </tr>
 </table>



Mime
View raw message