<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
-->
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
	"https://struts.apache.org/dtds/struts-6.0.dtd">

<!-- START SNIPPET: xworkSample -->
<struts>

    <!-- Some or all of these can be flipped to true for debugging -->
    <constant name="struts.i18n.reload" value="false" />
    <constant name="struts.enable.DynamicMethodInvocation" value="true" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.configuration.xml.reload" value="false" />
    <constant name="struts.custom.i18n.resources" value="globalMessages" />
    <constant name="struts.action.extension" value="action,," />

    <constant name="struts.allowlist.enable" value="true" />
    <constant name="struts.parameters.requireAnnotations" value="true" />
    <constant name="struts.allowlist.packageNames" value="
            org.apache.struts2.showcase.model,
            org.apache.struts2.showcase.modelDriven.model
    "/>
    <constant name="struts.allowlist.classes" value="
            org.apache.struts2.showcase.hangman.Hangman,
            org.apache.struts2.showcase.hangman.HangmanConstants,
            org.apache.struts2.showcase.hangman.Vocab
    "/>

    <constant name="struts.convention.package.locators.basePackage" value="org.apache.struts2.showcase" />
    <constant name="struts.convention.result.path" value="/WEB-INF" />

    <!-- Necessary for Showcase because default includes org.apache.struts2.* -->
    <constant name="struts.convention.exclude.packages" value="org.apache.struts.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"/>

    <constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" />
    <constant name="struts.serve.static" value="true" />
    <constant name="struts.serve.static.browserCache" value="false" />

    <constant name="struts.action.excludePattern" value=".*/images/.*\.gif,.*/img/.*\.gif,.*/styles/.*\.css,.*/js/.*\.js,/testServlet/.*"/>

    <include file="struts-interactive.xml" />

    <include file="struts-hangman.xml" />

    <include file="struts-tags.xml"/>

    <include file="struts-validation.xml" />

    <include file="struts-actionchaining.xml" />

    <include file="struts-fileupload.xml" />

    <include file="struts-person.xml" />

    <include file="struts-wait.xml" />

    <include file="struts-token.xml" />

    <include file="struts-model-driven.xml" />

    <include file="struts-filedownload.xml" />

    <include file="struts-conversion.xml" />

    <include file="struts-freemarker.xml" />

    <include file="struts-tiles.xml" />

    <include file="struts-xslt.xml" />

    <include file="struts-async.xml" />

    <include file="struts-dispatcher.xml" />

    <include file="struts-params-annotation.xml" />

    <package name="default" extends="struts-default">
        <interceptors>
            <interceptor-stack name="crudStack">
                <interceptor-ref name="checkbox" />
                <interceptor-ref name="params" />
                <interceptor-ref name="staticParams" />
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>
        </interceptors>

        <default-action-ref name="showcase" />

        <action name="showcase">
            <result>/WEB-INF/showcase.jsp</result>
        </action>

        <action name="help">
            <result>/WEB-INF/help.jsp</result>
        </action>

        <action name="viewSource" class="org.apache.struts2.showcase.source.ViewSourceAction">
            <result>/WEB-INF/viewSource.jsp</result>
        </action>

        <action name="date" class="org.apache.struts2.showcase.DateAction" method="browse">
            <result name="success">/WEB-INF/date.jsp</result>
        </action>

    </package>

    <package name="skill" extends="default" namespace="/skill">
        <default-interceptor-ref name="crudStack"/>

        <action name="list" class="org.apache.struts2.showcase.action.SkillAction" method="list">
            <result>/WEB-INF/empmanager/listSkills.jsp</result>
            <interceptor-ref name="basicStack"/>
        </action>
        <action name="edit" class="org.apache.struts2.showcase.action.SkillAction">
            <result>/WEB-INF/empmanager/editSkill.jsp</result>
            <interceptor-ref name="params" />
            <interceptor-ref name="basicStack"/>
        </action>
        <action name="save" class="org.apache.struts2.showcase.action.SkillAction" method="save">
            <result name="input">/WEB-INF/empmanager/editSkill.jsp</result>
            <result type="redirect">list.action</result>
        </action>
        <action name="delete" class="org.apache.struts2.showcase.action.SkillAction" method="delete">
            <result name="error">/WEB-INF/empmanager/editSkill.jsp</result>
            <result type="redirect">list.action</result>
        </action>
    </package>

    <package name="employee" extends="default" namespace="/employee">
        <default-interceptor-ref name="crudStack"/>

        <action name="list" class="org.apache.struts2.showcase.action.EmployeeAction" method="list">
            <result>/WEB-INF/empmanager/listEmployees.jsp</result>
            <interceptor-ref name="basicStack"/>
        </action>
        <action name="edit-*" class="org.apache.struts2.showcase.action.EmployeeAction">
      		<param name="empId">{1}</param>
            <result>/WEB-INF/empmanager/editEmployee.jsp</result>
            <interceptor-ref name="crudStack"><param name="validation.excludeMethods">execute</param></interceptor-ref>
        </action>
        <action name="save" class="org.apache.struts2.showcase.action.EmployeeAction" method="save">
            <result name="input">/WEB-INF/empmanager/editEmployee.jsp</result>
            <result type="redirect">list.action</result>
        </action>
        <action name="delete" class="org.apache.struts2.showcase.action.EmployeeAction" method="delete">
            <result name="error">/WEB-INF/empmanager/editEmployee.jsp</result>
            <result type="redirect">list.action</result>
        </action>
    </package>

</struts>

<!-- END SNIPPET: xworkSample -->

