tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r525516 - in /tomcat/tc6.0.x/trunk/webapps/examples: WEB-INF/classes/chat/ChatServlet.java WEB-INF/classes/servletToJsp.java jsp/error/err.jsp jsp/forward/forward.jsp jsp/include/include.jsp jsp/jsp2/jspx/svgexample.html jsp/sessions/carts.jsp
Date Wed, 04 Apr 2007 14:06:42 GMT
Author: remm
Date: Wed Apr  4 07:06:41 2007
New Revision: 525516

URL: http://svn.apache.org/viewvc?view=rev&rev=525516
Log:
- Examples cleanup.
- Submitted by Takayuki Kaneko and Markus Schönhaber.

Modified:
    tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
    tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/servletToJsp.java
    tomcat/tc6.0.x/trunk/webapps/examples/jsp/error/err.jsp
    tomcat/tc6.0.x/trunk/webapps/examples/jsp/forward/forward.jsp
    tomcat/tc6.0.x/trunk/webapps/examples/jsp/include/include.jsp
    tomcat/tc6.0.x/trunk/webapps/examples/jsp/jsp2/jspx/svgexample.html
    tomcat/tc6.0.x/trunk/webapps/examples/jsp/sessions/carts.jsp

Modified: tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java Wed Apr  4
07:06:41 2007
@@ -73,37 +73,15 @@
         HttpServletResponse response = event.getHttpServletResponse();
         
         if (event.getEventType() == CometEvent.EventType.BEGIN) {
-            String action = request.getParameter("action");
-            if (action != null) {
-                if ("login".equals(action)) {
-                    String nickname = request.getParameter("nickname");
-                    request.getSession(true).setAttribute("nickname", nickname);
-                    response.sendRedirect("post.jsp");
-                    event.close();
-                    return;
-                } else {
-                    String nickname = (String) request.getSession(true).getAttribute("nickname");
-                    String message = request.getParameter("message");
-                    messageSender.send(nickname, message);
-                    response.sendRedirect("post.jsp");
-                    event.close();
-                    return;
-                }
-            } else {
-                if (request.getSession(true).getAttribute("nickname") == null) {
-                    // Redirect to "login"
-                    log("Redirect to login for session: " + request.getSession(true).getId());
-                    response.sendRedirect("login.jsp");
-                    event.close();
-                    return;
-                }
-            }
-            begin(event, request, response);
+            System.out.println("Begin for session: " + request.getSession(true).getId());
         } else if (event.getEventType() == CometEvent.EventType.ERROR) {
-            error(event, request, response);
+            System.out.println("Error for session: " + request.getSession(true).getId());
+            throw new ServletException("error: test message");
         } else if (event.getEventType() == CometEvent.EventType.END) {
-            end(event, request, response);
+            System.out.println("End for session: " + request.getSession(true).getId());
+            throw new ServletException("end: test message");
         } else if (event.getEventType() == CometEvent.EventType.READ) {
+            System.out.println("Read for session: " + request.getSession(true).getId());
             read(event, request, response);
         }
     }
@@ -139,6 +117,7 @@
     protected void error(CometEvent event, HttpServletRequest request, HttpServletResponse
response)
         throws IOException, ServletException {
         log("Error for session: " + request.getSession(true).getId());
+        System.out.println("Error2 for session: " + request.getSession(true).getId());
         synchronized(connections) {
             connections.remove(response);
         }
@@ -151,7 +130,10 @@
         byte[] buf = new byte[512];
         do {
             int n = is.read(buf);
+            System.out.println("Read " + n + " for session: " + request.getSession(true).getId());
             if (n > 0) {
+                System.out.println("Read " + n + " bytes: " + new String(buf, 0, n) 
+                    + " for session: " + request.getSession(true).getId());
                 log("Read " + n + " bytes: " + new String(buf, 0, n) 
                         + " for session: " + request.getSession(true).getId());
             } else if (n < 0) {

Modified: tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/servletToJsp.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/servletToJsp.java?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/servletToJsp.java (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/servletToJsp.java Wed Apr  4 07:06:41
2007
@@ -24,7 +24,7 @@
 	try {
 	    // Set the attribute and Forward to hello.jsp
 	    request.setAttribute ("servletName", "servletToJsp");
-	    getServletConfig().getServletContext().getRequestDispatcher("/jsptoserv/hello.jsp").forward(request,
response);
+	    getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request,
response);
 	} catch (Exception ex) {
 	    ex.printStackTrace ();
 	}

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/error/err.jsp
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/error/err.jsp?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/error/err.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/error/err.jsp Wed Apr  4 07:06:41 2007
@@ -24,7 +24,7 @@
 
 		if (request.getParameter("name") == null) {
 	%>
-	<%@ include file="/error/error.html" %>
+	<%@ include file="error.html" %>
 	<%
 		} else {
 		  foo.setName(request.getParameter("name"));

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/forward/forward.jsp
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/forward/forward.jsp?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/forward/forward.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/forward/forward.jsp Wed Apr  4 07:06:41 2007
@@ -11,7 +11,7 @@
    if (percent < 0.5) { 
 %>
 
-<jsp:forward page="/forward/one.jsp"/>
+<jsp:forward page="one.jsp"/>
 
 <% } else { %>
 

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/include/include.jsp
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/include/include.jsp?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/include/include.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/include/include.jsp Wed Apr  4 07:06:41 2007
@@ -26,7 +26,7 @@
 
 <%@ include file="foo.jsp" %>
 
-<p> <jsp:include page="/include/foo.html" flush="true"/> by including the output
of another JSP:
+<p> <jsp:include page="foo.html" flush="true"/> by including the output of another
JSP:
 
 <jsp:include page="foo.jsp" flush="true"/>
 

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/jsp2/jspx/svgexample.html
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/jsp2/jspx/svgexample.html?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/jsp2/jspx/svgexample.html (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/jsp2/jspx/svgexample.html Wed Apr  4 07:06:41
2007
@@ -36,8 +36,8 @@
       <li>Download <a href="http://xml.apache.org/batik/index.html">Batik</a>,
           or any other SVG viewer.</li>
       <li>Copy the following URL:
-      <a href="http://localhost:8080/jsp-examples/jsp2/jspx/textRotate.jspx?name=JSPX">
-      http://localhost:8080/jsp-examples/jsp2/jspx/textRotate.jspx?name=JSPX</a>
+      <a href="http://localhost:8080/examples/jsp/jsp2/jspx/textRotate.jspx?name=JSPX">
+      http://localhost:8080/examples/jsp/jsp2/jspx/textRotate.jspx?name=JSPX</a>
       </li>
       <li>Paste the URL into Batik's Location field and press Enter</li>
       <li>Customize by changing the name=JSPX parameter</li>

Modified: tomcat/tc6.0.x/trunk/webapps/examples/jsp/sessions/carts.jsp
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/jsp/sessions/carts.jsp?view=diff&rev=525516&r1=525515&r2=525516
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/jsp/sessions/carts.jsp (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/jsp/sessions/carts.jsp Wed Apr  4 07:06:41 2007
@@ -40,5 +40,5 @@
 </FONT>
 
 <hr>
-<%@ include file ="/sessions/carts.html" %>
+<%@ include file ="carts.html" %>
 </html>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message