[Bug 60306] New: Wrong javadoc for setRotatable

2016-10-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60306

Bug ID: 60306
   Summary: Wrong javadoc for setRotatable
   Product: Tomcat 8
   Version: 8.5.4
  Hardware: PC
OS: Mac OS X 10.1
Status: NEW
  Severity: minor
  Priority: P2
 Component: Documentation
  Assignee: dev@tomcat.apache.org
  Reporter: stephane.nic...@gmail.com

The javadoc of `AccessLogVavle#setRotatable` could be polished, it looks like
this:

"Set the value is we should we rotate the logs"

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rainer Jung

Am 26.10.2016 um 08:33 schrieb Romain Manni-Bucau:

2016-10-26 8:26 GMT+02:00 Rainer Jung :


Am 25.10.2016 um 22:40 schrieb Romain Manni-Bucau:


2016-10-25 22:35 GMT+02:00 Rainer Jung :

Am 25.10.2016 um 17:07 schrieb Romain Manni-Bucau:



I'm not sure though, how dangerous this is due to possible effects on
Log4J2 in some webapp. IMHO the alternative LogEvent and LogEventFactory
impl must be made available for Tomcat use already in the CLASSPATH. The
server loader could already be too late. That means it is also visible to
any webapp. And activating it is done either via a system property, or a
resource named log4j2.component.properties which contains the property

Log4jLogEventFactory=org.apache.juli.JuliLogEventFactory

Again this resource IMHO must reside in the CLASSPATH. So both ways of
activating the alternative LogEvent impl also activate it for any Log4J2
in
any webapp.


True or not, nothing prevents to run it in a logger classloader to

isolate
from webapp. That said if you want tomcat to log with log4j2 you likely
also want the webapps to do the same IMO. Also tomcat has a classloader
context selector so config can be per webapp or at least hook is there for
that.



I was more concerned about a webapp that does not use juli, but uses
Log4J2 directly (or via SLF4J etc.). We should not disturb the behavior of
such a webapp by our Tomcat log setup.



Yes Tomcat is not yet able to filter resources by classloader (Loader could
get a config for that with defaults, we do it in tomee for slf4j and
several specs for instance)


Note that for the jul bridge to work, the Log4J2 jar files have to be 
put onto the CLASSPATH (otherwise the Log4J2 jul LogManager can't be 
used) and so the resource pointing to the custom LogEventFactory must 
sit there as well.


But it seems one of my early tests was wrong. The custom factory is 
*not* being loaded by a webapp local Log4J2 instance. At least not with 
the setup I originally described.


So putting the factory and the log4j2.component.properties file into the 
tomcat-juli.jar should be transparent (to webapps and also the setups 
which do not use Log4J2 at all) and would be one solution to the 
original problem of wrong location info. I still need to test behavior 
if webapps use juli as well.


Whether we also want to directly support Log4J2 with an SPI provided Log 
implementation that delegates to Log4J2 is still open. Personally I find 
it somewhat cleaner to point to the Log4J standard way (adding the jul 
bridge and other log4j jar files as well as the LogManager system 
property) instead of needing to activate/add a separate TC jar file 
containing the new Log impl and SPI meta data. It seems the only way to 
activate the log impl via SPI is adding the containing jar to the class 
loader search path (likely CLASSPATH).


Regards,

Rainer

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



Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rémy Maucherat
2016-10-26 11:38 GMT+02:00 Rainer Jung :

> Note that for the jul bridge to work, the Log4J2 jar files have to be put
> onto the CLASSPATH (otherwise the Log4J2 jul LogManager can't be used) and
> so the resource pointing to the custom LogEventFactory must sit there as
> well.
>
> But it seems one of my early tests was wrong. The custom factory is *not*
> being loaded by a webapp local Log4J2 instance. At least not with the setup
> I originally described.
>
> So putting the factory and the log4j2.component.properties file into the
> tomcat-juli.jar should be transparent (to webapps and also the setups which
> do not use Log4J2 at all) and would be one solution to the original problem
> of wrong location info. I still need to test behavior if webapps use juli
> as well.
>
> Whether we also want to directly support Log4J2 with an SPI provided Log
> implementation that delegates to Log4J2 is still open. Personally I find it
> somewhat cleaner to point to the Log4J standard way (adding the jul bridge
> and other log4j jar files as well as the LogManager system property)
> instead of needing to activate/add a separate TC jar file containing the
> new Log impl and SPI meta data. It seems the only way to activate the log
> impl via SPI is adding the containing jar to the class loader search path
> (likely CLASSPATH).
>
> One of the problems of using a standard logging framework was class
conflicts (the webapps can see a shared log4j, they can try to override it,
but it could cause issues).

Rémy


svn commit: r1766664 - /tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 11:03:02 2016
New Revision: 174

URL: http://svn.apache.org/viewvc?rev=174&view=rev
Log:
Add a couple of tests to explicitly check Tomcat doesn't allow clients to 
create circular dependencies between streams.

Modified:
tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java?rev=174&r1=173&r2=174&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestAbstractStream.java Wed Oct 
26 11:03:02 2016
@@ -169,4 +169,81 @@ public class TestAbstractStream {
 Assert.assertTrue(c.getChildStreams().contains(e));
 Assert.assertEquals(0,  e.getChildStreams().size());
 }
+
+
+@Test
+public void testCircular01() {
+// Setup
+Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null);
+Stream a = new Stream(Integer.valueOf(1), handler);
+Stream b = new Stream(Integer.valueOf(2), handler);
+Stream c = new Stream(Integer.valueOf(3), handler);
+
+b.rePrioritise(a, false, 16);
+c.rePrioritise(b, false, 16);
+
+// Action
+a.rePrioritise(c, false, 16);
+
+// Check parents
+Assert.assertEquals(c, a.getParentStream());
+Assert.assertEquals(a, b.getParentStream());
+Assert.assertEquals(handler, c.getParentStream());
+
+// Check children
+Assert.assertEquals(1,  handler.getChildStreams().size());
+Assert.assertTrue(handler.getChildStreams().contains(c));
+Assert.assertEquals(1,  a.getChildStreams().size());
+Assert.assertTrue(a.getChildStreams().contains(b));
+Assert.assertEquals(0,  b.getChildStreams().size());
+Assert.assertEquals(1,  c.getChildStreams().size());
+Assert.assertTrue(c.getChildStreams().contains(a));
+}
+
+
+@Test
+public void testCircular02() {
+// Setup
+Http2UpgradeHandler handler = new Http2UpgradeHandler(null, null);
+Stream a = new Stream(Integer.valueOf(1), handler);
+Stream b = new Stream(Integer.valueOf(2), handler);
+Stream c = new Stream(Integer.valueOf(3), handler);
+Stream d = new Stream(Integer.valueOf(4), handler);
+Stream e = new Stream(Integer.valueOf(5), handler);
+Stream f = new Stream(Integer.valueOf(6), handler);
+
+b.rePrioritise(a, false, 16);
+c.rePrioritise(b, false, 16);
+e.rePrioritise(d, false, 16);
+f.rePrioritise(e, false, 16);
+
+// Action
+a.rePrioritise(f, false, 16);
+d.rePrioritise(c, false, 16);
+
+// Check parents
+Assert.assertEquals(f, a.getParentStream());
+Assert.assertEquals(a, b.getParentStream());
+Assert.assertEquals(handler, c.getParentStream());
+Assert.assertEquals(c, d.getParentStream());
+Assert.assertEquals(d, e.getParentStream());
+Assert.assertEquals(e, f.getParentStream());
+
+// Check children
+Assert.assertEquals(1,  handler.getChildStreams().size());
+Assert.assertTrue(handler.getChildStreams().contains(c));
+Assert.assertEquals(1,  a.getChildStreams().size());
+Assert.assertTrue(a.getChildStreams().contains(b));
+Assert.assertEquals(0,  b.getChildStreams().size());
+Assert.assertEquals(1,  c.getChildStreams().size());
+Assert.assertTrue(c.getChildStreams().contains(d));
+Assert.assertEquals(1,  d.getChildStreams().size());
+Assert.assertTrue(d.getChildStreams().contains(e));
+Assert.assertEquals(1,  e.getChildStreams().size());
+Assert.assertTrue(e.getChildStreams().contains(f));
+Assert.assertEquals(1,  f.getChildStreams().size());
+Assert.assertTrue(f.getChildStreams().contains(a));
+
+}
+
 }



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



El software de construcción modular y escalable.

2016-10-26 Thread softw...@distritok.com



svn commit: r1766675 - in /tomcat/trunk: java/org/apache/catalina/connector/ java/org/apache/coyote/ java/org/apache/coyote/ajp/ java/org/apache/coyote/http11/ java/org/apache/coyote/http2/ test/org/a

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 12:37:27 2016
New Revision: 1766675

URL: http://svn.apache.org/viewvc?rev=1766675&view=rev
Log:
Refactor for consistency
Limits applied after the request/response has been passed to the Adaptor are 
configured on the Connector and obtained via the Adaptor when required.
Limits applied during initial parsing are configured on the ProtocolHandler and 
may be obtained from the Protocol or may be passed to the Processor etc. as 
required.

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Connector.java
tomcat/trunk/java/org/apache/catalina/connector/Request.java
tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java
tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
tomcat/trunk/java/org/apache/coyote/http2/Stream.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
tomcat/trunk/webapps/docs/config/http2.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1766675&r1=1766674&r2=1766675&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Wed Oct 26 
12:37:27 2016
@@ -196,6 +196,12 @@ public class Connector extends Lifecycle
 
 
 /**
+ * The maximum number of cookies permitted for a request. Use a value less
+ * than zero for no limit. Defaults to 200.
+ */
+private int maxCookieCount = 200;
+
+/**
  * The maximum number of parameters (GET plus POST) which will be
  * automatically parsed by the container. 1 by default. A value of less
  * than 0 means no limit.
@@ -411,6 +417,16 @@ public class Connector extends Lifecycle
 }
 
 
+public int getMaxCookieCount() {
+return maxCookieCount;
+}
+
+
+public void setMaxCookieCount(int maxCookieCount) {
+this.maxCookieCount = maxCookieCount;
+}
+
+
 /**
  * @return the maximum number of parameters (GET plus POST) that will be
  * automatically parsed by the container. A value of less than 0 means no

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1766675&r1=1766674&r2=1766675&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Wed Oct 26 
12:37:27 2016
@@ -3051,6 +3051,7 @@ public class Request implements HttpServ
 cookiesParsed = true;
 
 ServerCookies serverCookies = coyoteRequest.getCookies();
+serverCookies.setLimit(connector.getMaxCookieCount());
 CookieProcessor cookieProcessor = getContext().getCookieProcessor();
 cookieProcessor.parseCookieHeader(coyoteRequest.getMimeHeaders(), 
serverCookies);
 }

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1766675&r1=1766674&r2=1766675&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java Wed Oct 26 
12:37:27 2016
@@ -50,7 +50,6 @@ public abstract class AbstractProcessor
 protected final Response response;
 protected volatile SocketWrapperBase socketWrapper = null;
 protected volatile SSLSupport sslSupport;
-private int maxCookieCount = 200;
 
 
 /**
@@ -533,16 +532,6 @@ public abstract class AbstractProcessor
 }
 
 
-public int getMaxCookieCount() {
-return maxCookieCount;
-}
-
-
-public void setMaxCookieCount(int maxCookieCount) {
-this.maxCookieCount = maxCookieCount;
-}
-
-
 @Override
 public void recycle() {
 errorState = ErrorState.NONE;

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1766675&r1=1766674&r2=1766675&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractP

svn commit: r1766677 - in /tomcat/tc8.5.x/trunk: ./ test/org/apache/coyote/http2/TestAbstractStream.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 12:39:05 2016
New Revision: 1766677

URL: http://svn.apache.org/viewvc?rev=1766677&view=rev
Log:
Add a couple of tests to explicitly check Tomcat doesn't allow clients to 
create circular dependencies between streams.

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/test/org/apache/coyote/http2/TestAbstractStream.java

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 26 12:39:05 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
 
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1756289,1756408-1756410,1
 
756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757853,1757903,1757997,1758072-1758075,1758078-1758079,1758292,1758369,1758423,1758425-1758427,1758430,1758459,1758483,1758486-1758487,1758499,1758525,1758556,1758582,1758584,1758588,1758842,1759019,1759212,1759224,1759227,1759252,1759274,1759513-1759516,1759611,1760005,1760022,1760300,1760397,1760446,1760454,1760640,1760648,1761057,1761422,1761491,1761498,1761500-1761501,1761550,1761553,1761572,1761574,1761625-1761626,1761628,1761682,1761740,1761752,1762123,1762168,1762172,1762182,1762202,1762288,1762296,1762348,1762353,1762374,1762503,1762505,1762541,1762608,1762710,1762753,1762766,1762769,1762944,1762947,1762953,1763167,1763179,1763232,1763259,1763271-1763272,1763276-1763277,1763319-176332
 
0,1763370,1763372,1763375,1763377,1763393,1763412,1763430,1763450,1763512,1763516,1763518,1763520,1763529,1763574,1763634-1763635,1763718,1763786,1763798-1763799,1764083,1764425,1764646,1764648-1764649,1764659,1764663,1764682,1764862,1764866-1764867,1764870,1764897,1765133,1765299,1765358,1765439,1765447,1765495,1765502,1765569-1765571,1765579,1765582,1765589-1765590,1765794,1765801,1765813,1765815,1766276,1766514,

svn commit: r1766678 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/catalina/connector/ java/org/apache/coyote/ java/org/apache/coyote/ajp/ java/org/apache/coyote/http11/ java/org/apache/coyote/http2/

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 12:39:52 2016
New Revision: 1766678

URL: http://svn.apache.org/viewvc?rev=1766678&view=rev
Log:
Refactor for consistency
Limits applied after the request/response has been passed to the Adaptor are 
configured on the Connector and obtained via the Adaptor when required.
Limits applied during initial parsing are configured on the ProtocolHandler and 
may be obtained from the Protocol or may be passed to the Processor etc. as 
required.

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/AbstractProcessor.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/AbstractProtocol.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

tomcat/tc8.5.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Http2Protocol.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java
tomcat/tc8.5.x/trunk/test/org/apache/coyote/http2/TestHttp2Limits.java
tomcat/tc8.5.x/trunk/webapps/docs/config/http2.xml

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 26 12:39:52 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
 
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1756289,1756408-1756410,1
 
756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757853,1757903,1757997,1758072-175

Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Romain Manni-Bucau
2016-10-26 11:50 GMT+02:00 Rémy Maucherat :

> 2016-10-26 11:38 GMT+02:00 Rainer Jung :
>
> > Note that for the jul bridge to work, the Log4J2 jar files have to be put
> > onto the CLASSPATH (otherwise the Log4J2 jul LogManager can't be used)
> and
> > so the resource pointing to the custom LogEventFactory must sit there as
> > well.
> >
> > But it seems one of my early tests was wrong. The custom factory is *not*
> > being loaded by a webapp local Log4J2 instance. At least not with the
> setup
> > I originally described.
> >
> > So putting the factory and the log4j2.component.properties file into the
> > tomcat-juli.jar should be transparent (to webapps and also the setups
> which
> > do not use Log4J2 at all) and would be one solution to the original
> problem
> > of wrong location info. I still need to test behavior if webapps use juli
> > as well.
> >
> > Whether we also want to directly support Log4J2 with an SPI provided Log
> > implementation that delegates to Log4J2 is still open. Personally I find
> it
> > somewhat cleaner to point to the Log4J standard way (adding the jul
> bridge
> > and other log4j jar files as well as the LogManager system property)
> > instead of needing to activate/add a separate TC jar file containing the
> > new Log impl and SPI meta data. It seems the only way to activate the log
> > impl via SPI is adding the containing jar to the class loader search path
> > (likely CLASSPATH).
> >
> > One of the problems of using a standard logging framework was class
> conflicts (the webapps can see a shared log4j, they can try to override it,
> but it could cause issues).
>

If I got the original issue right, it is only about allowing a user to
replace the default (JULi) so should be acceptable, no?


>
> Rémy
>


Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rémy Maucherat
2016-10-26 15:32 GMT+02:00 Romain Manni-Bucau :

> If I got the original issue right, it is only about allowing a user to
> replace the default (JULi) so should be acceptable, no?
>
> Right, but once you place your logging framework in the main CL, you could
run into issues. The default is indeed not affected.

Rémy


Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Romain Manni-Bucau
2016-10-26 16:02 GMT+02:00 Rémy Maucherat :

> 2016-10-26 15:32 GMT+02:00 Romain Manni-Bucau :
>
> > If I got the original issue right, it is only about allowing a user to
> > replace the default (JULi) so should be acceptable, no?
> >
> > Right, but once you place your logging framework in the main CL, you
> could
> run into issues. The default is indeed not affected.
>
>
You can see it both way " i"m affected" or "yeah, I inherit from the
ops config". That why I think it is good to let it be "up to the user".


> Rémy
>


[Bug 60306] Wrong javadoc for setRotatable

2016-10-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60306

--- Comment #1 from Christopher Schultz  ---
Would you care to supply a patch for this? It should be easy, plus you can get
your name into the changelog :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1766698 - in /tomcat/trunk: java/org/apache/catalina/startup/Tomcat.java webapps/docs/changelog.xml

2016-10-26 Thread remm
Author: remm
Date: Wed Oct 26 16:25:26 2016
New Revision: 1766698

URL: http://svn.apache.org/viewvc?rev=1766698&view=rev
Log:
Similar to the connector handling, refactor the embedded mode container 
handling to more cleanly allow multiples of each (if needed). Remove relevant 
todos.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1766698&r1=1766697&r2=1766698&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Wed Oct 26 
16:25:26 2016
@@ -133,20 +133,7 @@ public class Tomcat {
 // so that configuration is not lost.
 private final Map pinnedLoggers = new HashMap<>();
 
-// Single engine, service, server, connector - few cases need more,
-// they can use server.xml
 protected Server server;
-protected Service service;
-protected Engine engine;
-
-// To make it a bit easier to config for the common case
-// ( one host, one context ).
-protected Host host;
-
-// TODO: it's easy to add support for more hosts - but is it
-// really needed ?
-
-// TODO: allow use of in-memory connector
 
 protected int port = 8080;
 protected String hostname = "localhost";
@@ -450,8 +437,7 @@ public class Tomcat {
  * @return The service
  */
 public Service getService() {
-getServer();
-return service;
+return (Service) getServer().findServices()[0];
 }
 
 /**
@@ -462,16 +448,27 @@ public class Tomcat {
  * @param host The current host
  */
 public void setHost(Host host) {
-this.host = host;
+Engine engine = getEngine();
+boolean found = false;
+for (Container engineHost : engine.findChildren()) {
+if (engineHost == host) {
+found = true;
+}
+}
+if (!found) {
+engine.addChild(host);
+}
 }
 
 public Host getHost() {
-if (host == null) {
-host = new StandardHost();
-host.setName(hostname);
-
-getEngine().addChild( host );
+Engine engine = getEngine();
+if (engine.findChildren().length > 0) {
+return (Host) engine.findChildren()[0];
 }
+
+Host host = new StandardHost();
+host.setName(hostname);
+getEngine().addChild(host);
 return host;
 }
 
@@ -480,14 +477,15 @@ public class Tomcat {
  * @return The engine
  */
 public Engine getEngine() {
-if(engine == null ) {
-getServer();
-engine = new StandardEngine();
-engine.setName( "Tomcat" );
-engine.setDefaultHost(hostname);
-engine.setRealm(createDefaultRealm());
-service.setContainer(engine);
+Service service = (Service) getServer().findServices()[0];
+if (service.getContainer() != null) {
+return (Engine) service.getContainer();
 }
+Engine engine = new StandardEngine();
+engine.setName( "Tomcat" );
+engine.setDefaultHost(hostname);
+engine.setRealm(createDefaultRealm());
+service.setContainer(engine);
 return engine;
 }
 
@@ -510,9 +508,9 @@ public class Tomcat {
 
 server.setPort( -1 );
 
-service = new StandardService();
+Service service = new StandardService();
 service.setName("Tomcat");
-server.addService( service );
+server.addService(service);
 return server;
 }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1766698&r1=1766697&r2=1766698&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Oct 26 16:25:26 2016
@@ -83,6 +83,10 @@
   
 60297: Simplify connector creation in embedded mode. (remm)
   
+  
+Refactor creation of containers in embedded mode for more consistency
+and flexibility. (remm)
+  
 
   
   



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



svn commit: r1766700 - /tomcat/trunk/webapps/docs/config/http2.xml

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 16:38:33 2016
New Revision: 1766700

URL: http://svn.apache.org/viewvc?rev=1766700&view=rev
Log:
ws police

Modified:
tomcat/trunk/webapps/docs/config/http2.xml

Modified: tomcat/trunk/webapps/docs/config/http2.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http2.xml?rev=1766700&r1=1766699&r2=1766700&view=diff
==
--- tomcat/trunk/webapps/docs/config/http2.xml (original)
+++ tomcat/trunk/webapps/docs/config/http2.xml Wed Oct 26 16:38:33 2016
@@ -157,7 +157,7 @@
 
   The HTTP/2 upgrade protocol will also inherit the following limits from 
the
   HTTP Connector it is nested with:
-  
+
   
 maxCookieCount
 maxParameterCount



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



svn commit: r1766706 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/catalina/startup/Tomcat.java webapps/docs/changelog.xml

2016-10-26 Thread remm
Author: remm
Date: Wed Oct 26 17:03:06 2016
New Revision: 1766706

URL: http://svn.apache.org/viewvc?rev=1766706&view=rev
Log:
Similar to the connector handling, refactor the embedded mode container 
handling to more cleanly allow multiples of each (if needed). Remove relevant 
todos.

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java
tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 26 17:03:06 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
 
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1756289,1756408-1756410,1
 
756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757853,1757903,1757997,1758072-1758075,1758078-1758079,1758292,1758369,1758423,1758425-1758427,1758430,1758459,1758483,1758486-1758487,1758499,1758525,1758556,1758582,1758584,1758588,1758842,1759019,1759212,1759224,1759227,1759252,1759274,1759513-1759516,1759611,1760005,1760022,1760300,1760397,1760446,1760454,1760640,1760648,1761057,1761422,1761491,1761498,1761500-1761501,1761550,1761553,1761572,1761574,1761625-1761626,1761628,1761682,1761740,1761752,1762123,1762168,1762172,1762182,1762202,1762288,1762296,1762348,1762353,1762374,1762503,1762505,1762541,1762608,1762710,1762753,1762766,1762769,1762944,1762947,1762953,1763167,1763179,1763232,1763259,1763271-1763272,1763276-1763277,1763319-176332
 
0,1763370,1763372,1763375,1763377,1763393,1763412,1763430,1763450,1763512,1763516,1763518,1763520,1763529,1763574,1763634-1763635,1763718,1763786,1763798-1763799,1764083,1764425,1764646,1764648-1764649,1764659,1764663,1764682,1764862,1764866-1764867,1764870,1764897,1765133,1765299,1765358,1765439,1765447,1765495,1765502,1765569-1765571

svn commit: r1766713 - /tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 17:54:03 2016
New Revision: 1766713

URL: http://svn.apache.org/viewvc?rev=1766713&view=rev
Log:
Fix an IDE nag

Modified:
tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1766713&r1=1766712&r2=1766713&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Wed Oct 26 
17:54:03 2016
@@ -437,7 +437,7 @@ public class Tomcat {
  * @return The service
  */
 public Service getService() {
-return (Service) getServer().findServices()[0];
+return getServer().findServices()[0];
 }
 
 /**
@@ -477,9 +477,9 @@ public class Tomcat {
  * @return The engine
  */
 public Engine getEngine() {
-Service service = (Service) getServer().findServices()[0];
+Service service = getServer().findServices()[0];
 if (service.getContainer() != null) {
-return (Engine) service.getContainer();
+return service.getContainer();
 }
 Engine engine = new StandardEngine();
 engine.setName( "Tomcat" );



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



svn commit: r1766714 - in /tomcat/trunk/java/org/apache/coyote/http2: LocalStrings.properties Stream.java StreamStateMachine.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 17:58:06 2016
New Revision: 1766714

URL: http://svn.apache.org/viewvc?rev=1766714&view=rev
Log:
Don't call receiveReset when sending a reset.
Restore the sendReset() method on the state machine and use it as intended

Modified:
tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties
tomcat/trunk/java/org/apache/coyote/http2/Stream.java
tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1766714&r1=1766713&r2=1766714&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Wed Oct 
26 17:58:06 2016
@@ -75,8 +75,9 @@ stream.header.unexpectedPseudoHeader=Con
 stream.header.unknownPseudoHeader=Connection [{0}], Stream [{1}], Unknown 
pseduo header [{2}] received
 stream.notWritable=Connection [{0}], Stream [{1}], This stream is not writable
 stream.reprioritisation.debug=Connection [{0}], Stream [{1}], Exclusive [{2}], 
Parent [{3}], Weight [{4}]
-stream.reset.debug=Connection [{0}], Stream [{1}], Reset due to [{2}]
 stream.reset.fail=Connection [{0}], Stream [{1}], Failed to reset stream
+stream.reset.receive=Connection [{0}], Stream [{1}], Reset received due to 
[{2}]
+stream.reset.send=Connection [{0}], Stream [{1}], Reset sent due to [{2}]
 stream.trialerHeader.noEndOfStream=Connection [{0}], Stream [{1}], The trailer 
headers did not include the end of stream flag
 stream.write=Connection [{0}], Stream [{1}]
 

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1766714&r1=1766713&r2=1766714&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Wed Oct 26 17:58:06 
2016
@@ -130,7 +130,7 @@ class Stream extends AbstractStream impl
 
 final void receiveReset(long errorCode) {
 if (log.isDebugEnabled()) {
-log.debug(sm.getString("stream.reset.debug", getConnectionId(), 
getIdentifier(),
+log.debug(sm.getString("stream.reset.receive", getConnectionId(), 
getIdentifier(),
 Long.toString(errorCode)));
 }
 // Set the new state first since read and write both check this
@@ -434,7 +434,11 @@ class Stream extends AbstractStream impl
 if (http2Exception instanceof StreamException) {
 try {
 StreamException se = (StreamException) http2Exception;
-receiveReset(se.getError().getCode());
+if (log.isDebugEnabled()) {
+log.debug(sm.getString("stream.reset.send", 
getConnectionId(), getIdentifier(),
+Long.toString(se.getError().getCode(;
+}
+state.sendReset();
 handler.sendStreamReset(se);
 } catch (IOException ioe) {
 ConnectionException ce = new ConnectionException(

Modified: tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java?rev=1766714&r1=1766713&r2=1766714&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java Wed Oct 
26 17:58:06 2016
@@ -71,6 +71,28 @@ class StreamStateMachine {
 }
 
 
+/**
+ * Marks the stream as reset. This method will not change the stream state
+ * if:
+ * 
+ * The stream is already reset
+ * The stream is already closed
+ * 
+ *
+ * @throws IllegalStateException If the stream is in a state that does not
+ * permit resets
+ */
+public synchronized void sendReset() {
+if (state == State.IDLE) {
+throw new 
IllegalStateException(sm.getString("streamStateMachine.debug.change",
+stream.getConnectionId(), stream.getIdentifier(), state));
+}
+if (state.canReset()) {
+stateChange(state, State.CLOSED_RST_TX);
+}
+}
+
+
 final synchronized void receivedReset() {
 stateChange(state, State.CLOSED_RST_RX);
 }
@@ -129,52 +151,66 @@ class StreamStateMachine {
 
 
 private enum State {
-IDLE   (false, false, true, Http2Error.PROTOCOL_ERROR, 
FrameType.HEADERS,
-   
FrameType.PRIORITY),
-OPEN   (tru

svn commit: r1766715 - in /tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2: AbstractStream.java Hpack.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 17:58:40 2016
New Revision: 1766715

URL: http://svn.apache.org/viewvc?rev=1766715&view=rev
Log:
Reviewing HTTP/2 difference between 8.5.x and 9.0.x

Modified:
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/AbstractStream.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Hpack.java

Modified: tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/AbstractStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/AbstractStream.java?rev=1766715&r1=1766714&r2=1766715&view=diff
==
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/AbstractStream.java 
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/AbstractStream.java Wed 
Oct 26 17:58:40 2016
@@ -56,16 +56,11 @@ abstract class AbstractStream {
 
 
 void addChild(AbstractStream child) {
-child.setParent(this);
+child.setParentStream(this);
 childStreams.add(child);
 }
 
 
-private void setParent(AbstractStream parent) {
-this.parentStream = parent;
-}
-
-
 boolean isDescendant(AbstractStream stream) {
 if (childStreams.contains(stream)) {
 return true;

Modified: tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Hpack.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Hpack.java?rev=1766715&r1=1766714&r2=1766715&view=diff
==
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Hpack.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Hpack.java Wed Oct 26 
17:58:40 2016
@@ -22,7 +22,7 @@ import org.apache.tomcat.util.res.String
 
 final class Hpack {
 
-static final StringManager sm = StringManager.getManager(Hpack.class);
+private static final StringManager sm = 
StringManager.getManager(Hpack.class);
 
 private static final byte LOWER_DIFF = 'a' - 'A';
 static final int DEFAULT_TABLE_SIZE = 4096;



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



svn commit: r1766716 - /tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 18:01:07 2016
New Revision: 1766716

URL: http://svn.apache.org/viewvc?rev=1766716&view=rev
Log:
Remove unnecessary ws

Modified:
tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1766716&r1=1766715&r2=1766716&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Wed Oct 
26 18:01:07 2016
@@ -629,7 +629,6 @@ class Http2UpgradeHandler extends Abstra
 
 private HpackEncoder getHpackEncoder() {
 if (hpackEncoder == null) {
-
 hpackEncoder = new 
HpackEncoder(remoteSettings.getHeaderTableSize());
 }
 return hpackEncoder;



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



Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rainer Jung

Am 26.10.2016 um 15:32 schrieb Romain Manni-Bucau:

2016-10-26 11:50 GMT+02:00 Rémy Maucherat :


2016-10-26 11:38 GMT+02:00 Rainer Jung :


Note that for the jul bridge to work, the Log4J2 jar files have to be put
onto the CLASSPATH (otherwise the Log4J2 jul LogManager can't be used)

and

so the resource pointing to the custom LogEventFactory must sit there as
well.

But it seems one of my early tests was wrong. The custom factory is *not*
being loaded by a webapp local Log4J2 instance. At least not with the

setup

I originally described.

So putting the factory and the log4j2.component.properties file into the
tomcat-juli.jar should be transparent (to webapps and also the setups

which

do not use Log4J2 at all) and would be one solution to the original

problem

of wrong location info. I still need to test behavior if webapps use juli
as well.

Whether we also want to directly support Log4J2 with an SPI provided Log
implementation that delegates to Log4J2 is still open. Personally I find

it

somewhat cleaner to point to the Log4J standard way (adding the jul

bridge

and other log4j jar files as well as the LogManager system property)
instead of needing to activate/add a separate TC jar file containing the
new Log impl and SPI meta data. It seems the only way to activate the log
impl via SPI is adding the containing jar to the class loader search path
(likely CLASSPATH).

One of the problems of using a standard logging framework was class

conflicts (the webapps can see a shared log4j, they can try to override it,
but it could cause issues).



If I got the original issue right, it is only about allowing a user to
replace the default (JULi) so should be acceptable, no?


Yes, the original problem is, that we removed juli-adapters and claim 
that using Log4J2 as an alternative log framework for Tomcat now works 
out-of-the box using the jul support in Log4J2.


See https://bz.apache.org/bugzilla/show_bug.cgi?id=58588 and the 
corresponding changelog entry for 8.5.4:


 58588: Remove the JULI extras package from the distribution. It was 
only useful for switching Tomcat's internal logging to log4j 1.2.x and 
that version of log4j is no longer supported. No additional Tomcat code 
is required if switching Tomcat's internal logging to log via log4j 2.x. 
(markt)


When actually using this I noticed, that the location info in the log 
statements is wrong and can't be fixed with TC or Log4Js out-of-the-box 
features. Due to your hints, we now know how to fix it by adding a 
LogEventFactory and making it available to Log4J2 using a properties 
files as a class loaded ressource.


Regards,

Rainer

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



Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rainer Jung

Am 26.10.2016 um 16:02 schrieb Rémy Maucherat:

2016-10-26 15:32 GMT+02:00 Romain Manni-Bucau :


If I got the original issue right, it is only about allowing a user to
replace the default (JULi) so should be acceptable, no?

Right, but once you place your logging framework in the main CL, you could

run into issues. The default is indeed not affected.


Understood, there's lots of ways to do it wrong and disturb a webapp 
provided Log4J2 instance when adding one to the main CL. Nevertheless I 
like the advanced features of the fully fledged log framework and Log4J2 
got much better allowing to do it right.


Regards,

Rainer


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



svn commit: r1766717 - /tomcat/trunk/webapps/docs/changelog.xml

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 18:05:21 2016
New Revision: 1766717

URL: http://svn.apache.org/viewvc?rev=1766717&view=rev
Log:
Update

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1766717&r1=1766716&r2=1766717&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Oct 26 18:05:21 2016
@@ -136,6 +136,10 @@
 trailer headers allowed and the maximum number of cookies allowed.
 (markt)
   
+  
+Correctly differentiate between sending and receiving a reset frame 
when
+tracking the state of an HTTP/2 stream. (markt)
+  
 
   
   



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



svn commit: r1766718 - in /tomcat/tc8.5.x/trunk: java/org/apache/coyote/http2/LocalStrings.properties java/org/apache/coyote/http2/Stream.java webapps/docs/changelog.xml

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 18:06:17 2016
New Revision: 1766718

URL: http://svn.apache.org/viewvc?rev=1766718&view=rev
Log:
Correctly differentiate between sending and receiving a reset frame when 
tracking the state of an HTTP/2 stream.

Modified:
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/LocalStrings.properties
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java
tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1766718&r1=1766717&r2=1766718&view=diff
==
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/LocalStrings.properties 
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/LocalStrings.properties 
Wed Oct 26 18:06:17 2016
@@ -75,8 +75,9 @@ stream.header.unexpectedPseudoHeader=Con
 stream.header.unknownPseudoHeader=Connection [{0}], Stream [{1}], Unknown 
pseduo header [{2}] received
 stream.notWritable=Connection [{0}], Stream [{1}], This stream is not writable
 stream.reprioritisation.debug=Connection [{0}], Stream [{1}], Exclusive [{2}], 
Parent [{3}], Weight [{4}]
-stream.reset.debug=Connection [{0}], Stream [{1}], Reset due to [{2}]
 stream.reset.fail=Connection [{0}], Stream [{1}], Failed to reset stream
+stream.reset.receive=Connection [{0}], Stream [{1}], Reset received due to 
[{2}]
+stream.reset.send=Connection [{0}], Stream [{1}], Reset sent due to [{2}]
 stream.trialerHeader.noEndOfStream=Connection [{0}], Stream [{1}], The trailer 
headers did not include the end of stream flag
 stream.write=Connection [{0}], Stream [{1}]
 

Modified: tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java?rev=1766718&r1=1766717&r2=1766718&view=diff
==
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/Stream.java Wed Oct 26 
18:06:17 2016
@@ -413,21 +413,6 @@ public class Stream extends AbstractStre
 }
 
 
-/**
- * Marks the stream as reset. This method will not change the stream state
- * if:
- * 
- * The stream is already reset
- * The stream is already closed
- *
- * @throws IllegalStateException If the stream is in a state that does not
- * permit resets
- */
-void sendReset() {
-state.sendReset();
-}
-
-
 void sentPushPromise() {
 state.sentPushPromise();
 }
@@ -462,7 +447,11 @@ public class Stream extends AbstractStre
 if (http2Exception instanceof StreamException) {
 try {
 StreamException se = (StreamException) http2Exception;
-receiveReset(se.getError().getCode());
+if (log.isDebugEnabled()) {
+log.debug(sm.getString("stream.reset.send", 
getConnectionId(), getIdentifier(),
+Long.toString(se.getError().getCode(;
+}
+state.sendReset();
 handler.sendStreamReset(se);
 } catch (IOException ioe) {
 ConnectionException ce = new ConnectionException(

Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1766718&r1=1766717&r2=1766718&view=diff
==
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Wed Oct 26 18:06:17 2016
@@ -123,6 +123,10 @@
 trailer headers allowed and the maximum number of cookies allowed.
 (markt)
   
+  
+Correctly differentiate between sending and receiving a reset frame 
when
+tracking the state of an HTTP/2 stream. (markt)
+  
 
   
   



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



svn commit: r1766719 - /tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java

2016-10-26 Thread markt
Author: markt
Date: Wed Oct 26 18:06:54 2016
New Revision: 1766719

URL: http://svn.apache.org/viewvc?rev=1766719&view=rev
Log:
Remove unnecessary casts

Modified:
tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1766719&r1=1766718&r2=1766719&view=diff
==
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/startup/Tomcat.java Wed Oct 
26 18:06:54 2016
@@ -437,7 +437,7 @@ public class Tomcat {
  * @return The service
  */
 public Service getService() {
-return (Service) getServer().findServices()[0];
+return getServer().findServices()[0];
 }
 
 /**
@@ -477,9 +477,9 @@ public class Tomcat {
  * @return The engine
  */
 public Engine getEngine() {
-Service service = (Service) getServer().findServices()[0];
+Service service = getServer().findServices()[0];
 if (service.getContainer() != null) {
-return (Engine) service.getContainer();
+return service.getContainer();
 }
 Engine engine = new StandardEngine();
 engine.setName( "Tomcat" );



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



Re: TC 8.5 and Log4J2 via Juli: Wrong location info

2016-10-26 Thread Rémy Maucherat
2016-10-26 20:04 GMT+02:00 Rainer Jung :

> Am 26.10.2016 um 16:02 schrieb Rémy Maucherat:
>
>> 2016-10-26 15:32 GMT+02:00 Romain Manni-Bucau :
>>
>> If I got the original issue right, it is only about allowing a user to
>>> replace the default (JULi) so should be acceptable, no?
>>>
>>> Right, but once you place your logging framework in the main CL, you
>>> could
>>>
>> run into issues. The default is indeed not affected.
>>
>
> Understood, there's lots of ways to do it wrong and disturb a webapp
> provided Log4J2 instance when adding one to the main CL. Nevertheless I
> like the advanced features of the fully fledged log framework and Log4J2
> got much better allowing to do it right.
>
> +1

Rémy


Re: Introduce methods read/write with ByteBuffer in CoyoteInputStream/CoyoteOutputStream

2016-10-26 Thread Violeta Georgieva
Hi Remy,

2016-10-25 1:49 GMT+03:00 Rémy Maucherat :
>
> 2016-10-24 20:18 GMT+02:00 Violeta Georgieva :
>
> > There are no issues reported for the refactored functionality available
in
> > 9.0.0.M11.
> > I think it is safe to back port the changes for the next 8.5 release.
> > Do you see any issues?
> >
> > Ok, so it probably works. I suppose it's up to me, at some point, to try
> to improve whatever I would like to improve (for example, it lost API
> symmetry - normally, read/write APIs are the same, not the case here -,
and
> it's not very GC friendly).

Regarding API symmetry: for the read API I cannot use ByteBuffer directly
as parameter so the option is to change the write API to use
ApplicationBufferHandler.
This change can be done easily but the drawback is that one additional
wrapper object will be created for each Response object.
If you are OK with this I can make it.

Let me know if you have other requirements for this change so that I can
implement them and after that backport the change in Tomcat 8.5.

I will double check my tests again for GC issues. Do you have some
observations or concrete concerns so I can focus on them?

Thanks,
Violeta

> Rémy


Re: Introduce methods read/write with ByteBuffer in CoyoteInputStream/CoyoteOutputStream

2016-10-26 Thread Rémy Maucherat
2016-10-26 20:45 GMT+02:00 Violeta Georgieva :

> Hi Remy,
>
> 2016-10-25 1:49 GMT+03:00 Rémy Maucherat :
> >
> > 2016-10-24 20:18 GMT+02:00 Violeta Georgieva :
> >
> > > There are no issues reported for the refactored functionality available
> in
> > > 9.0.0.M11.
> > > I think it is safe to back port the changes for the next 8.5 release.
> > > Do you see any issues?
> > >
> > > Ok, so it probably works. I suppose it's up to me, at some point, to
> try
> > to improve whatever I would like to improve (for example, it lost API
> > symmetry - normally, read/write APIs are the same, not the case here -,
> and
> > it's not very GC friendly).
>
> Regarding API symmetry: for the read API I cannot use ByteBuffer directly
> as parameter so the option is to change the write API to use
> ApplicationBufferHandler.
> This change can be done easily but the drawback is that one additional
> wrapper object will be created for each Response object.
> If you are OK with this I can make it.
>

No. Since my own async scatter/gather didn't provide any benefits, unless
something unexpected occurs I'll give up on that and could try to rework
this at some point.

>
> Let me know if you have other requirements for this change so that I can
> implement them and after that backport the change in Tomcat 8.5.
>
> I will double check my tests again for GC issues. Do you have some
> observations or concrete concerns so I can focus on them?
>
> It does duplicate ByteBuffers, that creates some objects. it doesn't have
any measurable impact on performance however since I didn't notice anything.

Rémy