how to print an error message when no application context is active?
I cannot retrieve the application context when my file importer is launched through the drag and drop … and thus cannot print my message through FacesMessages.
What is the way to give some feedback to the user, then?
The importer itself is launched via an Automation chain, triggered during the drag'n'drop:
<extension point="chains" target="org.nuxeo.ecm.core.operation.OperationServiceComponent"> <chain id="FileManager.ImportWithMetaData"> <operation id="FileManager.Import"> <param name="overwite" type="boolean">true</param> </operation> <operation id="Document.Update"> <param name="properties" type="properties">expr:Context.get("docMetaData")</param> </operation> </chain> </extension>
I guess the best thing to do would be to override this chain, to append a call to a “Seam.AddInfoMessage” or “Seam.AddMessage” operation. If your message is complex (= template based) I think you'll have to create your own operation based on one of these, from which you can have full access to the Seam context.