重定向到另一个发送参数的Web项目

时间:2017-01-25 19:15:10

标签: jsf cas

我使用以下代码重定向到同一工作区中的另一个项目:

String urlVolver = "https://localhost:8443/wap/project2/registro/registrarProyect2.page?idRegistro=1648&control=gestionarGestionarRegistro";
FacesContext context = FacesContext.getCurrentInstance();
context.getExternalContext().redirect(urlVolver);

当我重定向到另一个项目并且我没有发送参数时,它可以工作,但是当我尝试将参数发送到该视图的控制器时,我得到以下异常

处理请求时出错

Context Path:
/wap/project2

Servlet Path:
/registro/registrarProyect2.page

Path Info:
null

Query String:
idRegistro=1648&control=gestionarGestionarRegistro

Stack Trace
java.lang.UnsupportedOperationException
java.util.AbstractList.add(AbstractList.java:148)
java.util.AbstractList.add(AbstractList.java:108)
org.jasig.cas.client.util.URIBuilder.addParameter(URIBuilder.java:402)
org.jasig.cas.client.util.CommonUtils.constructServiceUrl(CommonUtils.java:310)
org.jasig.cas.client.util.AbstractCasFilter.constructServiceUrl(AbstractCasFilter.java:104)
org.jasig.cas.client.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:159)
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:97)
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:248)
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:77)
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:167)
io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:761)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:0)

我们发现一个解决方案,我认为不是最值得推荐的解决方案,但它有效,CAS配置无法修改,因为多个应用程序正在使用它,而且这种配置不依赖于我们的团队。

我忘了提及的另一个行为是,当我首先加载页面https://localhost:8443/wap/project2/registro/registrarProyect2.page并且在使用参数进行重定向之后,页面没有加载的问题。

因此,我们在隐藏了导航案例的iframe中加载页面。

 <div id="map" style="display:block; visibility:hidden"> 
    <iframe src="/registro/registrarProyect2">
    </iframe>
</div>

加载此iframe后,我们可以重定向到带参数的页面。