Hello Sridhar,
To tell you the truth I haven't had enough time to finish what I started (non-current job related), I got some work done and I think it is the right approach if JForum app is wanted to be integrated with your App without using Portlets (integration here refers to included JForum output in custom application layout). Here are some of my thoughs about how to reach the goal and I'm more than satisfied to provide source code to any who want to finish it.
The approach I followed is described as:
Requirements:
Servlet 2.4/JSP 2.0 because Filters behavior in this version is by far better than
JSP 1.2 version.
JDK 1.5
The idea behind this filter is to wrap html output from JForum by intercepting all JForum calls through Struts controller.
Sample case:
.../jforum/list.page is called (or something similar)
the filter try to read request-scoped attribute "wrapped", if it is null then call a struts action that will call a tiles .jsp page( not a .xml definition file, but a .jsp file) and response will be wrapped an an instance of HttpResponseWrapper subclass.
The struts action is required( I required) because my custom processor queries DB and store results in request scope, these results (lists, values) are used to present dynamic info in layout (header, left menu, etc..)
If request does not comes through Struts controller, your layout won't display dynamic info as your app does.
This wrapper.jsp will then include list.page(or other page) and set request attribute wrapped to "1". This nested Filter execution is not possible with JSP 1.2 specification, that is why Servlet 2.4/JSP 2.0 is required.
At this point same filter will get executed but since "wrapped" request attribute was set to 1, there won't be a recursive call to same struts action, but instead to list.page controller (using HttpResponseWrapper subclass).
When *.page html output is generated and control got back to Filter, output is processed to be included in .jsp.
It sounds confusing but I have made it in www.discrete-it.net but unfortunately I was trying to upgrade my box from FreeBSD ports and Postgres had some problems, and I dont have DB now, so it won't show up. I'll let you know as soon as I get it online again.
On the other hand not all JForum output need to be wrapped, you probably don't want smiles or dialogs wrapped in your layout, so I also include a ByPass structure to avoid calling struts action to include them in layout.
Here is a list of necessary files:
web.xml - filter declaration and mapping
Coupling.java - Filter
DuplaVO - Value Object used by Coupling.java which is initiated with some JForum paths. Those paths will be avoided when wrapping it inside your custom app layout. Smiles dialog, etc.
RequestWrapper.java - Wraps custom output.
struts-config.xml - declaration of action that will get called from filter.
tiles.jsp - tiles definition called from struts-config.xml declaration. (through ForwardInclude struts action)
IncludeAction.java - Custom IncludeAction struts subclass.
wrapper.jsp - called from tiles.jsp. This file will set wrapper parameter to avoid infinite Filter (Coupling.java) recursion and will include output from accesed list.page (or other JForum page)
Good luck and let me know if I can be of more help.
P.S. Feel free to rename package names and please FEEL FREE to help us and post your progress with it.
Thanks,
Orlando
web.xml declaration
Coupling.java
You can removed file upload-related commented code & package import.
package com.orly_otero.filters.jforum;
DuplaVO.java
ResponseWrapper.java
struts-config.xml declaration
IncludeAction.java
tiles.jsp YOUR LAYOUT
wrapper.jsp USED always as input to tiles.jsp in my particular case.
This should work, please let me know if something is missing.
[originally posted on jforum.net by orly]