Re: Struts ServletDispatcherResult Forwarding GET Instead of FORWARD

Rubens Gomes <[email protected]>
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <CAE9PpthB3n+poz5JT7mwYjVfX8SYt=BMVLW_wWzEL7oRZxq+KA@mail.gmail.com>
I noticed the following issue while debugging:

StrutsRequestWrapper  is missing request attribute
"jakarta.servlet.forward.request_uri"

Then, tomcat "org.apache.catalina.core.ApplicationDispatcher"
doForward method fails to find that attribute in the following line:

if (hrequest.getAttribute(FORWARD_REQUEST_URI) == null) {
     // then tomcat defaults to setting value of various request attributes
}

And after that, tomcat calls "processRequest(request, response,
state);" in the same instance "ApplicationDispatcher" and fails to
resolve a FORWARD dispatcher type below.  Instead, it resolves a
REQUEST.  And when tomcat sees REQUEST dispatcher type it does a GET
on the JSP, instead of FORWARD.

Question:  Should StrutsRequestWrapper add the
""jakarta.servlet.forward.request_uri"" attribute?

FYI, I found the below very old thread in apache mail archive which
was posted to [email protected] in 2003 which appears to be a
related issue:
[PATCH] RequestDispatcher.forward() problem with wrapped requests

https://lists.apache.org/thread/b3s6gwp1305wh485crkfozz9j9llvj21


On Tue, Jul 23, 2024 at 12:22 PM Rubens Gomes <[email protected]> wrote:
>
> As per Spring Boot "3.3.2" managed dependency coordinates the embedded
> tomcat version is "10.1.26"
>
> On Mon, Jul 22, 2024 at 11:27 AM Łukasz Lenart <[email protected]> wrote:
> >
> > Tomcat? version? It can be related to Tomcat changes
> >
> > pon., 22 lip 2024 o 17:25 Rubens Gomes <[email protected]> napisał(a):
> > >
> > > I am running Struts 7.0.0-M9 along with Spring Boot 3.3.2 + Spring Security.
> > >
> > >  have a Struts Action class annotated with :
> > >
> > > @Result(
> > >     name = Action.INPUT,
> > >     location = "/WEB-INF/content/%{#request.device}/login.jsp",
> > >     type = "dispatcher")
> > >
> > >
> > > And I have noticed that after returning from the Action class
> > > (ViewLoginAction.java) the framework is invoking the above JSP using a
> > > DispatcherType.GET instead of DisplatcherType.FORWARD.
> > >
> > > Is there anything wrong with Struts 7.0.0-M9?
> > >
> > > Here is a portion of logs:
> > >
> > > 2024-07-22T09:42:03.160-05:00 TRACE 17749 --- [EZLista]
> > > [0.1-8809-exec-3] c.e.web.struts2.action.ViewLoginAction   : exiting
> > > execute method
> > > 2024-07-22T09:42:03.162-05:00 DEBUG 17749 --- [EZLista]
> > > [0.1-8809-exec-3] com.opensymphony.xwork2.ObjectFactory    : Injecting
> > > internal beans into [ServletDispatcherResult]
> > > 2024-07-22T09:42:03.181-05:00 DEBUG 17749 --- [EZLista]
> > > [0.1-8809-exec-3] o.apache.struts2.url.StrutsUrlDecoder    : Using
> > > default encoding: UTF-8
> > > 2024-07-22T09:42:03.182-05:00 DEBUG 17749 --- [EZLista]
> > > [0.1-8809-exec-3] o.a.s.result.ServletDispatcherResult     :
> > > Forwarding to location: /WEB-INF/content/desktop/login.jsp
> > > 2024-07-22T09:42:03.184-05:00 DEBUG 17749 --- [EZLista]
> > > [0.1-8809-exec-3] c.o.x.c.impl.InstantiatingNullHandler    : Entering
> > > nullPropertyValue
> > > [target=[com.ezlista.web.struts2.action.ViewLoginAction@217b4d13,
> > > com.opensymphony.xwork2.DefaultTextProvider@9dff4e1], property=struts]
> > > 2024-07-22T09:42:03.186-05:00 TRACE 17749 --- [EZLista]
> > > [0.1-8809-exec-3] o.s.security.web.FilterChainProxy        : Trying to
> > > match request against DefaultSecurityFilterChain [RequestMatcher=any
> > > request, Filters=[org.springframework.security.web.session.DisableEncodeUrlFilter@68b7a5ee,
> > > org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@469df52b,
> > > org.springframework.security.web.context.SecurityContextHolderFilter@2ef6b51,
> > > org.springframework.security.web.header.HeaderWriterFilter@64619b93,
> > > org.springframework.web.filter.CorsFilter@e9cdad7,
> > > org.springframework.security.web.csrf.CsrfFilter@66b5be95,
> > > org.springframework.security.web.authentication.logout.LogoutFilter@693b32a4,
> > > org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@2cf87853,
> > > org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3664a61e,
> > > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7e8a3d1f,
> > > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@3e2af682,
> > > org.springframework.security.web.authentication.AnonymousAuthenticationFilter@32e489c4,
> > > org.springframework.security.web.session.SessionManagementFilter@16aade61,
> > > org.springframework.security.web.access.ExceptionTranslationFilter@6ab8c3c6,
> > > org.springframework.security.web.access.intercept.AuthorizationFilter@4c030249]]
> > > (1/1)
> > > 2024-07-22T09:42:03.186-05:00 DEBUG 17749 --- [EZLista]
> > > [0.1-8809-exec-3] o.s.security.web.FilterChainProxy        : Securing
> > > GET /WEB-INF/content/desktop/login.jsp
> > > 2024-07-22T09:42:03.186-05:00 TRACE 17749 --- [EZLista]
> > > [0.1-8809-exec-3] o.s.security.web.FilterChainProxy        : Invoking
> > > DisableEncodeUrlFilter (1/15)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.