Archive for the ‘WebEngine’ tag
Nuxeo is a pluggable platform and when we decided to expose a new document oriented API we had to think about its pluggability. We addressed it by making the content of a response pluggable, by making calls composable and allowing our users to add their own endpoints. Everything is done so that our users will be able to build their own API on top of Nuxeo’s.
A Bit of History
Nuxeo is from the beginning based on the JavaEE stack, and makes use of JSF and Seam for the UI which makes it a rather stateful platform even if we have meaningful URLs.
Thanks to Restlets we were able to provide some REST endpoints but they were mostly used to
Some time after, we introduced WebEngine which was a web framework based on JAX-RS and with which you could do some REST APIs. The way we used …
Hello everyone! Here’s an interesting question from Youri: Is it possible to call a Seam bean from JAX-RS/WebEngine?
As he says, Restlets have been integrated with Seam. But what about JAX-RS/WebEngine? And what would I add about Content Automation?
For Content Automation, it’s actually quite easy. When you write a new operation, you can use Seam’s Contexts object to lookup the components you need. Take a look at OperationHelper.getWebActions for instance:
This is quite simple, as it’s a direct lookup to Seam’s instantiated components Map, here in the Conversation context. You can also access components in another Context-like application, method, event, page or session. If the component you’re looking for hasn’t been instantiated, you’ll simply get null. To avoid this situation, you should use the following code:
It’s a little different. It will do a lookup on all contexts, and if it does not find any instance, will go …
As you may know, we’re in the process of a releasing Nuxeo 5.6. The first RC is available here: http://www.nuxeo.com/5.6/ . Feedbacks are welcome :-)
The good thing about the code freeze is that the different labels we have are very unlikely to change. Hence it’s the perfect time to start translating Nuxeo in another language or update existing translations.
So I started a small WebEngine project to ease the process. It has really basic features right now. You can select any languages available in nuxeo-platform-lang-ext. You get to see every keys, English labels and labels of the selected language in a table. Those columns have a text filter input to ease navigation through the 2000+ labels. There’s also a checkbox that display only empty labels for the selected languages. Fields you have modified are saved to the server automatically so that we can add them to the current …
Tiry and I started playing a bit with arbor.js. It’s a graph visualization library based on web workers and jQuery. Our goal is to be able to navigate in Nuxeo documents using their relations. I’m talking about any kind of relation. It could be a tag, the parent or the children of a document or classic RDF relations. As picture is better than a thousand words, here’s a screenshot:
So what I currently have is a simple WebEngine module handling enough REST URLs so that I can easily get JSON objects representing document relations, tags, parent and children. This means I have all I need to create links between nodes of my graph.
I think I’ll have to refactor this heavily :-) There’s some duplicated code between this module and the Seam beans handling relations and tags. Hopefully we won’t have that kind of issue after moving to CDI.…
Last week I wrote the first part of a two blog post series on how to add a Forgotten Password Functionality to Nuxeo. So make sure you read the first one and here comes the second part :-)
Reset the password
The link we send to the user (see first blog post) will be manage by the enterNewPassword method. The key is part of the URL so it’s easy to retrieve using JAX-RS annotations. Once I have the key, I use the SearchRegistrationByResetPassKeyUnrestricted runner to verify that it’s still a valid key. If it is, I can render the submitNewPassword template. If not, I render the wrongResetKey template.
The form submitted from submitNewPassword is handled by the submitNewPassword method of my WebEngine module. As we did previously for the email, the form validation is run on the server side. I’m just ensuring that the passwords are not empty and …
This question is sometimes asked on answers or in the forum. It’s a method to handle password reset for users. So I’m going to show you how I would do it. This is going to be a two part blog. Today I’ll write mostly about the WebEngine module handling the password reset functionality. Next week I’ll show you how to package it for Nuxeo’s Marketplace.
How does it work?
Starting with something simple, we’ll add a ‘forgotten password’ link on Nuxeo’s home page. It will redirect the user to an open (i.e. no authentication needed) page asking for an email address. Once the user submits the form, we’ll look in the user directory to see if the email has a corresponding user. If there’s no user, we’ll simply render the page again with an error message saying there’s no user associated with that email address. If we do find …
I’ve already written about WebEngine, and I’ve written about unit testing, but I haven’t written about WebEngine AND unit testing. Let’s fix this with a little example. If you don’t already know our testing framework I suggest that you read a previous post on how to test operations or our test framework documentation.
So this is a very simple WebEngine module that returns a String “Hello WebEngine.” And we want to make sure that when we hit the /hello/ url, we get that hello.
To make sure this happens, we can set up a unit test that deploys our WebEngine module in a Jetty test server. It’s really easy to do thanks to JUnit4 runners. We’ve written our own that starts Jetty and deploys the necessary Nuxeo bundles for your tests. As you can see in the code below all you need to do is select the right …
The real life example I had in mind last time was about writing and publishing job offers. Staying on the sharing/collaborating trend, we’re going to give the opportunity to users to not only read the job offer but to send feedback to the application. It’s a common need for such a thing. We could easily imagine an application form at the bottom of the page that would collect applications, enter them in Nuxeo with an adhoc document type including resume and cover letter, adhoc content lifecycle including all the required steps (filtering, review, notifications…) up to selections of candidates. But this is a whole HR application and I don’t want to lose you. We will just make a simple thing here for now. We will allow users to simply comment on job offers to illustrate the idea of collecting user-generated feedback, content or documents. Then I’ll show you how to …
The goal of today’s post is to show you one of the many ways you can expose a document stored in Nuxeo, and share it to the outside world without using Nuxeo’s Document Management user interface. I will take you step-by-step through a small project that makes a document available to an anonymous user, and displays it with a WebEngine Frontend. I’ll be using a Note document as an example, but it could be anything. Let’s use a job offer as our real-life example. Someone puts the offer together and then asks their manager to validate it. Once the manager validates it, the offer is published in a section. After it’s published, we make it available to anyone via an anonymous user, add a permalink, and a special front end for your offer, throw in some “Share on SomeSocialNetwork” buttons, and your content can be shared easily by anyone anywhere. …