条带注释@UrlBinding无法正常工作。 302状态代码

时间:2016-06-13 13:00:30

标签: java spring http-status-code-302 stripes urlbinding

我遇到了条纹动作bean的麻烦。

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

我第二次在浏览器上引入http://localhost:9080/profesionales-sanitarios-war/medicos/publico/accesoInterno,它返回一个200状态代码并且可以正常运行到AccesoInternoActionBean。

它同时发生在本地主机和服务器上(开发,预生产和生产)。

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>

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

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

1 个答案:

答案 0 :(得分:0)

  

好的,所以第二个ActionBean只重定向到第一个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> -->

现在,我必须与团队建筑师一起调查,如果他们真的需要,或者让他们评论,可以找到替代课程。

一次,非常感谢您的支持和帮助。