This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JForum and the fly likes Integrating JForum into another application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Integrating JForum into another application" Watch "Integrating JForum into another application" New topic
Author

Integrating JForum into another application

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello

I'm about to start work on integrating JForum to another application. I'm content to let my application simply talk to JForum and automatically log users in and return them to my application when they log.

But, I do have one current issue; can the 'Forum Index' button / text on the top, left hand-side of each page be suppressed at all?

I want to do this because I want users to have access to only one forum at a time when they're logged on. and not to be able to create anything other than new threads in that forum.

Thanks

Martin O'Shea.
[originally posted on jforum.net by MartinOShea]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
All of the "look and feel" of jForum is defined via FreeMarker (www.freemarker.org) templates. These are located in the templates/default directory. With this setup, it's easy to modify what users see and don't see. Just change the appropriate template files.

FYI - best practice for modifying these is to copy the default directory to another directory under the templates directory, change your config file to use this directory, and modify the files in the new directory. This gives you the original untouched templates as a reference/fallback as well as making version updates a little easier (except that V3 will be changing template engines...).
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi Monroe,
Thanks for this cool application. Kudos to all brainees. We integrated Jforum with one application within a single ear. After logging into application, user will click the Jforum link and user shouldbe able to access Jforum. We are using Acegi to store user after authentiction. Acegi puts all user profile information in session.I found different approaches in documentation to achieve SSO. We have no cookies in our application. Which is the best approach to get SSO. If we use request.getRemoteUser() how will it pick up user info from session dynamically.

1)using cookies
2)using request .getRemoteUser
3)Implementing my own SSO class


Thanks
GregJhonson
[originally posted on jforum.net by gregjhonson]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Monroe

Many thanks for the answer; I think it will solve a few of the issues I have.

Kudos to all at JForum.

Thanks

Martin O'Shea.
[originally posted on jforum.net by MartinOShea]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hie Guys, Ey gregjhonson

Thats exactly what i wanna do too, i'm trying to integrate Jforum in to a Seam Web Application ear file the better, or just a web app ear file for a start

Please can give us the step by step explanation on how to integrate jforum into an ear file. I'm in Netbeans 6.1 with Seam and Facelets plugins

Thanks in advance


[originally posted on jforum.net by ngonidan2]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Got it,
This might also help others with the same question, so thanks to Monroe and GregJohnson and a few additions i found out. Sorry Images could not be attached,

Question

When would someone want to package 2 war files together

Answer

Your application might be made up of 2 completely separate web applications e.g. a website utilising a open source Forum package e.g. Jforum. In this case the 2 web applications are difficult to combine into one, see Bottom for Pros and cons
Java EE projects are either EAR or WAR deployments that use Java EE technology. If you have a WAR with JSPs and JDBC access of a relational database, that's a Java EE project. The original intent was that EAR files were "enterprise", and that meant EJBs. An EAR file an contain EJBs, WARs, JARs, the whole enchilada.
Thinking in terms of services are a little different. I think deployment deserves careful consideration, because components that are packaged together must be brought down and up together if any maintenance has to be done.
So think carefully about how you package your services. It's not an all or none blanket answer, IMO. You should look at what your services are doing and how they might be used together to decide how they should be packaged and deployed.
Also I think what you decide to put in each EAR is governed by organizational and technical issues.
I think most important technical role of an EAR is a classloader root in a runtime environment. This normally means you can deploy different versions of libraries and your own classes in different EAR's. This means you should keep your container root classpath fairly empty (or as supplied by the container vendor), because it may allow one phsyical container to service multiple applications using possibly conflicting libraries. This is great news if you're developing a number of different applications using a common code-base. You can have a number of projects deploying to the same farm of servers without messing up for eachother.
You will normally never deploy a smaller unit of software than the EAR. Each EAR can be more or less fully self-contained. I would normally let the content of these refelect what the owning organization thinks of as applications or subsystems. You can usually package the same components in multiple EAR's.



Single war or Two separate wars - which is the best solution for Integrating Jforum

Single War file i.e. Same context with 2 apps:

Pros

Everything is in the same class loader so stuff like session variables, jforum repository cache objects, and the like are available to both apps. This can make tight integration much easier.
you should be just be able to get everything you need directly from the session.

i.e. in authenticateUser method, just do something like:

SessionContext sctx =ctx.getSessionContext();
User u = (User)sctx.getAttribute("USER"); // or what ever acegi uses for here at login
if (u != null){
// user is loged in with valid session.
// note: if u still want the email to persist..I think u still need to place this into cookie.
// else u need to hack the jforum code to get in the right place.
return user.userName();
}
else
{
// not logged, return null;
}


Cons

Dependency conflicts, harder to upgrade to a new version because everything needs to be checked again.

Potential security issues (low probablity... but).. You've got "other peoples" code running with your code.

Scalablity... - You have to set up a completely different jforum instance for each application instance.. may not be an issue except if you need to support many clients or communities.

Separate contexts (2 wars)

Pros:

Better security

Easier to update jForum to new versions

No dependencies problems

Cons:

More complex to integrate apps, e.g. SSO and the like.

i.e. If you decide to keep the JForum logic its own war, your only option is to use a cookie, or JAAS...The advantage of the cookie solution is, it will work cross Servers, in case we need load balancing



Look and feel / Navigational issues. E.g., do you modify jForum to look like your main app or use iframes to provide the "wrapping".


How to package 2 war files in one ear File Using Netbeans

Simple just create an Enterprise Application in Netbeans and call it e.g. testenterpriseapp




You get 3 projects in the Projects Window, a war, EJB and the Ear project as below



So how do we add the other war project ??? Simple, just create a New web application along the way, the wizard will give the Server Setting Dialogue Box


Choose Add to Enterprise application and choose the Ear file e.g testenterpriseapp in the case, and simply run/Build!!!


[originally posted on jforum.net by ngonidan2]
 
jQuery in Action, 2nd edition
 
subject: Integrating JForum into another application
 
Similar Threads
Help with integrating JForum
how do you check if the user is logged in or not
Configure SSO and categories
Creating new users dynamically
Complex integration question - multiple jforums -> caching problem?