Return-Path:
chain.doFilter()
),
- **/
+ */
- 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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionFilterTestServlet.java Fri Jun 6 15:43:44 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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionResponseStream.java Fri Jun 6 15:43:44 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 len
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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/compressionFilters/CompressionServletResponseWrapper.java Fri Jun 6 15:43:44 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 getWriter
has
- * already been called for this response
- * @exception IOException if an input/output error occurs
+ * @throws IllegalStateException if getWriter
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 getOutputStream
has
- * already been called for this response
- * @exception IOException if an input/output error occurs
+ * @throws IllegalStateException if getOutputStream
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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/dates/JspCalendar.java Fri Jun 6 15:43:44 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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/error/Smart.java Fri Jun 6 15:43:44 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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/ExampleTagBase.java Fri Jun 6 15:43:44 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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/examples/FooTag.java Fri Jun 6 15:43:44 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
- *
+ *
* ");
- 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("
");
out.println("");
} catch (IOException ex) {
- throw new JspTagException("IOException: "+ex.toString());
+ throw new JspTagException("IOException: " + ex.toString());
}
return super.doEndTag();
}
Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/ExampleFilter.java Fri Jun 6 15:43:44 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:
*
*
*
* @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/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/RequestDumperFilter.java Fri Jun 6 15:43:44 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());
}
Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/SetCharacterEncodingFilter.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/SetCharacterEncodingFilter.java?rev=664175&r1=664174&r2=664175&view=diff
==============================================================================
--- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/SetCharacterEncodingFilter.java (original)
+++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/filters/SetCharacterEncodingFilter.java Fri Jun 6 15:43:44 2008
@@ -20,6 +20,7 @@
import java.io.IOException;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -35,17 +36,17 @@
* the following initialization parameters:attribute
initialization
- * parameter.attribute
initialization
+ * parameter.
*
ignore
initialization parameter. This parameter
- * is required, so there is no default.ignore
initialization parameter. This parameter
+ * is required, so there is no default.
* selectEncoding()
method is set. If set to "false,
- * selectEncoding()
is called only if the
- * client has not already specified an encoding. By default, this
- * parameter is set to "true".selectEncoding()
method is set. If set to "false,
+ * selectEncoding()
is called only if the
+ * client has not already specified an encoding. By default, this
+ * parameter is set to "true".
* Although this filter can be used unchanged, it is also easy to
* subclass it and make the selectEncoding()
method more
* intelligent about what encoding to choose, based on characteristics of
@@ -59,7 +60,6 @@
public class SetCharacterEncodingFilter implements Filter {
-
// ----------------------------------------------------- Instance Variables
@@ -82,7 +82,6 @@
*/
protected boolean ignore = true;
-
// --------------------------------------------------------- Public Methods
@@ -102,15 +101,14 @@
* interpret request parameters for this request.
*
* @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 {
// Conditionally select and set the character encoding to be used
if (ignore || (request.getCharacterEncoding() == null)) {
@@ -119,7 +117,7 @@
request.setCharacterEncoding(encoding);
}
- // Pass control on to the next filter
+ // Pass control on to the next filter
chain.doFilter(request, response);
}
@@ -132,7 +130,7 @@
*/
public void init(FilterConfig filterConfig) throws ServletException {
- this.filterConfig = filterConfig;
+ this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
@@ -146,7 +144,6 @@
}
-
// ------------------------------------------------------ Protected Methods
@@ -155,7 +152,7 @@
* characteristics of the current request and/or filter initialization
* parameters. If no character encoding should be set, return
* null
.
- *
+ *
* The default implementation unconditionally returns the value configured * by the encoding initialization parameter for this * filter. Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/BookBean.java URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/BookBean.java?rev=664175&r1=664174&r2=664175&view=diff ============================================================================== --- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/BookBean.java (original) +++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/BookBean.java Fri Jun 6 15:43:44 2008 @@ -22,8 +22,8 @@ private String title; private String author; private String isbn; - - public BookBean( String title, String author, String isbn ) { + + public BookBean(String title, String author, String isbn) { this.title = title; this.author = author; this.isbn = isbn; @@ -32,13 +32,13 @@ public String getTitle() { return this.title; } - + public String getAuthor() { return this.author; } - + public String getIsbn() { return this.isbn; } - + } Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/FooBean.java URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/FooBean.java?rev=664175&r1=664174&r2=664175&view=diff ============================================================================== --- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/FooBean.java (original) +++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/FooBean.java Fri Jun 6 15:43:44 2008 @@ -20,17 +20,17 @@ public class FooBean { private String bar; - + public FooBean() { bar = "Initial value"; } - + public String getBar() { return this.bar; } - + public void setBar(String bar) { this.bar = bar; } - + } Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/el/Functions.java URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/el/Functions.java?rev=664175&r1=664174&r2=664175&view=diff ============================================================================== --- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/el/Functions.java (original) +++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/el/Functions.java Fri Jun 6 15:43:44 2008 @@ -18,26 +18,26 @@ /** * Defines the functions for the jsp2 example tag library. - * + * *Each function is defined as a static method.
*/ public class Functions { - public static String reverse( String text ) { - return new StringBuffer( text ).reverse().toString(); + public static String reverse(String text) { + return new StringBuffer(text).reverse().toString(); } - public static int numVowels( String text ) { + public static int numVowels(String text) { String vowels = "aeiouAEIOU"; - int result = 0; - for( int i = 0; i < text.length(); i++ ) { - if( vowels.indexOf( text.charAt( i ) ) != -1 ) { - result++; - } - } - return result; + int result = 0; + for (int i = 0; i < text.length(); i++) { + if (vowels.indexOf(text.charAt(i)) != -1) { + result++; + } + } + return result; } - public static String caps( String text ) { + public static String caps(String text) { return text.toUpperCase(); } } Modified: geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/simpletag/EchoAttributesTag.java URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/simpletag/EchoAttributesTag.java?rev=664175&r1=664174&r2=664175&view=diff ============================================================================== --- geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/simpletag/EchoAttributesTag.java (original) +++ geronimo/samples/branches/2.1/samples/jsp-examples/jsp-examples-war/src/main/java/jsp2/examples/simpletag/EchoAttributesTag.java Fri Jun 6 15:43:44 2008 @@ -18,37 +18,36 @@ package jsp2.examples.simpletag; +import java.io.IOException; +import java.util.ArrayList; + import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.tagext.SimpleTagSupport; import javax.servlet.jsp.tagext.DynamicAttributes; -import java.util.ArrayList; -import java.io.IOException; +import javax.servlet.jsp.tagext.SimpleTagSupport; /** - * SimpleTag handler that echoes all its attributes + * SimpleTag handler that echoes all its attributes */ -public class EchoAttributesTag - extends SimpleTagSupport - implements DynamicAttributes -{ +public class EchoAttributesTag + extends SimpleTagSupport + implements DynamicAttributes { private ArrayList keys = new ArrayList(); private ArrayList values = new ArrayList(); public void doTag() throws JspException, IOException { - JspWriter out = getJspContext().getOut(); - for( int i = 0; i < keys.size(); i++ ) { - String key = (String)keys.get( i ); - Object value = values.get( i ); - out.println( "