You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (Jira)" <ji...@apache.org> on 2024/10/14 06:10:00 UTC

[jira] [Commented] (FELIX-6731) Forwarding requests with RequestDispatcher in plugins is broken

    [ https://issues.apache.org/jira/browse/FELIX-6731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17889089#comment-17889089 ] 

Carsten Ziegeler commented on FELIX-6731:
-----------------------------------------

This is a regression due to the switch to the OSGi Http Whiteboard (from HttpService). With this the request dispatcher resolves relative to the Http Context of the webconsole (which is at /system/console) and not the root.
Replacing "request.getRequesURI()" in the above with "request.getPathInfo()" resolves the problem.

A potential solution is to overwrite getRequestURI() in the webconsole in the wrapper https://github.com/apache/felix-dev/blob/master/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java#L414 (same for 4.9.x) however, this might break other plugins

> Forwarding requests with RequestDispatcher in plugins is broken
> ---------------------------------------------------------------
>
>                 Key: FELIX-6731
>                 URL: https://issues.apache.org/jira/browse/FELIX-6731
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>    Affects Versions: webconsole-4.9.0
>            Reporter: Oliver Lietz
>            Priority: Major
>
> Forwarding requests results in {{404 Not Found}}.
> {noformat}
> GetHttpServletRequestWrapper wrapper = new GetHttpServletRequestWrapper(request);
> request.getRequestDispatcher(request.getRequestURI()).forward(wrapper, response);
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)