0

We're developing several web apps that sit behind a single 'portal' app (all JEE 6). All apps are (currently) on the same glassfish server and use glassfish's SSO features, so the user logs in through the portal and can then use whichever apps they have permission to access.

I'm currently trying to figure out ways of encapsulating content that is the same or very similar across apps, and keep it in one place. Stuff like headers, footers, menus, dialogs, some common js/jquery tools, etc. Note that most of this is not static content (it needs to get some data from the server side). We use JSF 2.1 facelets with some primefaces and lots of custom components and so forth.

Ideally, I'd love for each sub-app to simply display various <ui:composition> xhtml files from the portal app using <ui:include>, or use a common template served by the portal app. This doesn't seem possible across domains, though. I could perhaps use <iframe>s, but this seems pretty clunky, especially when the content relies on ajax and/or javascript files, etc.

Sorry if this question is a bit broad, but does anyone have any suggestions? What tech should I be looking into in order to embed common content in multiple apps? Is this a common pattern or are we making a poor architectural choice by splitting things up like this? Should we just be writing one giant UberApp?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Daniel Loiterton
  • 5,073
  • 5
  • 33
  • 46
  • 1
    If I guess right, you're looking for this Q&A: http://stackoverflow.com/questions/3531432/packaging-facelets-pages-in-a-jar – BalusC Jan 20 '14 at 16:57
  • This does look promising indeed, @BalusC. I'll give it a play. Many thanks! – Daniel Loiterton Jan 20 '14 at 17:23
  • Okay, this is then a dupe :) – BalusC Jan 20 '14 at 17:31
  • You should also consider use JSF 2.2 Resource Library Contracts. Move from 2.1 to 2.2 is quite simple, and it is a lot more powerful. – lu4242 Jan 20 '14 at 19:11
  • hmmm... correct me if I'm wrong, but JSF 2.2 Resource Library Contracts seem to be more about having multiple look-and-feel options in a single project, rather than sharing content across multiple projects. – Daniel Loiterton Jan 21 '14 at 08:29
  • Yes, but you can use it for the purpose mentioned here. For example, you could split you shared content into multiple contracts. You can create a jar with a default contract, put everything there and when the application starts if the jar is in the classpath it will include the resources. – lu4242 Jan 21 '14 at 18:35

0 Answers0