You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/06/06 22:53:33 UTC
svn commit: r664120 [6/13] - in /geronimo/samples/trunk/samples: ./
app-per-port/ app-per-port/app-per-port-connector-war/
app-per-port/app-per-port-connector-war/src/main/webapp/WEB-INF/
app-per-port/app-per-port-ear/ app-per-port/app-per-port-tomcat/...
Modified: geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/header.html
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/header.html?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/header.html (original)
+++ geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/header.html Fri Jun 6 13:53:24 2008
@@ -16,40 +16,42 @@
-->
<html>
- <head>
- <link type="text/css" rel="stylesheet" href="http://geronimo.apache.org/style/default.css">
- <link rel="SHORTCUT ICON" href="http://geronimo.apache.org/images/favicon.ico">
- <script src="http://geronimo.apache.org/functions.js" type="text/javascript"></script><title>Apache Geronimo Sample Applications</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
- </head>
-
- <body onload="init()">
-
- <table valign="top" background="http://geronimo.apache.org/images/header_bg_1x86.gif" border="0" cellpadding="0" cellspacing="0" width="100%">
- <tbody>
- <tr>
- <td valing="top" align="left">
- <a href="http://geronimo.apache.org/"><img src="http://geronimo.apache.org/images/topleft_logo_437x64.gif" border="0"></a>
- </td>
- <td width="100%">
-
- </td>
- </tr>
- </tbody>
- </table>
-
- <table border="0" cellpadding="2" cellspacing="0" width="100%">
- <tbody>
- <tr class="topBar">
- <td class="topBarDiv" align="left" nowrap="true" valign="middle" width="100%">
- <a href="http://geronimo.apache.org/" title="Apache Geronimo Home" target="_blank">Apache Geronimo Home</a> | <a href="http://cwiki.apache.org/geronimo/" title="Geronimo Documentation"target="_blank">Documentation</a> | <a href="http://cwiki.apache.org/GMOxSAMPLES/" title="Sample Applications"target="_blank">Sample Applications</a>
- </td>
- <td class="topBarDiv" align="left" nowrap="true" valign="middle">
- <a href="xref/index.html" target="source_window">Source Code</a> | <a href="apidocs/index.html" target="source_window">Java Docs</a>
- </td>
- </tr>
- </tbody>
- </table>
+<head>
+ <link type="text/css" rel="stylesheet" href="http://geronimo.apache.org/style/default.css">
+ <link rel="SHORTCUT ICON" href="http://geronimo.apache.org/images/favicon.ico">
+ <script src="http://geronimo.apache.org/functions.js" type="text/javascript"></script>
+ <title>Apache Geronimo Sample Applications</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+</head>
- </body>
+<body onload="init()">
+
+<table valign="top" background="http://geronimo.apache.org/images/header_bg_1x86.gif" border="0" cellpadding="0" cellspacing="0" width="100%">
+ <tbody>
+ <tr>
+ <td valing="top" align="left">
+ <a href="http://geronimo.apache.org/"><img src="http://geronimo.apache.org/images/topleft_logo_437x64.gif" border="0"></a>
+ </td>
+ <td width="100%">
+
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<table border="0" cellpadding="2" cellspacing="0" width="100%">
+ <tbody>
+ <tr class="topBar">
+ <td class="topBarDiv" align="left" nowrap="true" valign="middle" width="100%">
+ <a href="http://geronimo.apache.org/" title="Apache Geronimo Home" target="_blank">Apache Geronimo Home</a> | <a href="http://cwiki.apache.org/geronimo/" title="Geronimo Documentation" target="_blank">Documentation</a>
+ | <a href="http://cwiki.apache.org/GMOxSAMPLES/" title="Sample Applications" target="_blank">Sample Applications</a>
+ </td>
+ <td class="topBarDiv" align="left" nowrap="true" valign="middle">
+ <a href="xref/index.html" target="source_window">Source Code</a> | <a href="apidocs/index.html" target="source_window">Java Docs</a>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+</body>
</html>
\ No newline at end of file
Modified: geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/index.html?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/index.html (original)
+++ geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/index.html Fri Jun 6 13:53:24 2008
@@ -17,13 +17,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd class="cell"">
<html>
<head>
- <title>Apache Geronimo Sample Application</title>
- <meta content="text/html; CHARSET=iso-8859-1" http-equiv="Content-Type">
+ <title>Apache Geronimo Sample Application</title>
+ <meta content="text/html; CHARSET=iso-8859-1" http-equiv="Content-Type">
</head>
<FRAMESET rows="86px,*" frameborder="0">
<FRAME src="./header.html" name="headerFrame" title="Header" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no">
<FRAME src="./order.jsp" name="sampleDocumentFrame" title="Order Management System" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no">
</FRAMESET>
-
+
</html>
Modified: geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/order.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/order.jsp?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/order.jsp (original)
+++ geronimo/samples/trunk/samples/jms-mdb-sample/jms-mdb-sample-war/src/main/webapp/order.jsp Fri Jun 6 13:53:24 2008
@@ -1,61 +1,62 @@
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
-->
<HTML>
<HEAD><TITLE>Welcome</TITLE></HEAD>
<BODY>
- <div div=true align="center">
- <strong><H2>Welcome to the Order Management System</H2><br><br><br></strong>
+<div div=true align="center">
+ <strong><H2>Welcome to the Order Management System</H2><br><br><br></strong>
+
<FORM method="POST" action="order">
- <TABLE width="90%" border="0" style="background-color: cyan">
- <TR>
- <TD><strong>Customer Id</strong></TD>
- <TD><strong><INPUT type="text" name="customerId"></strong></TD>
- </TR>
- <TR>
- <TD><strong>Order Id</strong></TD>
- <TD><strong><INPUT type="text" name="orderId"></strong></TD>
- </TR>
- <TR>
- <TD><strong>Quantity</strong></TD>
- <TD><strong><INPUT type="text" name="quantity"></strong></TD>
- </TR>
- <TR>
- <TD><strong>Model</strong></TD>
- <TD>
- <strong>
- <SELECT name="model">
- <OPTION value="101">Type 1</OPTION>
- <OPTION value="102">Type 2</OPTION>
- <OPTION value="103">Type 3</OPTION>
- <OPTION value="104">Type 4</OPTION>
- <OPTION value="105">Type 5</OPTION>
- <OPTION value="106">Type 6</OPTION>
- <OPTION value="107">Type 7</OPTION>
- </SELECT>
- </strong>
- </TD>
- </TR>
- </TABLE>
- <BR><BR>
- <INPUT type="submit" value="Order">
- <INPUT type="reset" value="Cancel">
- </FORM>
- </div>
+ <TABLE width="90%" border="0" style="background-color: cyan">
+ <TR>
+ <TD><strong>Customer Id</strong></TD>
+ <TD><strong><INPUT type="text" name="customerId"></strong></TD>
+ </TR>
+ <TR>
+ <TD><strong>Order Id</strong></TD>
+ <TD><strong><INPUT type="text" name="orderId"></strong></TD>
+ </TR>
+ <TR>
+ <TD><strong>Quantity</strong></TD>
+ <TD><strong><INPUT type="text" name="quantity"></strong></TD>
+ </TR>
+ <TR>
+ <TD><strong>Model</strong></TD>
+ <TD>
+ <strong>
+ <SELECT name="model">
+ <OPTION value="101">Type 1</OPTION>
+ <OPTION value="102">Type 2</OPTION>
+ <OPTION value="103">Type 3</OPTION>
+ <OPTION value="104">Type 4</OPTION>
+ <OPTION value="105">Type 5</OPTION>
+ <OPTION value="106">Type 6</OPTION>
+ <OPTION value="107">Type 7</OPTION>
+ </SELECT>
+ </strong>
+ </TD>
+ </TR>
+ </TABLE>
+ <BR><BR>
+ <INPUT type="submit" value="Order">
+ <INPUT type="reset" value="Cancel">
+ </FORM>
+</div>
</BODY>
</HTML>
\ No newline at end of file
Modified: geronimo/samples/trunk/samples/jms-mdb-sample/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jms-mdb-sample/pom.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jms-mdb-sample/pom.xml (original)
+++ geronimo/samples/trunk/samples/jms-mdb-sample/pom.xml Fri Jun 6 13:53:24 2008
@@ -21,23 +21,23 @@
<!-- $Rev$ $Date$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+
<modelVersion>4.0.0</modelVersion>
-
+
<parent>
<groupId>org.apache.geronimo.samples</groupId>
<artifactId>samples</artifactId>
<version>2.2-SNAPSHOT</version>
</parent>
-
+
<artifactId>jms-mdb-sample</artifactId>
<name>Geronimo Samples :: jms-mdb-sample</name>
<packaging>pom</packaging>
-
+
<description>
Geronimo jms-mdb-sample sample created from an archetype.
</description>
-
+
<modules>
<module>jms-mdb-sample-ejb</module>
<module>jms-mdb-sample-war</module>
@@ -47,13 +47,13 @@
</modules>
<dependencies>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <version>1.1</version>
- <type>jar</type>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <version>1.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -62,7 +62,7 @@
<artifactId>maven-site-plugin</artifactId>
<inherited>false</inherited>
<configuration>
- <outputDirectory>${project.basedir}/docs</outputDirectory>
+ <outputDirectory>${project.basedir}/docs</outputDirectory>
</configuration>
</plugin>
</plugins>
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/pom.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/pom.xml (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/pom.xml Fri Jun 6 13:53:24 2008
@@ -110,24 +110,24 @@
<includeVersion>true</includeVersion>
</useMavenDependencies>
<!--<instance>-->
- <!--<plugin-artifact>-->
- <!--<prerequisite>-->
- <!--<id>-->
- <!--<groupId>org.apache.geronimo.configs</groupId>-->
- <!--<artifactId>jetty6</artifactId>-->
- <!--</id>-->
- <!--<resource-type>Web Container</resource-type>-->
- <!--<description>The Jetty web container</description>-->
- <!--</prerequisite>-->
- <!--<prerequisite>-->
- <!--<id>-->
- <!--<groupId>org.apache.geronimo.configs</groupId>-->
- <!--<artifactId>jasper</artifactId>-->
- <!--</id>-->
- <!--<resource-type>Web Container</resource-type>-->
- <!--<description>The Jasper subsystem</description>-->
- <!--</prerequisite>-->
- <!--</plugin-artifact>-->
+ <!--<plugin-artifact>-->
+ <!--<prerequisite>-->
+ <!--<id>-->
+ <!--<groupId>org.apache.geronimo.configs</groupId>-->
+ <!--<artifactId>jetty6</artifactId>-->
+ <!--</id>-->
+ <!--<resource-type>Web Container</resource-type>-->
+ <!--<description>The Jetty web container</description>-->
+ <!--</prerequisite>-->
+ <!--<prerequisite>-->
+ <!--<id>-->
+ <!--<groupId>org.apache.geronimo.configs</groupId>-->
+ <!--<artifactId>jasper</artifactId>-->
+ <!--</id>-->
+ <!--<resource-type>Web Container</resource-type>-->
+ <!--<description>The Jasper subsystem</description>-->
+ <!--</prerequisite>-->
+ <!--</plugin-artifact>-->
<!--</instance>-->
</configuration>
</plugin>
@@ -138,7 +138,7 @@
<profile>
<id>it</id>
<!--<properties>-->
- <!--<it-server>jetty-minimal</it-server>-->
+ <!--<it-server>jetty-minimal</it-server>-->
<!--</properties>-->
<build>
<plugins>
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/src/main/plan/plan.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/src/main/plan/plan.xml (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-jetty/src/main/plan/plan.xml Fri Jun 6 13:53:24 2008
@@ -15,13 +15,13 @@
limitations under the License.-->
<!--$Rev$ $Date$-->
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.2">
- <context-root>/jsp-examples</context-root>
- <security-realm-name>geronimo-admin</security-realm-name>
- <security>
- <role-mappings>
- <role role-name="tomcat">
- <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
- </role>
- </role-mappings>
- </security>
+ <context-root>/jsp-examples</context-root>
+ <security-realm-name>geronimo-admin</security-realm-name>
+ <security>
+ <role-mappings>
+ <role role-name="tomcat">
+ <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+ </role>
+ </role-mappings>
+ </security>
</web-app>
\ No newline at end of file
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/pom.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/pom.xml (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/pom.xml Fri Jun 6 13:53:24 2008
@@ -110,24 +110,24 @@
<includeVersion>true</includeVersion>
</useMavenDependencies>
<!--<instance>-->
- <!--<plugin-artifact>-->
- <!--<prerequisite>-->
- <!--<id>-->
- <!--<groupId>org.apache.geronimo.configs</groupId>-->
- <!--<artifactId>tomcat6</artifactId>-->
- <!--</id>-->
- <!--<resource-type>Web Container</resource-type>-->
- <!--<description>The Tomcat web container</description>-->
- <!--</prerequisite>-->
- <!--<prerequisite>-->
- <!--<id>-->
- <!--<groupId>org.apache.geronimo.configs</groupId>-->
- <!--<artifactId>jasper</artifactId>-->
- <!--</id>-->
- <!--<resource-type>Web Container</resource-type>-->
- <!--<description>The Jasper subsystem</description>-->
- <!--</prerequisite>-->
- <!--</plugin-artifact>-->
+ <!--<plugin-artifact>-->
+ <!--<prerequisite>-->
+ <!--<id>-->
+ <!--<groupId>org.apache.geronimo.configs</groupId>-->
+ <!--<artifactId>tomcat6</artifactId>-->
+ <!--</id>-->
+ <!--<resource-type>Web Container</resource-type>-->
+ <!--<description>The Tomcat web container</description>-->
+ <!--</prerequisite>-->
+ <!--<prerequisite>-->
+ <!--<id>-->
+ <!--<groupId>org.apache.geronimo.configs</groupId>-->
+ <!--<artifactId>jasper</artifactId>-->
+ <!--</id>-->
+ <!--<resource-type>Web Container</resource-type>-->
+ <!--<description>The Jasper subsystem</description>-->
+ <!--</prerequisite>-->
+ <!--</plugin-artifact>-->
<!--</instance>-->
</configuration>
</plugin>
@@ -138,7 +138,7 @@
<profile>
<id>it</id>
<!--<properties>-->
- <!--<it-server>tomcat-minimal</it-server>-->
+ <!--<it-server>tomcat-minimal</it-server>-->
<!--</properties>-->
<build>
<plugins>
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/src/main/plan/plan.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/src/main/plan/plan.xml (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-tomcat/src/main/plan/plan.xml Fri Jun 6 13:53:24 2008
@@ -15,13 +15,13 @@
limitations under the License.-->
<!--$Rev$ $Date$-->
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.2">
- <context-root>/jsp-examples</context-root>
- <security-realm-name>geronimo-admin</security-realm-name>
- <security>
- <role-mappings>
- <role role-name="tomcat">
- <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
- </role>
- </role-mappings>
- </security>
+ <context-root>/jsp-examples</context-root>
+ <security-realm-name>geronimo-admin</security-realm-name>
+ <security>
+ <role-mappings>
+ <role role-name="tomcat">
+ <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+ </role>
+ </role-mappings>
+ </security>
</web-app>
\ No newline at end of file
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/pom.xml?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/pom.xml (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/pom.xml Fri Jun 6 13:53:24 2008
@@ -19,7 +19,7 @@
<!-- $Rev$ $Date$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -31,5 +31,5 @@
<artifactId>jsp-examples-war</artifactId>
<name>Geronimo Samples :: JSP Examples WAR</name>
<packaging>war</packaging>
-
+
</project>
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entries.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entries.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entries.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entries.java Fri Jun 6 13:53:24 2008
@@ -17,44 +17,45 @@
package cal;
import java.util.Hashtable;
-import javax.servlet.http.*;
+
+import javax.servlet.http.HttpServletRequest;
public class Entries {
- private Hashtable entries;
- private static final String[] time = {"8am", "9am", "10am", "11am", "12pm",
- "1pm", "2pm", "3pm", "4pm", "5pm", "6pm",
- "7pm", "8pm" };
- public static final int rows = 12;
-
- public Entries () {
- entries = new Hashtable (rows);
- for (int i=0; i < rows; i++) {
- entries.put (time[i], new Entry(time[i]));
- }
- }
-
- public int getRows () {
- return rows;
- }
-
- public Entry getEntry (int index) {
- return (Entry)this.entries.get(time[index]);
- }
-
- public int getIndex (String tm) {
- for (int i=0; i<rows; i++)
- if(tm.equals(time[i])) return i;
- return -1;
- }
-
- public void processRequest (HttpServletRequest request, String tm) {
- int index = getIndex (tm);
- if (index >= 0) {
- String descr = request.getParameter ("description");
- ((Entry)entries.get(time[index])).setDescription (descr);
+ private Hashtable entries;
+ private static final String[] time = {"8am", "9am", "10am", "11am", "12pm",
+ "1pm", "2pm", "3pm", "4pm", "5pm", "6pm",
+ "7pm", "8pm"};
+ public static final int rows = 12;
+
+ public Entries() {
+ entries = new Hashtable(rows);
+ for (int i = 0; i < rows; i++) {
+ entries.put(time[i], new Entry(time[i]));
+ }
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public Entry getEntry(int index) {
+ return (Entry) this.entries.get(time[index]);
+ }
+
+ public int getIndex(String tm) {
+ for (int i = 0; i < rows; i++)
+ if (tm.equals(time[i])) return i;
+ return -1;
+ }
+
+ public void processRequest(HttpServletRequest request, String tm) {
+ int index = getIndex(tm);
+ if (index >= 0) {
+ String descr = request.getParameter("description");
+ ((Entry) entries.get(time[index])).setDescription(descr);
+ }
}
- }
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entry.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entry.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entry.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/Entry.java Fri Jun 6 13:53:24 2008
@@ -19,34 +19,34 @@
public class Entry {
- String hour;
- String description;
- String color;
-
- public Entry (String hour) {
- this.hour = hour;
- this.description = "";
-
- }
-
- public String getHour () {
- return this.hour;
- }
-
- public String getColor () {
- if (description.equals("")) return "lightblue";
- else return "red";
- }
-
- public String getDescription () {
- if (description.equals("")) return "None";
- else return this.description;
- }
-
- public void setDescription (String descr) {
- description = descr;
- }
-
+ String hour;
+ String description;
+ String color;
+
+ public Entry(String hour) {
+ this.hour = hour;
+ this.description = "";
+
+ }
+
+ public String getHour() {
+ return this.hour;
+ }
+
+ public String getColor() {
+ if (description.equals("")) return "lightblue";
+ else return "red";
+ }
+
+ public String getDescription() {
+ if (description.equals("")) return "None";
+ else return this.description;
+ }
+
+ public void setDescription(String descr) {
+ description = descr;
+ }
+
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/JspCalendar.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/JspCalendar.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/JspCalendar.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/JspCalendar.java Fri Jun 6 13:53:24 2008
@@ -17,134 +17,135 @@
package cal;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
public class JspCalendar {
- Calendar calendar = null;
+ Calendar calendar = null;
Date currentDate;
public JspCalendar() {
- calendar = Calendar.getInstance();
- Date trialTime = new Date();
- calendar.setTime(trialTime);
+ calendar = Calendar.getInstance();
+ Date trialTime = new Date();
+ calendar.setTime(trialTime);
}
public int getYear() {
- return calendar.get(Calendar.YEAR);
+ return calendar.get(Calendar.YEAR);
}
-
+
public String getMonth() {
- int m = getMonthInt();
- String[] months = new String [] { "January", "February", "March",
- "April", "May", "June",
- "July", "August", "September",
- "October", "November", "December" };
- if (m > 12)
- return "Unknown to Man";
-
- return months[m - 1];
+ int m = getMonthInt();
+ String[] months = new String[]{"January", "February", "March",
+ "April", "May", "June",
+ "July", "August", "September",
+ "October", "November", "December"};
+ if (m > 12)
+ return "Unknown to Man";
+
+ return months[m - 1];
}
public String getDay() {
- int x = getDayOfWeek();
- String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"};
+ int x = getDayOfWeek();
+ String[] days = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"};
- if (x > 7)
- return "Unknown to Man";
+ if (x > 7)
+ return "Unknown to Man";
- return days[x - 1];
+ return days[x - 1];
}
-
+
public int getMonthInt() {
- return 1 + calendar.get(Calendar.MONTH);
+ return 1 + calendar.get(Calendar.MONTH);
}
public String getDate() {
- return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
+ return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
}
public String getCurrentDate() {
- Date dt = new Date ();
- calendar.setTime (dt);
- return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
+ Date dt = new Date();
+ calendar.setTime(dt);
+ return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
}
public String getNextDate() {
- calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
- return getDate ();
+ calendar.set(Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
+ return getDate();
}
public String getPrevDate() {
- calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
- return getDate ();
+ calendar.set(Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
+ return getDate();
}
public String getTime() {
- return getHour() + ":" + getMinute() + ":" + getSecond();
+ return getHour() + ":" + getMinute() + ":" + getSecond();
}
public int getDayOfMonth() {
- return calendar.get(Calendar.DAY_OF_MONTH);
+ return calendar.get(Calendar.DAY_OF_MONTH);
}
public int getDayOfYear() {
- return calendar.get(Calendar.DAY_OF_YEAR);
+ return calendar.get(Calendar.DAY_OF_YEAR);
}
public int getWeekOfYear() {
- return calendar.get(Calendar.WEEK_OF_YEAR);
+ return calendar.get(Calendar.WEEK_OF_YEAR);
}
public int getWeekOfMonth() {
- return calendar.get(Calendar.WEEK_OF_MONTH);
+ return calendar.get(Calendar.WEEK_OF_MONTH);
}
public int getDayOfWeek() {
- return calendar.get(Calendar.DAY_OF_WEEK);
+ return calendar.get(Calendar.DAY_OF_WEEK);
}
-
+
public int getHour() {
- return calendar.get(Calendar.HOUR_OF_DAY);
+ return calendar.get(Calendar.HOUR_OF_DAY);
}
-
+
public int getMinute() {
- return calendar.get(Calendar.MINUTE);
+ return calendar.get(Calendar.MINUTE);
}
public int getSecond() {
- return calendar.get(Calendar.SECOND);
+ return calendar.get(Calendar.SECOND);
}
-
+
public int getEra() {
- return calendar.get(Calendar.ERA);
+ return calendar.get(Calendar.ERA);
}
public String getUSTimeZone() {
- String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
- "Mountain", "Central", "Eastern"};
-
- return zones[10 + getZoneOffset()];
+ String[] zones = new String[]{"Hawaii", "Alaskan", "Pacific",
+ "Mountain", "Central", "Eastern"};
+
+ return zones[10 + getZoneOffset()];
}
public int getZoneOffset() {
- return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
+ return calendar.get(Calendar.ZONE_OFFSET) / (60 * 60 * 1000);
}
public int getDSTOffset() {
- return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
+ return calendar.get(Calendar.DST_OFFSET) / (60 * 60 * 1000);
}
-
+
public int getAMPM() {
- return calendar.get(Calendar.AM_PM);
+ return calendar.get(Calendar.AM_PM);
}
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/TableBean.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/TableBean.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/TableBean.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/cal/TableBean.java Fri Jun 6 13:53:24 2008
@@ -16,81 +16,82 @@
*/
package cal;
-import javax.servlet.http.*;
import java.util.Hashtable;
+import javax.servlet.http.HttpServletRequest;
+
public class TableBean {
- Hashtable table;
- JspCalendar JspCal;
- Entries entries;
- String date;
- String name = null;
- String email = null;
- boolean processError = false;
-
- public TableBean () {
- this.table = new Hashtable (10);
- this.JspCal = new JspCalendar ();
- this.date = JspCal.getCurrentDate ();
- }
-
- public void setName (String nm) {
- this.name = nm;
- }
-
- public String getName () {
- return this.name;
- }
-
- public void setEmail (String mail) {
- this.email = mail;
- }
-
- public String getEmail () {
- return this.email;
- }
-
- public String getDate () {
- return this.date;
- }
-
- public Entries getEntries () {
- return this.entries;
- }
-
- public void processRequest (HttpServletRequest request) {
-
- // Get the name and e-mail.
- this.processError = false;
- if (name == null || name.equals("")) setName(request.getParameter ("name"));
- if (email == null || email.equals("")) setEmail(request.getParameter ("email"));
- if (name == null || email == null ||
- name.equals("") || email.equals("")) {
- this.processError = true;
- return;
- }
-
- // Get the date.
- String dateR = request.getParameter ("date");
- if (dateR == null) date = JspCal.getCurrentDate ();
- else if (dateR.equalsIgnoreCase("next")) date = JspCal.getNextDate ();
- else if (dateR.equalsIgnoreCase("prev")) date = JspCal.getPrevDate ();
-
- entries = (Entries) table.get (date);
- if (entries == null) {
- entries = new Entries ();
- table.put (date, entries);
- }
-
- // If time is provided add the event.
- String time = request.getParameter("time");
- if (time != null) entries.processRequest (request, time);
- }
-
- public boolean getProcessError () {
- return this.processError;
- }
+ Hashtable table;
+ JspCalendar JspCal;
+ Entries entries;
+ String date;
+ String name = null;
+ String email = null;
+ boolean processError = false;
+
+ public TableBean() {
+ this.table = new Hashtable(10);
+ this.JspCal = new JspCalendar();
+ this.date = JspCal.getCurrentDate();
+ }
+
+ public void setName(String nm) {
+ this.name = nm;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setEmail(String mail) {
+ this.email = mail;
+ }
+
+ public String getEmail() {
+ return this.email;
+ }
+
+ public String getDate() {
+ return this.date;
+ }
+
+ public Entries getEntries() {
+ return this.entries;
+ }
+
+ public void processRequest(HttpServletRequest request) {
+
+ // Get the name and e-mail.
+ this.processError = false;
+ if (name == null || name.equals("")) setName(request.getParameter("name"));
+ if (email == null || email.equals("")) setEmail(request.getParameter("email"));
+ if (name == null || email == null ||
+ name.equals("") || email.equals("")) {
+ this.processError = true;
+ return;
+ }
+
+ // Get the date.
+ String dateR = request.getParameter("date");
+ if (dateR == null) date = JspCal.getCurrentDate();
+ else if (dateR.equalsIgnoreCase("next")) date = JspCal.getNextDate();
+ else if (dateR.equalsIgnoreCase("prev")) date = JspCal.getPrevDate();
+
+ entries = (Entries) table.get(date);
+ if (entries == null) {
+ entries = new Entries();
+ table.put(date, entries);
+ }
+
+ // If time is provided add the event.
+ String time = request.getParameter("time");
+ if (time != null) entries.processRequest(request, time);
+ }
+
+ public boolean getProcessError() {
+ return this.processError;
+ }
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/checkbox/CheckTest.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/checkbox/CheckTest.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/checkbox/CheckTest.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/checkbox/CheckTest.java Fri Jun 6 13:53:24 2008
@@ -19,13 +19,13 @@
public class CheckTest {
- String b[] = new String[] { "1", "2", "3", "4" };
+ String b[] = new String[]{"1", "2", "3", "4"};
public String[] getFruit() {
- return b;
+ return b;
}
- public void setFruit(String [] b) {
- this.b = b;
+ public void setFruit(String[] b) {
+ this.b = b;
}
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/colors/ColorGameBean.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/colors/ColorGameBean.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/colors/ColorGameBean.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/colors/ColorGameBean.java Fri Jun 6 13:53:24 2008
@@ -16,7 +16,7 @@
*/
package colors;
-import javax.servlet.http.*;
+import javax.servlet.http.HttpServletRequest;
public class ColorGameBean {
@@ -26,90 +26,90 @@
private String color2 = background;
private String hint = "no";
private int attempts = 0;
- private int intval = 0;
+ private int intval = 0;
private boolean tookHints = false;
public void processRequest(HttpServletRequest request) {
- // background = "yellow";
- // foreground = "red";
+ // background = "yellow";
+ // foreground = "red";
- if (! color1.equals(foreground)) {
- if (color1.equalsIgnoreCase("black") ||
- color1.equalsIgnoreCase("cyan")) {
- background = color1;
- }
- }
-
- if (! color2.equals(background)) {
- if (color2.equalsIgnoreCase("black") ||
- color2.equalsIgnoreCase("cyan")) {
- foreground = color2;
- }
- }
+ if (!color1.equals(foreground)) {
+ if (color1.equalsIgnoreCase("black") ||
+ color1.equalsIgnoreCase("cyan")) {
+ background = color1;
+ }
+ }
+
+ if (!color2.equals(background)) {
+ if (color2.equalsIgnoreCase("black") ||
+ color2.equalsIgnoreCase("cyan")) {
+ foreground = color2;
+ }
+ }
- attempts++;
+ attempts++;
}
public void setColor2(String x) {
- color2 = x;
+ color2 = x;
}
public void setColor1(String x) {
- color1 = x;
+ color1 = x;
}
public void setAction(String x) {
- if (!tookHints)
- tookHints = x.equalsIgnoreCase("Hint");
- hint = x;
+ if (!tookHints)
+ tookHints = x.equalsIgnoreCase("Hint");
+ hint = x;
}
public String getColor2() {
- return background;
+ return background;
}
public String getColor1() {
- return foreground;
+ return foreground;
}
public int getAttempts() {
- return attempts;
+ return attempts;
}
public boolean getHint() {
- return hint.equalsIgnoreCase("Hint");
+ return hint.equalsIgnoreCase("Hint");
}
public boolean getSuccess() {
- if (background.equalsIgnoreCase("black") ||
- background.equalsIgnoreCase("cyan")) {
-
- if (foreground.equalsIgnoreCase("black") ||
- foreground.equalsIgnoreCase("cyan"))
- return true;
- else
- return false;
- }
+ if (background.equalsIgnoreCase("black") ||
+ background.equalsIgnoreCase("cyan")) {
- return false;
+ if (foreground.equalsIgnoreCase("black") ||
+ foreground.equalsIgnoreCase("cyan"))
+ return true;
+ else
+ return false;
+ }
+
+ return false;
}
public boolean getHintTaken() {
- return tookHints;
+ return tookHints;
}
public void reset() {
- foreground = "red";
- background = "yellow";
+ foreground = "red";
+ background = "yellow";
}
public void setIntval(int value) {
- intval = value;
- }
+ intval = value;
+ }
public int getIntval() {
- return intval;
- }
+ return intval;
+ }
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilter.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilter.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilter.java Fri Jun 6 13:53:24 2008
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.util.Enumeration;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -39,7 +40,7 @@
* @version $Revision$, $Date$
*/
-public class CompressionFilter implements Filter{
+public class CompressionFilter implements Filter {
/**
* The filter configuration object we are associated with. If this value
@@ -74,13 +75,13 @@
config = filterConfig;
if (filterConfig != null) {
String value = filterConfig.getInitParameter("debug");
- if (value!=null) {
+ if (value != null) {
debug = Integer.parseInt(value);
} else {
debug = 0;
}
String str = filterConfig.getInitParameter("compressionThreshold");
- if (str!=null) {
+ if (str != null) {
compressionThreshold = Integer.parseInt(str);
if (compressionThreshold != 0 && compressionThreshold < minThreshold) {
if (debug > 0) {
@@ -100,8 +101,8 @@
}
/**
- * Take this filter out of service.
- */
+ * Take this filter out of service.
+ */
public void destroy() {
this.config = null;
@@ -123,10 +124,10 @@
* modifies the header if the content length is big enough.
* It then invokes the next entity in the chain using the FilterChain object
* (<code>chain.doFilter()</code>), <br>
- **/
+ */
- public void doFilter ( ServletRequest request, ServletResponse response,
- FilterChain chain ) throws IOException, ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
if (debug > 0) {
System.out.println("@doFilter");
@@ -143,11 +144,11 @@
boolean supportCompression = false;
if (request instanceof HttpServletRequest) {
if (debug > 1) {
- System.out.println("requestURI = " + ((HttpServletRequest)request).getRequestURI());
+ System.out.println("requestURI = " + ((HttpServletRequest) request).getRequestURI());
}
// Are we allowed to compress ?
- String s = (String) ((HttpServletRequest)request).getParameter("gzip");
+ String s = (String) ((HttpServletRequest) request).getParameter("gzip");
if ("false".equals(s)) {
if (debug > 0) {
System.out.println("got parameter gzip=false --> don't compress, just chain filter");
@@ -157,9 +158,9 @@
}
Enumeration e =
- ((HttpServletRequest)request).getHeaders("Accept-Encoding");
+ ((HttpServletRequest) request).getHeaders("Accept-Encoding");
while (e.hasMoreElements()) {
- String name = (String)e.nextElement();
+ String name = (String) e.nextElement();
if (name.indexOf("gzip") != -1) {
if (debug > 0) {
System.out.println("supports compression");
@@ -182,7 +183,7 @@
} else {
if (response instanceof HttpServletResponse) {
CompressionServletResponseWrapper wrappedResponse =
- new CompressionServletResponseWrapper((HttpServletResponse)response);
+ new CompressionServletResponseWrapper((HttpServletResponse) response);
wrappedResponse.setDebugLevel(debug);
wrappedResponse.setCompressionThreshold(compressionThreshold);
if (debug > 0) {
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java Fri Jun 6 13:53:24 2008
@@ -19,11 +19,16 @@
import java.io.IOException;
import java.util.Enumeration;
-import javax.servlet.*;
-import javax.servlet.http.*;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
/**
* Very Simple test servlet to test compression filter
+ *
* @author Amy Roh
* @version $Revision$, $Date$
*/
@@ -31,19 +36,18 @@
public class CompressionFilterTestServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ throws ServletException, IOException {
ServletOutputStream out = response.getOutputStream();
response.setContentType("text/plain");
- Enumeration e = ((HttpServletRequest)request).getHeaders("Accept-Encoding");
+ Enumeration e = ((HttpServletRequest) request).getHeaders("Accept-Encoding");
while (e.hasMoreElements()) {
- String name = (String)e.nextElement();
+ String name = (String) e.nextElement();
out.println(name);
if (name.indexOf("gzip") != -1) {
out.println("gzip supported -- able to compress");
- }
- else {
+ } else {
out.println("gzip not supported");
}
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java Fri Jun 6 13:53:24 2008
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
+
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -33,8 +34,7 @@
*/
public class CompressionResponseStream
- extends ServletOutputStream {
-
+ extends ServletOutputStream {
// ----------------------------------------------------------- Constructors
@@ -44,7 +44,7 @@
*
* @param response The associated response
*/
- public CompressionResponseStream(HttpServletResponse response) throws IOException{
+ public CompressionResponseStream(HttpServletResponse response) throws IOException {
super();
closed = false;
@@ -53,7 +53,6 @@
}
-
// ----------------------------------------------------- Instance Variables
@@ -104,7 +103,6 @@
*/
protected ServletOutputStream output = null;
-
// --------------------------------------------------------- Public Methods
/**
@@ -122,7 +120,7 @@
compressionThreshold = threshold;
buffer = new byte[compressionThreshold];
if (debug > 1) {
- System.out.println("buffer is set to "+compressionThreshold);
+ System.out.println("buffer is set to " + compressionThreshold);
}
}
@@ -198,13 +196,12 @@
* Write the specified byte to our output stream.
*
* @param b The byte to be written
- *
- * @exception IOException if an input/output error occurs
+ * @throws IOException if an input/output error occurs
*/
public void write(int b) throws IOException {
if (debug > 1) {
- System.out.println("write "+b+" in CompressionResponseStream ");
+ System.out.println("write " + b + " in CompressionResponseStream ");
}
if (closed)
throw new IOException("Cannot write to a closed output stream");
@@ -223,8 +220,7 @@
* to our output stream.
*
* @param b The byte array to be written
- *
- * @exception IOException if an input/output error occurs
+ * @throws IOException if an input/output error occurs
*/
public void write(byte b[]) throws IOException {
@@ -237,11 +233,10 @@
* Write <code>len</code> bytes from the specified byte array, starting
* at the specified offset, to our output stream.
*
- * @param b The byte array containing the bytes to be written
+ * @param b The byte array containing the bytes to be written
* @param off Zero-relative starting offset of the bytes to be written
* @param len The number of bytes to be written
- *
- * @exception IOException if an input/output error occurs
+ * @throws IOException if an input/output error occurs
*/
public void write(byte b[], int off, int len) throws IOException {
@@ -302,7 +297,6 @@
}
-
// -------------------------------------------------------- Package Methods
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java Fri Jun 6 13:53:24 2008
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -50,7 +51,6 @@
}
}
-
// ----------------------------------------------------- Instance Variables
/**
@@ -103,7 +103,7 @@
*/
public void setContentType(String contentType) {
if (debug > 1) {
- System.out.println("setContentType to "+contentType);
+ System.out.println("setContentType to " + contentType);
}
this.contentType = contentType;
origResponse.setContentType(contentType);
@@ -133,7 +133,7 @@
* Create and return a ServletOutputStream to write the content
* associated with this Response.
*
- * @exception IOException if an input/output error occurs
+ * @throws IOException if an input/output error occurs
*/
public ServletOutputStream createOutputStream() throws IOException {
if (debug > 1) {
@@ -164,29 +164,28 @@
}
}
-
// ------------------------------------------------ ServletResponse Methods
/**
* Flush the buffer and commit this response.
*
- * @exception IOException if an input/output error occurs
+ * @throws IOException if an input/output error occurs
*/
public void flushBuffer() throws IOException {
if (debug > 1) {
System.out.println("flush buffer @ CompressionServletResponseWrapper");
}
- ((CompressionResponseStream)stream).flush();
+ ((CompressionResponseStream) stream).flush();
}
/**
* Return the servlet output stream associated with this Response.
*
- * @exception IllegalStateException if <code>getWriter</code> has
- * already been called for this response
- * @exception IOException if an input/output error occurs
+ * @throws IllegalStateException if <code>getWriter</code> has
+ * already been called for this response
+ * @throws IOException if an input/output error occurs
*/
public ServletOutputStream getOutputStream() throws IOException {
@@ -196,7 +195,7 @@
if (stream == null)
stream = createOutputStream();
if (debug > 1) {
- System.out.println("stream is set to "+stream+" in getOutputStream");
+ System.out.println("stream is set to " + stream + " in getOutputStream");
}
return (stream);
@@ -206,9 +205,9 @@
/**
* Return the writer associated with this Response.
*
- * @exception IllegalStateException if <code>getOutputStream</code> has
- * already been called for this response
- * @exception IOException if an input/output error occurs
+ * @throws IllegalStateException if <code>getOutputStream</code> has
+ * already been called for this response
+ * @throws IOException if an input/output error occurs
*/
public PrintWriter getWriter() throws IOException {
@@ -220,7 +219,7 @@
stream = createOutputStream();
if (debug > 1) {
- System.out.println("stream is set to "+stream+" in getWriter");
+ System.out.println("stream is set to " + stream + " in getWriter");
}
//String charset = getCharsetFromContentType(contentType);
String charEnc = origResponse.getCharacterEncoding();
@@ -234,7 +233,7 @@
} else {
writer = new PrintWriter(stream);
}
-
+
return (writer);
}
@@ -246,6 +245,7 @@
/**
* Returns character from content type. This method was taken from tomcat.
+ *
* @author rajo
*/
private static String getCharsetFromContentType(String type) {
@@ -259,7 +259,7 @@
}
String afterSemi = type.substring(semi + 1);
int charsetLocation = afterSemi.indexOf("charset=");
- if(charsetLocation == -1) {
+ if (charsetLocation == -1) {
return null;
} else {
String afterCharset = afterSemi.substring(charsetLocation + 8);
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java Fri Jun 6 13:53:24 2008
@@ -16,137 +16,138 @@
*/
package dates;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
public class JspCalendar {
- Calendar calendar = null;
+ Calendar calendar = null;
public JspCalendar() {
- calendar = Calendar.getInstance();
- Date trialTime = new Date();
- calendar.setTime(trialTime);
+ calendar = Calendar.getInstance();
+ Date trialTime = new Date();
+ calendar.setTime(trialTime);
}
public int getYear() {
- return calendar.get(Calendar.YEAR);
+ return calendar.get(Calendar.YEAR);
}
-
+
public String getMonth() {
- int m = getMonthInt();
- String[] months = new String [] { "January", "February", "March",
- "April", "May", "June",
- "July", "August", "September",
- "October", "November", "December" };
- if (m > 12)
- return "Unknown to Man";
-
- return months[m - 1];
+ int m = getMonthInt();
+ String[] months = new String[]{"January", "February", "March",
+ "April", "May", "June",
+ "July", "August", "September",
+ "October", "November", "December"};
+ if (m > 12)
+ return "Unknown to Man";
+
+ return months[m - 1];
}
public String getDay() {
- int x = getDayOfWeek();
- String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"};
+ int x = getDayOfWeek();
+ String[] days = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"};
- if (x > 7)
- return "Unknown to Man";
+ if (x > 7)
+ return "Unknown to Man";
- return days[x - 1];
+ return days[x - 1];
}
-
+
public int getMonthInt() {
- return 1 + calendar.get(Calendar.MONTH);
+ return 1 + calendar.get(Calendar.MONTH);
}
public String getDate() {
- return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
+ return getMonthInt() + "/" + getDayOfMonth() + "/" + getYear();
}
public String getTime() {
- return getHour() + ":" + getMinute() + ":" + getSecond();
+ return getHour() + ":" + getMinute() + ":" + getSecond();
}
public int getDayOfMonth() {
- return calendar.get(Calendar.DAY_OF_MONTH);
+ return calendar.get(Calendar.DAY_OF_MONTH);
}
public int getDayOfYear() {
- return calendar.get(Calendar.DAY_OF_YEAR);
+ return calendar.get(Calendar.DAY_OF_YEAR);
}
public int getWeekOfYear() {
- return calendar.get(Calendar.WEEK_OF_YEAR);
+ return calendar.get(Calendar.WEEK_OF_YEAR);
}
public int getWeekOfMonth() {
- return calendar.get(Calendar.WEEK_OF_MONTH);
+ return calendar.get(Calendar.WEEK_OF_MONTH);
}
public int getDayOfWeek() {
- return calendar.get(Calendar.DAY_OF_WEEK);
+ return calendar.get(Calendar.DAY_OF_WEEK);
}
-
+
public int getHour() {
- return calendar.get(Calendar.HOUR_OF_DAY);
+ return calendar.get(Calendar.HOUR_OF_DAY);
}
-
+
public int getMinute() {
- return calendar.get(Calendar.MINUTE);
+ return calendar.get(Calendar.MINUTE);
}
public int getSecond() {
- return calendar.get(Calendar.SECOND);
+ return calendar.get(Calendar.SECOND);
}
public static void main(String args[]) {
- JspCalendar db = new JspCalendar();
- p("date: " + db.getDayOfMonth());
- p("year: " + db.getYear());
- p("month: " + db.getMonth());
- p("time: " + db.getTime());
- p("date: " + db.getDate());
- p("Day: " + db.getDay());
- p("DayOfYear: " + db.getDayOfYear());
- p("WeekOfYear: " + db.getWeekOfYear());
- p("era: " + db.getEra());
- p("ampm: " + db.getAMPM());
- p("DST: " + db.getDSTOffset());
- p("ZONE Offset: " + db.getZoneOffset());
- p("TIMEZONE: " + db.getUSTimeZone());
+ JspCalendar db = new JspCalendar();
+ p("date: " + db.getDayOfMonth());
+ p("year: " + db.getYear());
+ p("month: " + db.getMonth());
+ p("time: " + db.getTime());
+ p("date: " + db.getDate());
+ p("Day: " + db.getDay());
+ p("DayOfYear: " + db.getDayOfYear());
+ p("WeekOfYear: " + db.getWeekOfYear());
+ p("era: " + db.getEra());
+ p("ampm: " + db.getAMPM());
+ p("DST: " + db.getDSTOffset());
+ p("ZONE Offset: " + db.getZoneOffset());
+ p("TIMEZONE: " + db.getUSTimeZone());
}
private static void p(String x) {
- System.out.println(x);
+ System.out.println(x);
}
public int getEra() {
- return calendar.get(Calendar.ERA);
+ return calendar.get(Calendar.ERA);
}
public String getUSTimeZone() {
- String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
- "Mountain", "Central", "Eastern"};
-
- return zones[10 + getZoneOffset()];
+ String[] zones = new String[]{"Hawaii", "Alaskan", "Pacific",
+ "Mountain", "Central", "Eastern"};
+
+ return zones[10 + getZoneOffset()];
}
public int getZoneOffset() {
- return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
+ return calendar.get(Calendar.ZONE_OFFSET) / (60 * 60 * 1000);
}
public int getDSTOffset() {
- return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
+ return calendar.get(Calendar.DST_OFFSET) / (60 * 60 * 1000);
}
-
+
public int getAMPM() {
- return calendar.get(Calendar.AM_PM);
+ return calendar.get(Calendar.AM_PM);
}
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java Fri Jun 6 13:53:24 2008
@@ -20,13 +20,13 @@
public class Smart {
- String name = "JSP";
+ String name = "JSP";
- public String getName () {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName (String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java Fri Jun 6 13:53:24 2008
@@ -16,8 +16,11 @@
*/
package examples;
-import javax.servlet.jsp.*;
-import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.tagext.Tag;
public abstract class ExampleTagBase extends BodyTagSupport {
@@ -36,7 +39,7 @@
public Tag getParent() {
return this.parent;
}
-
+
public int doStartTag() throws JspException {
return SKIP_BODY;
}
@@ -44,7 +47,7 @@
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
-
+
// Default implementations for BodyTag methods as well
// just in case a tag decides to implement BodyTag.
@@ -60,7 +63,7 @@
pageContext = null;
parent = null;
}
-
+
protected BodyContent bodyOut;
protected PageContext pageContext;
protected Tag parent;
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java Fri Jun 6 13:53:24 2008
@@ -16,30 +16,31 @@
*/
package examples;
-import javax.servlet.jsp.*;
import java.io.IOException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+
/**
* Example1: the simplest tag
* Collect attributes and call into some actions
- *
+ * <p/>
* <foo att1="..." att2="...." att3="...." />
*/
-public class FooTag
- extends ExampleTagBase
-{
+public class FooTag
+ extends ExampleTagBase {
private String atts[] = new String[3];
int i = 0;
-
+
private final void setAtt(int index, String value) {
atts[index] = value;
}
-
+
public void setAtt1(String value) {
setAtt(0, value);
}
-
+
public void setAtt2(String value) {
setAtt(1, value);
}
@@ -47,7 +48,7 @@
public void setAtt3(String value) {
setAtt(2, value);
}
-
+
/**
* Process start tag
*
@@ -55,14 +56,14 @@
*/
public int doStartTag() throws JspException {
i = 0;
- return EVAL_BODY_TAG;
+ return EVAL_BODY_TAG;
}
public void doInitBody() throws JspException {
pageContext.setAttribute("member", atts[i]);
i++;
}
-
+
public int doAfterBody() throws JspException {
try {
if (i == 3) {
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTagExtraInfo.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTagExtraInfo.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTagExtraInfo.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTagExtraInfo.java Fri Jun 6 13:53:24 2008
@@ -16,17 +16,19 @@
*/
package examples;
-import javax.servlet.jsp.tagext.*;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.VariableInfo;
public class FooTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData data) {
- return new VariableInfo[]
- {
- new VariableInfo("member",
- "String",
- true,
- VariableInfo.NESTED)
- };
+ return new VariableInfo[]
+ {
+ new VariableInfo("member",
+ "String",
+ true,
+ VariableInfo.NESTED)
+ };
}
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/LogTag.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/LogTag.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/LogTag.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/LogTag.java Fri Jun 6 13:53:24 2008
@@ -17,17 +17,18 @@
package examples;
-import javax.servlet.jsp.*;
import java.io.IOException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+
/**
- * Log the contents of the body. Could be used to handle errors etc.
+ * Log the contents of the body. Could be used to handle errors etc.
*/
-public class LogTag
- extends ExampleTagBase
-{
+public class LogTag
+ extends ExampleTagBase {
boolean toBrowser = false;
-
+
public void setToBrowser(String value) {
if (value == null)
toBrowser = false;
@@ -40,7 +41,7 @@
public int doStartTag() throws JspException {
return EVAL_BODY_TAG;
}
-
+
public int doAfterBody() throws JspException {
try {
String s = bodyOut.getString();
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ShowSource.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ShowSource.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ShowSource.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ShowSource.java Fri Jun 6 13:53:24 2008
@@ -17,43 +17,46 @@
package examples;
-import javax.servlet.jsp.*;
-import javax.servlet.jsp.tagext.*;
-
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
/**
* Display the sources of the JSP file.
*/
public class ShowSource
- extends TagSupport
-{
+ extends TagSupport {
String jspFile;
-
+
public void setJspFile(String jspFile) {
this.jspFile = jspFile;
}
public int doEndTag() throws JspException {
- if ((jspFile.indexOf( ".." ) >= 0) ||
- (jspFile.toUpperCase().indexOf("/WEB-INF/") != 0) ||
- (jspFile.toUpperCase().indexOf("/META-INF/") != 0))
- throw new JspTagException("Invalid JSP file " + jspFile);
+ if ((jspFile.indexOf("..") >= 0) ||
+ (jspFile.toUpperCase().indexOf("/WEB-INF/") != 0) ||
+ (jspFile.toUpperCase().indexOf("/META-INF/") != 0))
+ throw new JspTagException("Invalid JSP file " + jspFile);
InputStream in
- = pageContext.getServletContext().getResourceAsStream(jspFile);
+ = pageContext.getServletContext().getResourceAsStream(jspFile);
if (in == null)
- throw new JspTagException("Unable to find JSP file: "+jspFile);
+ throw new JspTagException("Unable to find JSP file: " + jspFile);
InputStreamReader reader = new InputStreamReader(in);
- JspWriter out = pageContext.getOut();
+ JspWriter out = pageContext.getOut();
try {
out.println("<body>");
out.println("<pre>");
- for(int ch = in.read(); ch != -1; ch = in.read())
+ for (int ch = in.read(); ch != -1; ch = in.read())
if (ch == '<')
out.print("<");
else
@@ -61,7 +64,7 @@
out.println("</pre>");
out.println("</body>");
} catch (IOException ex) {
- throw new JspTagException("IOException: "+ex.toString());
+ throw new JspTagException("IOException: " + ex.toString());
}
return super.doEndTag();
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java Fri Jun 6 13:53:24 2008
@@ -20,6 +20,7 @@
import java.io.IOException;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -33,12 +34,12 @@
* or to a URL pattern. This filter performs the following functions:
* <ul>
* <li>Attaches itself as a request attribute, under the attribute name
- * defined by the value of the <code>attribute</code> initialization
- * parameter.</li>
+ * defined by the value of the <code>attribute</code> initialization
+ * parameter.</li>
* <li>Calculates the number of milliseconds required to perform the
- * servlet processing required by this request, including any
- * subsequently defined filters, and logs the result to the servlet
- * context log for this application.
+ * servlet processing required by this request, including any
+ * subsequently defined filters, and logs the result to the servlet
+ * context log for this application.
* </ul>
*
* @author Craig McClanahan
@@ -47,7 +48,6 @@
public final class ExampleFilter implements Filter {
-
// ----------------------------------------------------- Instance Variables
@@ -63,7 +63,6 @@
*/
private FilterConfig filterConfig = null;
-
// --------------------------------------------------------- Public Methods
@@ -83,27 +82,26 @@
* current filter stack, including the ultimately invoked servlet.
*
* @param request The servlet request we are processing
- * @param result The servlet response we are creating
- * @param chain The filter chain we are processing
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet error occurs
+ * @param result The servlet response we are creating
+ * @param chain The filter chain we are processing
+ * @throws IOException if an input/output error occurs
+ * @throws ServletException if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
- throws IOException, ServletException {
+ throws IOException, ServletException {
- // Store ourselves as a request attribute (if requested)
- if (attribute != null)
- request.setAttribute(attribute, this);
+ // Store ourselves as a request attribute (if requested)
+ if (attribute != null)
+ request.setAttribute(attribute, this);
- // Time and log the subsequent processing
- long startTime = System.currentTimeMillis();
+ // Time and log the subsequent processing
+ long startTime = System.currentTimeMillis();
chain.doFilter(request, response);
- long stopTime = System.currentTimeMillis();
- filterConfig.getServletContext().log
- (this.toString() + ": " + (stopTime - startTime) +
- " milliseconds");
+ long stopTime = System.currentTimeMillis();
+ filterConfig.getServletContext().log
+ (this.toString() + ": " + (stopTime - startTime) +
+ " milliseconds");
}
@@ -115,7 +113,7 @@
*/
public void init(FilterConfig filterConfig) throws ServletException {
- this.filterConfig = filterConfig;
+ this.filterConfig = filterConfig;
this.attribute = filterConfig.getInitParameter("attribute");
}
@@ -126,12 +124,12 @@
*/
public String toString() {
- if (filterConfig == null)
- return ("InvokerFilter()");
- StringBuffer sb = new StringBuffer("InvokerFilter(");
- sb.append(filterConfig);
- sb.append(")");
- return (sb.toString());
+ if (filterConfig == null)
+ return ("InvokerFilter()");
+ StringBuffer sb = new StringBuffer("InvokerFilter(");
+ sb.append(filterConfig);
+ sb.append(")");
+ return (sb.toString());
}
Modified: geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java?rev=664120&r1=664119&r2=664120&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java (original)
+++ geronimo/samples/trunk/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java Fri Jun 6 13:53:24 2008
@@ -16,7 +16,6 @@
*/
-
package filters;
@@ -26,6 +25,7 @@
import java.sql.Timestamp;
import java.util.Enumeration;
import java.util.Locale;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -48,7 +48,6 @@
public final class RequestDumperFilter implements Filter {
-
// ----------------------------------------------------- Instance Variables
@@ -58,7 +57,6 @@
*/
private FilterConfig filterConfig = null;
-
// --------------------------------------------------------- Public Methods
@@ -77,94 +75,93 @@
* current filter stack, including the ultimately invoked servlet.
*
* @param request The servlet request we are processing
- * @param result The servlet response we are creating
- * @param chain The filter chain we are processing
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet error occurs
+ * @param result The servlet response we are creating
+ * @param chain The filter chain we are processing
+ * @throws IOException if an input/output error occurs
+ * @throws ServletException if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
- throws IOException, ServletException {
+ throws IOException, ServletException {
if (filterConfig == null)
- return;
+ return;
- // Render the generic servlet request properties
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- writer.println("Request Received at " +
- (new Timestamp(System.currentTimeMillis())));
- writer.println(" characterEncoding=" + request.getCharacterEncoding());
- writer.println(" contentLength=" + request.getContentLength());
- writer.println(" contentType=" + request.getContentType());
- writer.println(" locale=" + request.getLocale());
- writer.print(" locales=");
- Enumeration locales = request.getLocales();
- boolean first = true;
- while (locales.hasMoreElements()) {
- Locale locale = (Locale) locales.nextElement();
- if (first)
- first = false;
- else
- writer.print(", ");
- writer.print(locale.toString());
- }
- writer.println();
- Enumeration names = request.getParameterNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- writer.print(" parameter=" + name + "=");
- String values[] = request.getParameterValues(name);
- for (int i = 0; i < values.length; i++) {
- if (i > 0)
- writer.print(", ");
- writer.print(values[i]);
- }
- writer.println();
- }
- writer.println(" protocol=" + request.getProtocol());
- writer.println(" remoteAddr=" + request.getRemoteAddr());
- writer.println(" remoteHost=" + request.getRemoteHost());
- writer.println(" scheme=" + request.getScheme());
- writer.println(" serverName=" + request.getServerName());
- writer.println(" serverPort=" + request.getServerPort());
- writer.println(" isSecure=" + request.isSecure());
-
- // Render the HTTP servlet request properties
- if (request instanceof HttpServletRequest) {
- writer.println("---------------------------------------------");
- HttpServletRequest hrequest = (HttpServletRequest) request;
- writer.println(" contextPath=" + hrequest.getContextPath());
- Cookie cookies[] = hrequest.getCookies();
+ // Render the generic servlet request properties
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ writer.println("Request Received at " +
+ (new Timestamp(System.currentTimeMillis())));
+ writer.println(" characterEncoding=" + request.getCharacterEncoding());
+ writer.println(" contentLength=" + request.getContentLength());
+ writer.println(" contentType=" + request.getContentType());
+ writer.println(" locale=" + request.getLocale());
+ writer.print(" locales=");
+ Enumeration locales = request.getLocales();
+ boolean first = true;
+ while (locales.hasMoreElements()) {
+ Locale locale = (Locale) locales.nextElement();
+ if (first)
+ first = false;
+ else
+ writer.print(", ");
+ writer.print(locale.toString());
+ }
+ writer.println();
+ Enumeration names = request.getParameterNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ writer.print(" parameter=" + name + "=");
+ String values[] = request.getParameterValues(name);
+ for (int i = 0; i < values.length; i++) {
+ if (i > 0)
+ writer.print(", ");
+ writer.print(values[i]);
+ }
+ writer.println();
+ }
+ writer.println(" protocol=" + request.getProtocol());
+ writer.println(" remoteAddr=" + request.getRemoteAddr());
+ writer.println(" remoteHost=" + request.getRemoteHost());
+ writer.println(" scheme=" + request.getScheme());
+ writer.println(" serverName=" + request.getServerName());
+ writer.println(" serverPort=" + request.getServerPort());
+ writer.println(" isSecure=" + request.isSecure());
+
+ // Render the HTTP servlet request properties
+ if (request instanceof HttpServletRequest) {
+ writer.println("---------------------------------------------");
+ HttpServletRequest hrequest = (HttpServletRequest) request;
+ writer.println(" contextPath=" + hrequest.getContextPath());
+ Cookie cookies[] = hrequest.getCookies();
if (cookies == null)
cookies = new Cookie[0];
- for (int i = 0; i < cookies.length; i++) {
- writer.println(" cookie=" + cookies[i].getName() +
- "=" + cookies[i].getValue());
- }
- names = hrequest.getHeaderNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- String value = hrequest.getHeader(name);
- writer.println(" header=" + name + "=" + value);
- }
- writer.println(" method=" + hrequest.getMethod());
- writer.println(" pathInfo=" + hrequest.getPathInfo());
- writer.println(" queryString=" + hrequest.getQueryString());
- writer.println(" remoteUser=" + hrequest.getRemoteUser());
- writer.println("requestedSessionId=" +
- hrequest.getRequestedSessionId());
- writer.println(" requestURI=" + hrequest.getRequestURI());
- writer.println(" servletPath=" + hrequest.getServletPath());
- }
- writer.println("=============================================");
-
- // Log the resulting string
- writer.flush();
- filterConfig.getServletContext().log(sw.getBuffer().toString());
+ for (int i = 0; i < cookies.length; i++) {
+ writer.println(" cookie=" + cookies[i].getName() +
+ "=" + cookies[i].getValue());
+ }
+ names = hrequest.getHeaderNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ String value = hrequest.getHeader(name);
+ writer.println(" header=" + name + "=" + value);
+ }
+ writer.println(" method=" + hrequest.getMethod());
+ writer.println(" pathInfo=" + hrequest.getPathInfo());
+ writer.println(" queryString=" + hrequest.getQueryString());
+ writer.println(" remoteUser=" + hrequest.getRemoteUser());
+ writer.println("requestedSessionId=" +
+ hrequest.getRequestedSessionId());
+ writer.println(" requestURI=" + hrequest.getRequestURI());
+ writer.println(" servletPath=" + hrequest.getServletPath());
+ }
+ writer.println("=============================================");
+
+ // Log the resulting string
+ writer.flush();
+ filterConfig.getServletContext().log(sw.getBuffer().toString());
- // Pass control on to the next filter
+ // Pass control on to the next filter
chain.doFilter(request, response);
}
@@ -177,7 +174,7 @@
*/
public void init(FilterConfig filterConfig) throws ServletException {
- this.filterConfig = filterConfig;
+ this.filterConfig = filterConfig;
}
@@ -187,12 +184,12 @@
*/
public String toString() {
- if (filterConfig == null)
- return ("RequestDumperFilter()");
- StringBuffer sb = new StringBuffer("RequestDumperFilter(");
- sb.append(filterConfig);
- sb.append(")");
- return (sb.toString());
+ if (filterConfig == null)
+ return ("RequestDumperFilter()");
+ StringBuffer sb = new StringBuffer("RequestDumperFilter(");
+ sb.append(filterConfig);
+ sb.append(")");
+ return (sb.toString());
}