geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Managing Valve
Date Fri, 28 Jan 2011 02:45:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Managing+Valve">Managing
Valve</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~maojia508">maojia</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >* _valvex_ is the system unique name
for the last valve GBean in the chain. <br>* _class_ is the class name of a valid [Tomcat
valve|http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html|The Valve Component]. <br></td></tr>
            <tr><td class="diff-changed-lines" >* _parms_ is a white space separated
list of valve parameters. In this list, each <span class="diff-added-words"style="background-color:
#dfd;">valve</span> parameter has the form _key=value_ where _key_ is the keyword
for the parameter and _value_ is the value of the parameter.  See the valve&#39;s documentation
for information about supported parameters, if any. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC30/Configuring+virtual+host"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC30/Configuring+virtual+host">Configuring
virtual host</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC30/Configuring+the+Web+Container"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Configuring+the+Web+Container">Configuring the Web
Container</a></td><td width='33%' class='ScrollbarNextName'>&nbsp;</td></tr></table></div>
<p>In Tomcat, a <em>valve</em> is a Java class that can be inserted into
the request processing pipeline.  A valve executes as part of Tomcat's servlet container and
is independent of the Web application. Valves run in a chain where the last link in the chain
is the Web application itself. Each valve performs its request processing, calls the next
valve in the chain, performs its response processing, and returns to the valve that called
it. See the <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html" title="The
Valve Component" class="external-link" rel="nofollow">Tomcat valve component</a>
for more information on the valves provided in the Tomcat library.</p>

<p>Currently, the valve cannot be configured by using the administration console. Tomcat
valves are initially defined in the <tt>&lt;geronimo_home&gt;/repository/org/apache/geronimo/configs/tomcat6/2.2/tomcat6-2.2.car/META-INF/plan.xml</tt>
file. To change valves configuration, you must modify <tt>&lt;Geronimo_home&gt;/var/config/<a
href="/confluence/display/GMOxDOC30/config.xml" title="config.xml">config.xml</a></tt>.</p>

<p>The following sections illustrate common changes that you might want to make to your
valve chain.</p>

<div>
<ul>
    <li><a href='#ManagingValve-DisabletheAccessLogValve'>Disable the Access Log
Valve</a></li>
    <li><a href='#ManagingValve-AddasecondValve'>Add a second Valve</a></li>
    <li><a href='#ManagingValve-Configureavalvechain'>Configure a valve chain</a></li>
</ul></div>

<h2><a name="ManagingValve-DisabletheAccessLogValve"></a>Disable the Access
Log Valve</h2>
<p>By default, the initial configuration of the server contains one valve referenced
by the <b>Tomcat engine</b>. That valve is the <b>Access Log Valve</b>.
This value is used to create log files that record every request used to access the Web container
by using the same format as those created by standard Web servers. These logs can later be
analyzed by the administration console and other standard log analysis tools to track page
hit counts, user session activity, and so on. The files produced by this valve are rolled
over nightly at midnight. Its classname is <b>org.apache.catalina.valves.AccessLogValve</b>
and its GBean name is <b>AccessLogValve</b>. In some cases, administrators are
not interested in logging information about the requests sent to the server and want to remove
the overhead of the <b>Access Log Valve</b>.  To remove the <b>Access Log
Valve</b> from the valve chain, use the following procedure:</p>

<ol>
	<li>Stop the server.</li>
	<li>Backup the <tt>&lt;geronimo_home&gt;/var/config/config.xml</tt>
file and then open it in an editor.</li>
	<li>Add the following code right after the <b>&lt;module name="org.apache.geronimo.configs/tomcat6/2.2/car"&gt;</b>
tag to disable the <b>Access Log Valve</b>, and then restart the server after
you save the file.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;module name=<span class="code-quote">"org.apache.geronimo.configs/tomcat6/2.2/car"</span>&gt;
...
    &lt;gbean name=<span class="code-quote">"TomcatEngine"</span>&gt;
        &lt;attribute name=<span class="code-quote">"initParams"</span>&gt;
            name=Geronimo
        &lt;/attribute&gt;
        &lt;reference name=<span class="code-quote">"TomcatValveChain"</span>/&gt;
    &lt;/gbean&gt;
    &lt;gbean name=<span class="code-quote">"AccessLogValve"</span> load=<span
class="code-quote">"<span class="code-keyword">false</span>"</span>&gt;&lt;/gbean&gt;
...
</pre>
</div></div></li>
</ol>


<h2><a name="ManagingValve-AddasecondValve"></a>Add a second Valve </h2>

<p>This section takes the Single Sign-on Valve as an example. The Single Sign-on Valve
is used to give users the ability to sign on to any Web application and then have their identity
recognized by all other Web applications within the same container.  To add the Single Sign-on
Valve to the <b>Access Log Valve</b> in the initial valve chain, use the following
procedure:</p>

<ol>
	<li>Stop the server.</li>
	<li>Backup  <tt>&lt;geronimo_home&gt;/var/config/config.xml</tt>
file and then open it in an editor.</li>
	<li>Add the following code right after the <b>&lt;module name="org.apache.geronimo.configs/tomcat6/2.2/car"&gt;</b>
tag to define the Single Sign-on Valve, and then restart the server after you save the file.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;module name=<span class="code-quote">"org.apache.geronimo.configs/tomcat6/2.2/car"</span>&gt;
    &lt;gbean name=<span class="code-quote">"AccessLogValve"</span>&gt;
        &lt;reference name=<span class="code-quote">"NextValve"</span>&gt;
            &lt;pattern&gt;
                &lt;name&gt;SSOValve&lt;/name&gt;
            &lt;/pattern&gt;
            &lt;/reference&gt;
    &lt;/gbean&gt;
    &lt;gbean gbeanInfo=<span class="code-quote">"org.apache.geronimo.tomcat.ValveGBean"</span>
           name="org.apache.geronimo.configs/tomcat6/2.2/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.2/car,
           j2eeType=GBean,name=SSOValve"&gt;
           &lt;attribute name=<span class="code-quote">"className"</span>&gt;org.apache.catalina.authenticator.SingleSignOn&lt;/attribute&gt;
    &lt;/gbean&gt;
</pre>
</div></div>
	<ul>
		<li>The <b>j2eeType=</b> attribute in the added <b>&lt;gbean&gt;</b>
tags have been split across several lines for readability. In your file, the attribute must
be on a single line. Also, you can add the other Valves by replacing <tt>org.apache.catalina.authenticator.SingleSignOn</tt>
in the <tt>&lt;attribute name="className"&gt; &lt;/attribute&gt;</tt>
block.</li>
	</ul>
	</li>
</ol>




<h2><a name="ManagingValve-Configureavalvechain"></a>Configure a valve chain</h2>

<p>Valves chained to the Tomcat engine are invoked for requests received by all the
virtual hosts. In some cases, you might want to customize the valve chain for a given host.
In this case, use the following procedure:</p>

<ol>
	<li>Stop the server.</li>
	<li>Backup  <tt>&lt;geronimo_home&gt;/var/config/config.xml</tt>
file and then open it in an editor.</li>
	<li>Add the following code right after the <b>&lt;module name="org.apache.geronimo.configs/tomcat6/2.2/car"&gt;</b>
tag to define a valve chain, and then restart the server after you save the file.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;module name=<span class="code-quote">"org.apache.geronimo.configs/tomcat6/2.2/car"</span>&gt;
	&lt;gbean name=<span class="code-quote">"TomcatHost"</span>&gt;
		...
		&lt;reference name=<span class="code-quote">"TomcatValveChain"</span>&gt;
			&lt;pattern&gt;
				&lt;name&gt;valve0&lt;/name&gt;
			&lt;/pattern&gt;
		&lt;/reference&gt;
	&lt;/gbean&gt;
	&lt;gbean gbeanInfo=<span class="code-quote">"org.apache.geronimo.tomcat.ValveGBean"</span>
     
	       name="org.apache.geronimo.configs/tomcat6/2.2/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.2/car,
               j2eeType=GBean,name=valve0"&gt;
	       &lt;attribute name=<span class="code-quote">"className"</span>&gt;class&lt;/attribute&gt;
	       &lt;attribute name=<span class="code-quote">"initParams"</span>&gt;parms&lt;/attribute&gt;
	       &lt;reference name=<span class="code-quote">"TomcatValveChain"</span>&gt;
			&lt;pattern&gt;
				&lt;name&gt;valve1&lt;/name&gt;
			&lt;/pattern&gt;
		&lt;/reference&gt;
	&lt;/gbean&gt;
	&lt;gbean gbeanInfo=<span class="code-quote">"org.apache.geronimo.tomcat.ValveGBean"</span>
     
	       name="org.apache.geronimo.configs/tomcat6/2.2/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.2/car,
               j2eeType=GBean,name=valve1"&gt;
	       &lt;attribute name=<span class="code-quote">"className"</span>&gt;class&lt;/attribute&gt;
	       &lt;attribute name=<span class="code-quote">"initParams"</span>&gt;parms&lt;/attribute&gt;
	       &lt;reference name=<span class="code-quote">"TomcatValveChain"</span>&gt;
			&lt;pattern&gt;
				&lt;name&gt;valve2&lt;/name&gt;
			&lt;/pattern&gt;
		&lt;/reference&gt;
	&lt;/gbean&gt;
        ...
	&lt;gbean gbeanInfo=<span class="code-quote">"org.apache.geronimo.tomcat.ValveGBean"</span>
     
	       name="org.apache.geronimo.configs/tomcat6/2.2/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.2/car,
               j2eeType=GBean,name=valvex"&gt;
	       &lt;attribute name=<span class="code-quote">"className"</span>&gt;class&lt;/attribute&gt;
	       &lt;attribute name=<span class="code-quote">"initParams"</span>&gt;parms&lt;/attribute&gt;
	&lt;/gbean&gt;
</pre>
</div></div>
<p>where</p></li>
</ol>


<ul>
	<li><em>TomcatHost</em> is the name of the Tomcat virtual host GBean that
is to be customized.</li>
	<li><em>valve0</em> is the system unique name for the first valve GBean
in the chain.</li>
	<li><em>valve1</em> is the system unique name for the second valve GBean
in the chain.</li>
	<li><em>valvex</em> is the system unique name for the last valve GBean
in the chain.</li>
	<li><em>class</em> is the class name of a valid <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html"
title="The Valve Component" class="external-link" rel="nofollow">Tomcat valve</a>.</li>
	<li><em>parms</em> is a white space separated list of valve parameters.
In this list, each valve parameter has the form <em>key=value</em> where <em>key</em>
is the keyword for the parameter and <em>value</em> is the value of the parameter.
 See the valve's documentation for information about supported parameters, if any.</li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Managing+Valve">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645460&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Managing+Valve?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message