How Can OSGI and JSF work together? - jsf

I'm new in OSGI and I'm having many problems to try to create WABs. I'm using BndTools with Eclipse to help me with OSGi. My problem now is how can I integrate JSF with OSGi. I want to make one main web server, and add bundles with jsf pages runtime. How can I do this? What are the needs?
Thanks in Advance!

JSF is quite complex due to it's classloading mechanism. If you use Pax-Web you are able to use JSF, though it requires some special handling. For more details get in contact with the OPS4j community.
Another hint, since you seem to try to build your own "web-container", I don't recommend that, try to use an existing one, makes life easier :)

Related

Implementing ICAL calendars jsf

Im trying to implement ical calendars using java1.8/jsf2.2 in a way that makes embedding them into outlook possible:
It be good if i could store generated calendars and update them automatically. I intend to pass the needed parameters in the url. Something like
http://example.com/ical/calendars.ics?id=12&includeAll=1
I found primefaces FileDownload but Im not sure that is what I need. Maybe some FileServlet? I stumbled upon omnifaces' FileServlet and figured since I have the omnifaces jar anyway I could try to use that. Or the old version of BalusC found here: http://balusc.omnifaces.org/2007/07/fileservlet.html
Would any of those approaches even work?
What Im thinking is storing generated calendars in a temp folder and update them dayly. Or, using a FileServlet, I could generate them on request. Im not sure how to go at it. Which of the suggested ways is the best? Or are all of them wrong?
Since OmniFaces contains the mentioned FileServlet only from Version 2 onwards, which requires CDI, I wont be able to use it because I used Spring for DI. Otherwise that would have been the solution...
Using the BalusC's FileServlet I proposed in my question, I'm able to generate stuff on request.

XPAGES AND ONEUI REFERENCE

I would like to know if you can import the interface used for XPages (oneui) inside the application without the need to have to referencing the server or extend it.
Thank you
Since 8.5.3 OneUI has been delivered via an OSGi plugin on the server. Most modern XPages applications are being built using bootstrap look and feel instead, which is again in the OSGi plugin for XPages Extension Library on OpenNTF. IBM have also moved away from OneUI for IBM Verse and for responsive XPages have adopted bootstrap. I'm not aware of anyone who has tried to pull those into an NSF, and I would not advise it. You may hit Java security exceptions with some of the code, mapping between resources may not work, and there are an immense number of Java classes and other resources. And if you do hit any issues, you are unlikely to find much help to solve them.

Is JSF2 usable in concert with the "Snaps" web UI framework based on Eclipse Virgo?

Snaps is a (rather new) web framework growing out of the Eclipse Virgo community that (will) allow dynamic, componentized web UIs by exploiting the OSGi infrastructure. Apparently it is the heir of "Slices", the previous attempt at this.
What I am wondering is whether there is any work ongoing in looking at how JSF (2) can be combined with such an approach? Is this at all possible? If so, is there any concrete work ongoing?
There is no work going on looking at JSF specifically or any other Web framework for that matter. Snaps aims to give you the dynamic runtime ability to compose your web app without restricting your choice of web framework in any way. It definitely doesn't aim to be another web framework.
I know some people have had JSF running on Virgo so I don't see any reason that you can't use it with snaps although I haven't tried it so I can't say for certain. If you do find a problem raise a bug on the Virgo project :)
Chris.
In case you're still interested:
At the Virgo formus I know there is some guy who does have it running with FancyFaces.
If you might have found another solution, would be glad to hear.
Grts

Wicket vs GWT - Advice needed

I am developing a Java EE based web application. We have a very limited time to come up with a alpha version and trying to decide on a web framework to use. It has to be something easy to learn but powerful. Standard JSP/Servlet is not an option here due to the time it takes for the development. Appreciate if anyone could advice. Current options are Wicket and GWT. (JSF is also an option)
Wicket is component-based and comes with a bunch of standard components (like pagination, auto-complete, data grids, form handling etc.). If you want to create a standard panel (with the possibility for easy re-use) just create your HTML fragment to use a template (with wicket:id attributes wherever you want to bind dynamic content or sub-components) and a corresponding Java file. Furthermore, you can attach specific CSS and JS files.
In my opinion, Wicket development is good value (functionality) for money. And you get a lot of built-in AJAX functionality without even writing (not reading) any JS. E.g., change the model for a component, attach the component to an AjaxRequestTarget and the panel is automagically repainted via DOM manipulation.
For a quick overview and intro I recommend Wicket in Action by Dashorst & Hillenius. (And don't miss out on other great resources.)
Everything depends on your application. I don't have experience with Wicket, not much with JSF. I have big experience with GWT.
GWT is good if your application has to be mostly dynamic. In GWT you can change everything on the page not even calling the server. GWT is compiled to Javascript. On the other hand, if you have big project, it is quite frustrating if your application in development starts few minutes, because it has a lot of code to compile to Javascript. My opinion: it is not good for big projects.
If you don't need to change your pages so much client-side, I would use JSF2 (or Wicket, if I knew it).
Have a look at this comparison of Wicket and GWT, this may help you decide for yourself:
Wicket and GWT compared with code

Are JSF/Seam/Spring suited for non-enterprise work? (website, not "web application")

I'm starting work on a new website (sort of an e-commerce product comparison thing) and I'm trying to choose what technologies to build it on. I've ruled out PHP and I don't think I want to use Python or Ruby. I really like Java and Hibernate so I started looking into Java-based web technologies.
My problem is that all of the documentation and examples I've read can't seem to stop repeating the words "enterprise" and "web applications." I'm afraid of ending up with giant XML configuration files and business-oriented components while losing the ability to actually design the website. From what I've read of JSF, I like the idea of reusable components, but I still want the ability to customize individual pages. So my question is, are JSF/Seam/Spring well-suited for non-enterprise development? If not, what Java technologies are?
I have just started looking into JSF/Seam so please forgive me if this is an uninformed quesiton. Thanks in advance. :)
No problem. The JSF/Seam stack gives you all the customization you want, and it has very few XML files. In fact, it uses a lot of annotations to define entities and components, so you don't have to worry about writing tou much XML (it is one of the reason why Seam was invented).
JSF's standard components are rendered as simple HTML tags, while if you want to go AJAX and use Richfaces it will be a little harder to customize it, but nothing dramatic. I can assure you that for the view part, you can write whatever you want in your webpages.
Here's a nice reference of how the JSF tags are rendered.
For the model and DB part, the JPA framework gives you the ability to work with simple Java Objects, and sometimes using it in an "enterprise" context with legacy schema is even more difficult, so don't worry.
For a simple website you may safely skip the EJB part, this will help you writing a more cleaner project structure. You can package all your website in a simple .WAR file.
As for the "enterprise" word, I think it is more related to the fact that the Java EE framework gives you the feature you may need in an enterprise context, (i.e. EJBs), but you can avoid them.
They don't bite.

Resources