<?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 2.5//EN"
        "https://struts.apache.org/dtds/struts-2.5.dtd">

<struts>

    <bean type="org.apache.struts2.components.UrlRenderer" name="portlet" class="org.apache.struts2.components.PortletUrlRenderer"/>

    <constant name="struts.urlRenderer" value="portlet"/>
    <constant name="struts.portlet.useDispatcherServlet" value="false"/>
    <constant name="struts.portlet.dispatcherServletName" value="Struts2PortletDispatcherServlet"/>

    <package name="struts-portlet-default" extends="struts-default">

        <result-types>
            <result-type name="dispatcher" class="org.apache.struts2.portlet.result.PortletResult" default="true"/>
            <result-type name="redirect" class="org.apache.struts2.portlet.result.PortletResult"/>
            <result-type name="redirectAction" class="org.apache.struts2.portlet.result.PortletActionRedirectResult"/>
            <result-type name="freemarker" class="org.apache.struts2.views.freemarker.PortletFreemarkerResult"/>
            <result-type name="velocity" class="org.apache.struts2.portlet.result.PortletVelocityResult"/>
        </result-types>

        <interceptors>
            <interceptor name="portletAware" class="org.apache.struts2.portlet.interceptor.PortletAwareInterceptor"/>
            <interceptor name="portletState" class="org.apache.struts2.portlet.interceptor.PortletStateInterceptor"/>
            <!-- Default stack for operating in portlet environment -->
            <interceptor-stack name="portletDefaultStack">
                <interceptor-ref name="portletState"/>
                <interceptor-ref name="portletAware"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
            <!-- Extension of the default portlet stack which also includes the token interceptor -->
            <interceptor-stack name="portletDefaultStackWithToken">
                <interceptor-ref name="portletState"/>
                <interceptor-ref name="portletAware"/>
                <interceptor-ref name="token"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>

        </interceptors>

        <default-interceptor-ref name="portletDefaultStack"/>

        <action name="renderDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
            <result name="success">${location}</result>
        </action>
        <action name="freemarkerDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
            <result type="freemarker" name="success">${location}</result>
        </action>
        <action name="velocityDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
            <result type="velocity" name="success">${location}</result>
        </action>
    </package>
</struts>
