The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JMX::Jmx4Perl::Agent::Jolokia::WebXmlHandler - Handler for web.xml transformation

DESCRIPTION

This module is repsonsible for various manipulations on a web.xml descriptor as found in JEE WAR archives. It uses XML::LibXML for the dirty work, and XML::Tidy to clean up after the manipulation. The later module is optional, but recommended.

METHODS

$handler = JMX::Jmx4Perl::Agent::Jolokia::WebXmlHandler->new(%args)

Creates a new handler. The following arguments can be used:

  "logger"     Logger to use
$handler->add_security($webxml,{ role => $role })

Add a security constraint to the given web.xml. This triggers on the realm "Jolokia" on the loging-config and the URL-Pattern "/*" for the security mapping. Any previous sections are removed and replaced.

$role is the role to insert.

This method returns the updated web.xml as a string.

$handler->remove_security($webxml)

Remove login-config with Realm "Jolokia" and security constraint to "/*" along with the associated role definit. Return the updated web.xml as string.

$handler->add_jsr160_proxy($webxml)

Adds a JSR-160 proxy declaration which is contained as init-param of the servlet definition ("dispatcherClasses"). If the init-param is missing, a new is created otherwise an existing is updated. Does nothing, if the init-param "dispatcherClasses" already contains the JSR 160 dispacher.

Returns the updated web.xml as string.

$handler->remove_jsr160_proxy($webxml)

Removes a JSR-160 proxy declaration which is contained as init-param of the servlet definition ("dispatcherClasses"). Does nothing, if the init-param "dispatcherClasses" already doese not contain the JSR 160 dispacher.

Returns the updated web.xml as string.

$handler->find($webxml,$xquery)

Find a single element with a given XQuery query. Croaks if more than one element is found. Returns either undef (nothing found) or the matched node's text content.

$handler->has_authentication($webxml)

Checks, whether authentication is switched on.

$handler->has_jsr160_proxy($webxml)

Checks, whether a JSR-160 proxy is configured.

LICENSE

This file is part of jmx4perl. Jmx4perl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by The Free Software Foundation, either version 2 of the License, or (at your option) any later version.

jmx4perl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with jmx4perl. If not, see <http://www.gnu.org/licenses/>.

A commercial license is available as well. Please contact roland@cpan.org for further details.

AUTHOR

roland@cpan.org