• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Integration with existing webapp

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great advances today, almost done, I'll post the code as soon as it is done.
I just need to retrieves:
http://localhost:8080/myapp/forums/list.page
as
http://localhost:8080/myapp/jforum.page?module=forums&action=list

Does JForum has a function or API to accomplish the above?
At least params in URL.

Thanks in advance,
Orlando
[originally posted on jforum.net by orly]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would require some good refactoring, in order to support that as a configurable option.

Let us know about your progress. If you *really* need the regular url format to work, we can think in some solution.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to show the search results in a portlet. Can you please guide me in this regard
[originally posted on jforum.net by nadeem]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of help you need?

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use the search method(). Because the way i look at it , it requires lot of jforum startup items like, database,configurations to be started before the search can take place. Is it so ?.

regards
nadeem
[originally posted on jforum.net by nadeem]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All you have to do is to to create an instance of SearchData, fill it with the desired data, and call the appropriate method of GenericSearchDAO.

Before running the code, setup the environment like this:



Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all of you!
I tried to find something that is fit well to my problem but I didn't find. This topic is almost what I need but I haven't any solution here.
So, what orly said is realizable but I don't understand if it's working or not. Additionally, this approach is not very nice because for each request you have to do 3 redirects which cost performance when this criteria is critical.
In my case I'm using JSF with some templateing system.
I have a layout like this:
.headrer.
.left_menu. .main_area.
.footer.
.header, .left_menu. and .footer. are templates generated with JSF and in the main area I want to inject JForum.
I thing that the most suitable approach is to generate a response for JForum servlet and after that to put it in my templates (how orly creates).
The question is if this approach works and, if yes, why we need 2 redirects to receive the write page and it is not enough only one.
[originally posted on jforum.net by istef]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hhm.. integrating different apps is always a problem, specially in this kind of situation. The easiest approach would be to put JForum inside an iframe.. don't know if it is acceptable for you.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a solution for this problem. Maybe someone will be interested about this or maybe you, Rafael will interest you because I modify a little bit the source code.
1. I put clickstream-jforum filter to point to .jpage (in web.xml).
2. I create a new filter that points to .jpage.
Filter method is


3. forum.jsp is something like this

forumBean is a small JSF bean that takes from request attribute "request.url" the link to the forum and puts in jsp. This may be done also through a scriptlet into JSP. After that this jsp will be rendered with the forum page inside it.

4. Modify in SystemGlobal.proerties servelet.extension = .jpage

5. Small tweak in JForum in ActionServletRequest. There you need the real suffix for servlet, with other words you need to put .page instead .jpage. In my site I created a new property in SystemGlobal.properties that take care only for that class.

That's my trick to put JForum into a template. I hope that will be usefull for others and I explained correctly.

@Rafael Maybe it will be usefull for the next version to make 2 properties in SystemGlobal.properties just for this case and to add some support for templateing stuff. Anyway thank you for this wonderful JForum.
[originally posted on jforum.net by istef]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example custom app-jforum integration:

www.discrete-it.net

Although I haven't had time to implement SSO and some other details.
Custom app uses Struts

idea is to redirect .page calls to custom .do action that will execute my own request processor (and db calls to update header, left menu,...) then in content code for this custom .do action, it will include same .page request and this time .page request won't be intercepted by filter (the one that forward to custom .do action)

Hope this help,
Orlando
[originally posted on jforum.net by orly]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to integrate JForum with my existing web app and couldn't get the JForum page(s) to display. I'm using struts tiles. Any help will be appreciated.

tiles-defs.xml entry

<!-- classic-layout -->
<definition name="doc.classic.layout" path="/layouts/classic-layout.jsp">
<put name="title" value=".title" />
<put name="menu" value="/common/menu.jsp" />
<put name="contentarea" value="/common/body.jsp" />
<put name="footer" value="/common/footer.jsp" />
</definition>

<definition name="doc.forum.page" extends="doc.classic.layout">
<put name="title" value="Forum Discussions" />
<put name="contentarea" value="/forum/list.page" />
</definition>


struts-config.xml entry:

<action <br /> path="/forum" <br /> type="com.simpaq.common.action.ForumAction" <br /> name="defaultForm" <br /> scope="request" <br /> validate="false" <br /> input="doc.forum.page">
<forward name="success" path="doc.forum.page" redirect="false"/>
</action>

Thanks.

gtata
[originally posted on jforum.net by gtata]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic