Re: Valve to dump response messages?

2018-01-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alex,

On 1/15/18 12:47 PM, Alex O'Ree wrote:
> On Mon, Jan 15, 2018 at 12:27 PM, Christopher Schultz < 
> ch...@christopherschultz.net> wrote:
> 
> Alex,
> 
> On 1/13/18 9:03 PM, Alex O'Ree wrote:
>>> After googling, I've found the request dumper valve, but I was 
>>> wondering if there was an equivalent for response content? I
>>> have been able to rig up a http servlet filter that can capture
>>> and log response messages but i was looking for a more
>>> universal way to accomplish this for all http
>>> requests/responses to tomcat.
>> 
>> Have a look at this: 
>> http://markmail.org/message/fumpfuspt7a3nesz
> 
> Thanks Chris, I do have a similar solution using servlet filters, 
> however i was looking for a solution using a valve. I do not know 
> much about how valves work yet but i'm digging through the source 
> now...

A Valve is essentially a Filter except that it will run *before* all
application-defined Filters and it has access to the request/response
objects at a lower level than a Filter would.

Most of those lower-level interfaces also implement the e.g.
HttpServletRequest/HttpServletResponse interfaces, so much of the code
can be copied verbatim from my example.

Or you can use my code as a starting point to write a Valve that uses
those lower-level interfaces. There are no built-in wrappers for
Tomcat's Request and Response objects, though, so "wrapping" them just
requires more work. (I did propose wrapper classes for those, but was
discouraged from adding them to Tomcat proper. You can look in BZ for
some very old code that does that.)

What are you actually trying to accomplish, here? Perhaps neither a
Valve nor a Filter is the best solution.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc7QIdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFj4Cw/+Pa+7kG123Q5r3msd
vRhPZR0ZWMZhfmy0Nwvdt1GRNkNRfyUmfurHCcaIHU00Q4AJejdMUm77vIEutyPs
s0r0n6NucE7Aqh2oXgNNowkscs942YcD5A7XumY873GIVqVfxysYVKIWMR8pRwRZ
wCn0x2c9bEX/RfuflHbfQT/0VLRET2WYMj19gTWVXKOk/fINus3PPdBMeys/vq8n
MsWgf0ya2RTB3lTaSEAD7S7UegdAWccRvuxa8BHbO9iWOdqE3dacx5JVr9GHt1n/
Geoi6owZSBxqJF5wUlPVBPsFaB7muC/P9D6FnKbvG9wPV0XbkxuWL+9jE6HGTKt7
2hJTZaomJIZNGTrfFktt2lJkfz14CCtR8wT+CpCttGr1Hi+skSUuqoyODDTGsaRL
QPeYWooyFrdNYscbdrt2LYgtbYm7FpNdc4wpaRKsYMVJ62KPdvFafHI0KsMVWhG+
n6hQuoheIIUWkjidF8dir2bSloAknriVwON+yFk1ttqAFh1SW8AMjwVOc1BOr/hk
3GxMYT4RQgrx/bZKYVnPA6nPkE1+gnV7+KmKHzItZQXf3c2CrG6TMTK6cZjm9yuo
tcBu4syf0eb0dTTEKvZ+J0od8w05pk4AhsyLSXjZ7D/O1Ek0pVqirq/Cz+SOySY9
JHoeTIqmKvySus/8OuJGUrSgK2o=
=n7jQ
-END PGP SIGNATURE-

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



Re: Valve to dump response messages?

2018-01-15 Thread Alex O'Ree
Thanks Chris, I do have a similar solution using servlet filters, however i
was looking for a solution using a valve. I do not know much about how
valves work yet but i'm digging through the source now...

On Mon, Jan 15, 2018 at 12:27 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Alex,
>
> On 1/13/18 9:03 PM, Alex O'Ree wrote:
> > After googling, I've found the request dumper valve, but I was
> > wondering if there was an equivalent for response content? I have
> > been able to rig up a http servlet filter that can capture and log
> > response messages but i was looking for a more universal way to
> > accomplish this for all http requests/responses to tomcat.
>
> Have a look at this:
> http://markmail.org/message/fumpfuspt7a3nesz
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc5JYdHGNocmlzQGNo
> cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhB4Q/+MCjRFDwweGXioqGt
> T3rdtnwfYIMrUgxNDV+8hPdp2BabliNIkmLL3DVCdKqPrRISkQlQRsDBp+FTwIp0
> 0bX6BgTxVGz4hMfRIAMzU4Kz4Mb6f8/Q4x9hXSi331jl+4aSC5LWLHzuT1MOsPU7
> m9oGodiRdr7jYs+JMKF9315hRsDF4oBvfFDEwT321np8+DdUYi5+uQfoROq+0Okp
> G/ZAQEsUURamZIrp3+bULJNFQhkEcIaLjywJasrGmYyxEmD8aX6s7F5b1StWuTrX
> i21sW+2Lv2Vf1iMNPRfg2N2qA4IZ6tGcZmDanYrOKYnd48G2tQn3rMW5x642uSII
> AlmOy6jaAScUnhN1qEhFbkZimHCzlI2bD3YixaLKS5pJssRvlPaIZuRcv0tTMKId
> mZxUaDVxF6b/v5FYI7zmdtmKIF7rzEwWr/Qr6DjFuAi09LiU6zzX3Hsdrq7w1Ivg
> oOU5pKJ8T14z+2t9wAeXBKyWXCto6ZBjtUhVZ7X+HxqcT0p71pcpjVK5DaIFzGI5
> vI6eWWt6G9SEBXOGOponnN/1iS/Bm9JyJ0dlxTPeqs2mnzjMzPdHD6suYzs+/LYH
> zqzvl696jS5wjKpOyVmE3Aypy+1SkRCP01NIndYC0KGmIcw73I8mAFXGb8dGWFKE
> RqPz0mTVoL5scWBCQlJ6+DTkX8Y=
> =I+5u
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Valve to dump response messages?

2018-01-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Alex,

On 1/13/18 9:03 PM, Alex O'Ree wrote:
> After googling, I've found the request dumper valve, but I was
> wondering if there was an equivalent for response content? I have
> been able to rig up a http servlet filter that can capture and log
> response messages but i was looking for a more universal way to
> accomplish this for all http requests/responses to tomcat.

Have a look at this:
http://markmail.org/message/fumpfuspt7a3nesz

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc5JYdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhB4Q/+MCjRFDwweGXioqGt
T3rdtnwfYIMrUgxNDV+8hPdp2BabliNIkmLL3DVCdKqPrRISkQlQRsDBp+FTwIp0
0bX6BgTxVGz4hMfRIAMzU4Kz4Mb6f8/Q4x9hXSi331jl+4aSC5LWLHzuT1MOsPU7
m9oGodiRdr7jYs+JMKF9315hRsDF4oBvfFDEwT321np8+DdUYi5+uQfoROq+0Okp
G/ZAQEsUURamZIrp3+bULJNFQhkEcIaLjywJasrGmYyxEmD8aX6s7F5b1StWuTrX
i21sW+2Lv2Vf1iMNPRfg2N2qA4IZ6tGcZmDanYrOKYnd48G2tQn3rMW5x642uSII
AlmOy6jaAScUnhN1qEhFbkZimHCzlI2bD3YixaLKS5pJssRvlPaIZuRcv0tTMKId
mZxUaDVxF6b/v5FYI7zmdtmKIF7rzEwWr/Qr6DjFuAi09LiU6zzX3Hsdrq7w1Ivg
oOU5pKJ8T14z+2t9wAeXBKyWXCto6ZBjtUhVZ7X+HxqcT0p71pcpjVK5DaIFzGI5
vI6eWWt6G9SEBXOGOponnN/1iS/Bm9JyJ0dlxTPeqs2mnzjMzPdHD6suYzs+/LYH
zqzvl696jS5wjKpOyVmE3Aypy+1SkRCP01NIndYC0KGmIcw73I8mAFXGb8dGWFKE
RqPz0mTVoL5scWBCQlJ6+DTkX8Y=
=I+5u
-END PGP SIGNATURE-

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



Re: Activating Tomcat 8.5 APR on RHEL7

2018-01-15 Thread Peter Kreuser


Hi Jean-Pierre,

> Am 15.01.2018 um 15:45 schrieb Jean Pierre Urkens 
> :
> 
> I am having problems getting the apr library discovered by Tomcat 8.5. This 
> is what I tried:
>  
> 1.  I installed Tomcat-8.5 on RHEL-7.
> 2.  As the native tomcat apr libraries wheren’t available on RHEL I made 
> them myself as instructed by 
> http://tomcat.apache.org/tomcat-8.5-doc/apr.html. After that the tomcat 
> native apr libraries where present under ‘/usr/local/apr/lib’.
> 3.  To get this library path included in java.library.path I tried:
> a.  Create/modify $TOMCAT_BASE/bin/setenv.sh to include the following two 
> lines:
>LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
>export LD_LIBRARY_PATH
> After restarting tomcat the catalina log shows the message:
> 15-Jan-2018 13:03:31.778 INFO [main] 
> org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based 
> Apache Tomcat Native library which allows optimal performance in production 
> environments was not found on the java.library.path: 
> [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
> 

Set this variable using JAVA_OPTS with -Djava.library.path=/usr/local/apr/lib


> Apparantly the LD_LIBRARY_PATH isn’t taken up by catalina?
> b.  I also tried setting environment variables via the command prompt:
> #> TOMCAT_HOME=/opt/tomcat8;
> #> export TOMCAT_HOME
> #> TOMCAT_BASE=/var/lib/tomcat8/nodes/node1; 
> #> export TOCAT_BASE
> #> LD_LIBRARY_PATH=$LD_LIBARAY_PATH:/usr/local/apr/lib;
> #> export LD_LIBRARY_PATH
> #> /opt/tomcat8/bin/startup.sh start
> 
> But also that is giving the same AprLifecycleListener  message?
>  
> Could someone clarify what the right way is to get the apr libraries on the 
> java.library.path of Tomcat8.5?
>  
> Met vriendelijke groet,
> Jean Pierre Urkens
> System Architect
> Adv. Dev and Cloud Integration
> +32 (0)14 722162
> +32 (0)478 838336
> jean-pierre.urk...@devoteam.com
> 
> 
> 
> 
> 
> Maatschappelijke zetel Devoteam NV/SA
> Belgicastraat 17  - 1930 Zaventem
> VAT: BE 0466.475.275  /  RPM Bruxelles - RPR Brussel
>  
>  

Best regards

Peter

Activating Tomcat 8.5 APR on RHEL7

2018-01-15 Thread Jean Pierre Urkens
I am having problems getting the apr library discovered by Tomcat 8.5. This
is what I tried:

 

1.  I installed Tomcat-8.5 on RHEL-7.

2.  As the native tomcat apr libraries wheren't available on RHEL I made
them myself as instructed by
http://tomcat.apache.org/tomcat-8.5-doc/apr.html. After that the tomcat
native apr libraries where present under '/usr/local/apr/lib'.

3.  To get this library path included in java.library.path I tried:

a.  Create/modify $TOMCAT_BASE/bin/setenv.sh to include the following
two lines:
   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
   export LD_LIBRARY_PATH
After restarting tomcat the catalina log shows the message:
15-Jan-2018 13:03:31.778 INFO [main]
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based
Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path:
[/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]

Apparantly the LD_LIBRARY_PATH isn't taken up by catalina?

b.  I also tried setting environment variables via the command prompt:
#> TOMCAT_HOME=/opt/tomcat8;
#> export TOMCAT_HOME
#> TOMCAT_BASE=/var/lib/tomcat8/nodes/node1; 
#> export TOCAT_BASE
#> LD_LIBRARY_PATH=$LD_LIBARAY_PATH:/usr/local/apr/lib;
#> export LD_LIBRARY_PATH
#> /opt/tomcat8/bin/startup.sh start

But also that is giving the same AprLifecycleListener  message?

 

Could someone clarify what the right way is to get the apr libraries on the
java.library.path of Tomcat8.5?

 


Met vriendelijke groet,

Jean Pierre Urkens


System Architect


Adv. Dev and Cloud Integration


  +32 (0)14 722162


  +32 (0)478 838336


  jean-pierre.urk...@devoteam.com




  

  

  


  

Maatschappelijke zetel Devoteam NV/SA

Belgicastraat 17  - 1930 Zaventem
VAT: BE 0466.475.275  /  RPM Bruxelles - RPR Brussel

 

 



RE: tomcat 7.0 resurrecting directory while service is installed - running in command line mode?

2018-01-15 Thread Berneburg, Cris J. - US
Christoph

While my response is late, and you seemed to have solved your problem, if you 
don't mind, I would like to attempt to clarify about quotes and spaces in 
Windows.

-Original Message-
From: Christoph P.U. Kukulies [mailto:k...@kukulies.org] 
Sent: Wednesday, January 10, 2018 6:39 AM
To: users@tomcat.apache.org
Subject: Re: tomcat 7.0 resurrecting directory while service is installed - 
running in command line mode?

[SNIP]

> Nonetheless still having a bit trouble with it and would like
> to use your suggestion, but it fails somehow due to blanks in
> path name. This weirdness with blanks in paths:
>
> C:\Program Files\Apache Software Foundation\Tomcat 7.0>SET 
> CATALINA_HOME=c:"\Program Files\Apache Software Foundation\Tomcat 7.0"
>
> C:\Program Files\Apache Software Foundation\Tomcat 7.0>echo %CATALINA_HOME%
> c:"\Program Files\Apache Software Foundation\Tomcat 7.0"

> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0>%CATALINA_HOME%\bin\catalina.bat start
> "Files\Apache" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
>
> C:\Program Files\Apache Software Foundation\Tomcat 7.0>
>
> I tried various combinations of quoting. Does anyone see the error?

You don't need quotes using SET statements in Windows Command Prompt (aka, 
batch files).  Everything after the equals sign is assigned to the variable.  
(Um, except for maybe output redirects such as greater than, but please don't 
quote me on that.)  So these below are fine:

SET CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 7.0

SET CATALINA_HOME=%ProgramFiles%\Apache Software Foundation\Tomcat 7.0

Where the quotes are needed would be when the variable is evaluated in an 
expression %LIKE_THIS% for commands that separate command line tokens using 
spaces.  The DIR command is sensitive to spaces because it can take multiple 
args on its command line.

Without the quotes DIR is confused:

> DIR %ProgramFiles%
>
> File Not Found

With the quotes DIR works fine:

> DIR "%ProgramFiles%"
>
> Directory of C:\Program Files

Here's the iffy part.  I used only one set of quotes around an entire argument. 
 I have found that using multiple sets of quotes around each space-embedded 
section at the very least confuses the human (me) and *sometimes possibly* the 
computer, especially when nesting of batch files occurs, but I have not 
definitively proved this.  So I try to keep it simpler by using the least 
amount of quotes possible when wrapping each whole argument individually.

Multiple quotes is confusing to me but works with DIR:

> DIR C:\"Program Files"\"Common Files"
>
> Directory of C:\Program Files\Common Files

Single set of double-quotes is less confusing for me:

> DIR "C:\Program Files\Common Files"
>
> Directory of C:\Program Files\Common Files

Examples of nested batch files with space-embedded arguments and multiple sets 
of quotes are beyond the scope of this example and are left as an exercise to 
the reader.  ;-)

And to top it off, I sometimes "cheat" by changing the installation folder 
names to remove spaces so I don't have to mess with quotes:

> C:\apps\asf\tomcat_7.0

FYI, these findings have been from personal experience, not from any official 
documentation.  So the caveat YMMV might still apply.

Hope this helps to make things at least a little bit less confusing.  :-)

--
Cris Berneburg
CACI Lead Software Engineer