0

我在使用条纹动作豆时遇到了麻烦。

在浏览器上引入第一个http://localhost:9080/profesionales-sanitarios-war/medicos/publico/accesoInterno会导致 302 状态代码并重定向到 AccesoActionBean

我第二次在浏览器上引入http://localhost:9080/profesionales-sanitarios-war/medicos/publico/accesoInterno时,它返回一个 200 状态码,并且在访问 AccesoInternoActionBean 时工作正常。

它发生在 localhost 和服务器(开发、预生产和生产)中。

AccesoActionBean.java:

@UrlBinding( "/medicos/publico/acceso" + "/{tipoAcceso}/{destino}" )
public class AccesoActionBean extends MedicosBaseActionBean {

[...]

    @DontValidate
    @DefaultHandler
    public Resolution init() {
        setSessionField( SESION_CONTADOR_ACCESOS, contadorAccesos );
        if( tipoAcceso != null && "popup".equalsIgnoreCase( tipoAcceso ) ) {
            return new ForwardResolution( "/WEB-INF/pages/acceso/loginForm.jsp" );

        } else {
            return new ForwardResolution( NavegacionConst.JSP_ACCESO );
        }
    }

[...]

}

AccesoInternoActionBean.java:

@UrlBinding( "/medicos/publico/accesoInterno" )
public class AccesoInternoActionBean extends MedicosBaseActionBean {

[...]

    @DontValidate
    @DefaultHandler
    public Resolution init() {
        setSessionField( SESION_CONTADOR, contadorAccesos );
        return new ForwardResolution( NavegacionConst.JSP_ACCESO_INTERNO );
    }

[...]

}

ActionBeans 似乎编码正确,它们类似于其他从第一次重定向到正确的操作 bean。我已经搜索过,我已经调试过,但我找不到答案。我认为这个问题可能来自一些配置文件,比如这个 web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                               http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <display-name>${project.build.finalName}</display-name>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>es.sanitas.medicos.stripes.listeners.StartupListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:es/sanitas/medicos/applicationContext-profesionales.xml</param-value>
    </context-param>
    <context-param>
        <param-name>oracle.adf.jsp.provider.5</param-name>
        <param-value>oracle.stellent.wcm.javaee.shared.jsp.IdcJspProvider</param-value>
    </context-param>
    <context-param>
        <description>Url del Servidor de Contenidos</description>
        <param-name>manageSite</param-name>
        <param-value>http://caliban01:8888/</param-value>
    </context-param>

    <filter>
        <display-name>Stripes Filter</display-name>
        <filter-name>StripesFilter</filter-name>
        <filter-class>net.sourceforge.stripes.controller.StripesFilter
        </filter-class>
        <init-param>
            <param-name>Extension.Packages</param-name>
            <param-value>
                es.sanitas.stripes.integrations.spring,
                net.sourceforge.stripes.integration.spring,
                es.sanitas.stripes.i18n
            </param-value>
        </init-param>
        <init-param>
            <param-name>ActionResolver.Packages</param-name>
            <param-value>
                es.sanitas.medicos.stripes.actionbeans,
                es.sanitas.medicos.blua.stripes.actionbeans,
                es.sanitas.stripes.actionbeans.captcha,
                es.sanitas.medicopersonalprofesionales.stripes
            </param-value>
        </init-param>
        <init-param>
            <param-name>ExceptionHandler.Class</param-name>
            <param-value>es.sanitas.medicos.stripes.handlers.MedicosExceptionHandler</param-value>
        </init-param>
        <init-param>
            <param-name>Interceptor.Classes</param-name>
            <param-value>
                es.sanitas.medicos.stripes.interceptors.IsLoggedInterceptor,
                es.sanitas.stripes.interceptors.AuditBaseInterceptor
            </param-value>
        </init-param>
        <init-param>
            <param-name>LocalePicker.Locales</param-name>
            <param-value>es_ES:UTF-8,ca_ES:UTF-8,en:UTF-8</param-value>
        </init-param>

           <init-param>
            <param-name>ResourceBundles.BaseNames</param-name>
            <param-value>
                es.sanitas.medicos.stripesErrors,
                es.sanitas.medicos.stripesMessages
            </param-value>
            </init-param>
    </filter>

    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <servlet-name>StripesDispatcher</servlet-name>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    <servlet>
        <servlet-name>StripesDispatcher</servlet-name>
        <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>/captcha/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>/medicos/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>/medicopersonalprofesionales/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>/startProfesionalesSanitarios.jspx</welcome-file>
    </welcome-file-list>

    <mime-mapping>
        <extension>js</extension>
        <mime-type>application/x-javascript</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>css</extension>
        <mime-type>text/css</mime-type>
    </mime-mapping>

    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <scripting-invalid>true</scripting-invalid>
        </jsp-property-group>
        <jsp-property-group>
            <url-pattern>*.jspf</url-pattern>
            <scripting-invalid>true</scripting-invalid>
        </jsp-property-group>
        <jsp-property-group>
            <url-pattern>*.jspx</url-pattern>
            <scripting-invalid>false</scripting-invalid>
            <is-xml>true</is-xml>
        </jsp-property-group>
        <jsp-property-group>
            <url-pattern>*.tagx</url-pattern>
            <scripting-invalid>true</scripting-invalid>
        </jsp-property-group>
    </jsp-config>

    <error-page>
        <error-code>500</error-code>
        <location>/medicos/error</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/medicos/inicio</location>
    </error-page>

</web-app>

我一直在寻找解决方案,但我找不到任何解决方案

如果我的写作不完全正确,我想道歉,因为我的母语不是英语。

4

1 回答 1

0

好的,所以第二个 ActionBean 只重定向到第一个。我假设 jsp 文件中没有重定向。ActionBeans 中也没有重定向。嗯......但是有一些拦截器类在工作(web.xml)可能负责基于一些变量初始化的重定向?您可以尝试禁用它们,看看会发生什么。[删除了一些不再相关的评论]

你是对的“acdhirr”我终于发现问题是你最后的回应。在 web.xml 中,我评论了两个拦截器类:

<!-- <init-param>
    <param-name>Interceptor.Classes</param-name>
    <param-value>
        es.sanitas.medicos.stripes.interceptors.IsLoggedInterceptor,
        es.sanitas.stripes.interceptors.AuditBaseInterceptor
    </param-value>
</init-param> -->

现在,我必须与团队架构师一起调查,以找出替代类是否真的需要或保持评论。

曾经,非常感谢大家的支持和帮助。

于 2016-06-14T14:52:42.413 回答