Hello all,
I have been struggling while trying to integrate JForum with existing webapp.
I have tested some scenarios(which I'll describe), done a lot of google searches without success. I'll describe what I would like as final result, as well as what I have been doing in order to reach the goal.
The inmediate solution to my problem is the one that I will take as last solution, which is a
link with target attribute to open in a new window.
I'm using jdk1.5, tomcat 5.5.17(previously used resin 2.1.16, but I needed
Servlet 2.4/JSP 2.0 compliant container,
struts 1.2.9, tiles, ...). I also integrated JForum with my app in a sense that I can:
http://localhost:8080/myapp/forums/list.page
and it works(without displaying my app layout, just as a new JForum installation)
My app layout is:
header
n a v b a r
left
content right
menu menu
footer
My goal is to display JForum content in
content without Portlets.
My thoughs were:
1) Intercept all .page call. (implemet filter or extending from net.jforum.util.legacy.clickstream.ClickstreamFilter)
Inside Filter code and before calling chain.doFilter(...) or super.doFilter(...):
2) Store requested uri(eg. /forums/list.page) in request scope. Forward to (or Include) a .do struts action. Why? Because the app custom struts request processor makes db processing that will store dynamic data in request scope to be displayed in header, navbar, .....
3) At this point doFilter method hasn't been called yet.
struts processing takes place and all .jsp forwarding is OK. The forward is explicitely set to a .jsp page instead of a struts tiles definition entry.
.jsp page is itself a tiles definition similar to that one used by struts but
content definition is always an include to "/WEB-INF/pages...../wrapper.jsp"
4) wrapper.jsp is a simple page that only includes the following code:
This approach was raising some page not found errors when using resin 2.1.16(Servlet 2.3/JSP 1.2 compliant) because filters cannot be applied to forwarded or included pages already called from inside a filter. But, good news, Servlet 2.4/JSP 2.0 specification does that and that is why I ported my app to tomcat 5.5.17.
So after 4) is executed the same filter is executed again, but with new param "wrapped" setted to 1. This is used to avoid a calling same flow.
5) Inside same Filter:
if wrapped parameter == "1"
chain.doFilter(request, response);
Does never work, I'm able to see as result:
my app layout and
Starts here
Ends here
in
content but no JForum result is displayed. I'm suspecting that Servlet controller for .page
pattern is never called.
I also tried step 5)
5) if wrapped parameter == "1"
rd=req.getRequestDispatcher("/forums/list.page?wrapped=dummy");
rd.include(req, res);
This makes another call to same Filter but with wrapped param setted to another value and then in 6)
6)if wrapped parameter == "dummy"
chain.doFilter(request, response);
All sections inside the Filter are being called since I traced them with System.err.println statements.
Any help in this direction will be greatful apreciated.
Last Filter implementation"
Part of web.xml declaration:
If you need any other piece of code, please let me know.
Thanks in advance,
Orlando
[originally posted on jforum.net by orly]