[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.25-33-g67733e2
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Tue Nov 16 23:44:56 CET 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 67733e2544ada1403ad3c7420e1f17606e0c1f3a (commit)
from 8c9b86fb1553924df8ea682ca39ef336db2725ae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=67733e2544ada1403ad3c7420e1f17606e0c1f3a
http://github.com/ceki/logback/commit/67733e2544ada1403ad3c7420e1f17606e0c1f3a
commit 67733e2544ada1403ad3c7420e1f17606e0c1f3a
Author: Ceki Gulcu <ceki at qos.ch>
Date: Tue Nov 16 23:41:38 2010 +0100
- minor edits
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
index 0868045..f66ae9d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
@@ -21,11 +21,11 @@ import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
-import ch.qos.logback.access.AccessConstants;
-
+import static ch.qos.logback.access.AccessConstants.LB_INPUT_BUFFER;
+import static ch.qos.logback.access.AccessConstants.X_WWW_FORM_URLECODED;
/**
* As the "tee" program on Unix, duplicate the request's input stream.
- *
+ *
* @author Ceki Gülcü
*/
class TeeHttpServletRequest extends HttpServletRequestWrapper {
@@ -36,13 +36,14 @@ class TeeHttpServletRequest extends HttpServletRequestWrapper {
TeeHttpServletRequest(HttpServletRequest request) {
super(request);
+ // we can't access the input stream and access the request parameters
+ // at the same time
if (Util.isFormUrlEncoded(request)) {
postedParametersMode = true;
} else {
inStream = new TeeServletInputStream(request);
// add the contents of the input buffer as an attribute of the request
- request
- .setAttribute(AccessConstants.LB_INPUT_BUFFER, inStream.getInputBuffer());
+ request.setAttribute(LB_INPUT_BUFFER, inStream.getInputBuffer());
reader = new BufferedReader(new InputStreamReader(inStream));
}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
index c544118..6c4e168 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
@@ -25,55 +25,53 @@ import javax.servlet.http.HttpServletRequest;
class TeeServletInputStream extends ServletInputStream {
- InputStream in;
- byte[] inputBuffer;
+ InputStream in;
+ byte[] inputBuffer;
- TeeServletInputStream(HttpServletRequest request) {
- duplicateInputStream(request);
- }
+ TeeServletInputStream(HttpServletRequest request) {
+ duplicateInputStream(request);
+ }
- @Override
- public int read() throws IOException {
- return in.read();
- }
+ @Override
+ public int read() throws IOException {
+ return in.read();
+ }
- private void duplicateInputStream(HttpServletRequest request) {
- ServletInputStream originalSIS = null;
- try {
- originalSIS = request.getInputStream();
- System.out.println("****************************************************");
- System.out.println("**************SIS type="+originalSIS.getClass().getName());
- inputBuffer = consumeBufferAndReturnAsByteArray(originalSIS);
- this.in = new ByteArrayInputStream(inputBuffer);
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- closeStrean(originalSIS);
- }
+ private void duplicateInputStream(HttpServletRequest request) {
+ ServletInputStream originalSIS = null;
+ try {
+ originalSIS = request.getInputStream();
+ inputBuffer = consumeBufferAndReturnAsByteArray(originalSIS);
+ this.in = new ByteArrayInputStream(inputBuffer);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ closeStrean(originalSIS);
}
+ }
- byte[] consumeBufferAndReturnAsByteArray(InputStream is) throws IOException {
- int len = 1024;
- byte[] temp = new byte[len];
- int c = -1;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- while ((c = is.read(temp, 0, len)) != -1) {
- baos.write(temp, 0, c);
- }
- return baos.toByteArray();
+ byte[] consumeBufferAndReturnAsByteArray(InputStream is) throws IOException {
+ int len = 1024;
+ byte[] temp = new byte[len];
+ int c = -1;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ while ((c = is.read(temp, 0, len)) != -1) {
+ baos.write(temp, 0, c);
}
+ return baos.toByteArray();
+ }
- void closeStrean(ServletInputStream is) {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
+ void closeStrean(ServletInputStream is) {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
}
+ }
- byte[] getInputBuffer() {
- return inputBuffer;
- }
+ byte[] getInputBuffer() {
+ return inputBuffer;
+ }
}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
index bcdde15..cdd1f2d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
@@ -21,7 +21,7 @@ import ch.qos.logback.access.AccessConstants;
public class Util {
public static boolean isFormUrlEncoded(HttpServletRequest request) {
- if ("POST".equals(request.getMethod())
+ if ("POST".equalsIgnoreCase(request.getMethod())
&& AccessConstants.X_WWW_FORM_URLECODED.equals(request.getContentType())) {
return true;
} else {
diff --git a/logback-site/src/site/pages/index.html b/logback-site/src/site/pages/index.html
index ffce20e..eef4e2b 100644
--- a/logback-site/src/site/pages/index.html
+++ b/logback-site/src/site/pages/index.html
@@ -72,12 +72,13 @@
<li><a href="http://cia.sourceforge.net/">Citizen Intelligence Agency</a></li>
<li><a href="http://www.geomajas.org/">Geomajas</a></li>
<li><a href="http://www.gradle.org/">Gradle</a></li>
-
+ <li><a href="http://jmxmonitor.sourceforge.net/">JMX Monitor</a></li>
</ul>
</td>
<td valign="top">
<ul>
- <li><a href="http://jmxmonitor.sourceforge.net/">JMX Monitor</a></li>
+
+ <li><a href="http://jwebunit.sourceforge.net/quickstart.html">JWebUnit</a></li>
<li><a href="http://www.opengda.org/">OpenGDA</a></li>
<li><a href="http://code.google.com/p/openmeetings/">OpenMeetings</a></li>
<li><a href="http://liftweb.net/">Lift</a></li>
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 86a5035..3197d5a 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -31,6 +31,12 @@
<h3>xxx, 2010 - Release of version 0.9.27</h3>
+ <p><code>TeeServletInputStream</code> no longer chokes on input
+ over 8K in size. This fixes <a
+ href="http://jira.qos.ch/browse/LBACCESS-10">LBACCESS-10</a> as
+ reported by Augusto Rodriguez.
+ </p>
+
<p>Fixed <a
href="http://jira.qos.ch/browse/LBCLASSIC-231">LBCLASSIC-231</a>
as reported by Jeff Skjonsby. When configuring
-----------------------------------------------------------------------
Summary of changes:
.../access/servlet/TeeHttpServletRequest.java | 11 ++-
.../access/servlet/TeeServletInputStream.java | 82 ++++++++++----------
.../java/ch/qos/logback/access/servlet/Util.java | 2 +-
logback-site/src/site/pages/index.html | 5 +-
logback-site/src/site/pages/news.html | 6 ++
5 files changed, 56 insertions(+), 50 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list