#!/bin/bash

# Add the JSP security constraint to the Tomcat web.xml file.

web_xml=$1
web_xml_sav=${web_xml}.sav
echo web_xml $web_xml web_xml_sav $web_xml_sav

mv $web_xml $web_xml_sav

sed 's%</web-app>%\
    <security-constraint>\
        <web-resource-collection>\
            <web-resource-name>Disable JSP</web-resource-name>\
            <url-pattern>*.jsp</url-pattern>\
            <url-pattern>*.jspx</url-pattern>\
        </web-resource-collection>\
        <auth-constraint/>\
    </security-constraint>\
\
</web-app>%' $web_xml_sav > $web_xml
