]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - rap/org.argeo.cms.ui.rap/src/org/argeo/cms/web/CmsWebEntryPoint.java
Refactor deploy properties and move legacy CMS exception.
[lgpl/argeo-commons.git] / rap / org.argeo.cms.ui.rap / src / org / argeo / cms / web / CmsWebEntryPoint.java
index 2eb783527f790b8cac6802e58ccb1ac94f8c4db2..1597197207377c27342229c13f4c01ee8a852119 100644 (file)
@@ -14,12 +14,12 @@ import javax.security.auth.login.LoginException;
 
 import org.argeo.api.cms.CmsApp;
 import org.argeo.api.cms.CmsAuth;
-import org.argeo.api.cms.CmsImageManager;
 import org.argeo.api.cms.CmsLog;
 import org.argeo.api.cms.CmsSession;
-import org.argeo.api.cms.CmsUi;
-import org.argeo.api.cms.CmsView;
-import org.argeo.api.cms.UxContext;
+import org.argeo.api.cms.ux.CmsImageManager;
+import org.argeo.api.cms.ux.CmsUi;
+import org.argeo.api.cms.ux.CmsView;
+import org.argeo.api.cms.ux.UxContext;
 import org.argeo.cms.LocaleUtils;
 import org.argeo.cms.auth.CurrentUser;
 import org.argeo.cms.auth.RemoteAuthCallbackHandler;
@@ -269,6 +269,8 @@ public class CmsWebEntryPoint implements EntryPoint, CmsView, BrowserNavigationL
        @Override
        public CmsSession getCmsSession() {
                CmsSession cmsSession = cmsWebApp.getCmsApp().getCmsContext().getCmsSession(getSubject());
+               if (cmsSession == null)
+                       throw new IllegalStateException("No CMS session available for " + getSubject());
                return cmsSession;
        }
 
@@ -311,9 +313,15 @@ public class CmsWebEntryPoint implements EntryPoint, CmsView, BrowserNavigationL
                if (getApplicationContext().getLifeCycleFactory().getLifeCycle() instanceof RWTLifeCycle) {
                        eventLoop: while (!shell.isDisposed()) {
                                try {
-                                       if (!display.readAndDispatch()) {
-                                               display.sleep();
-                                       }
+                                       Subject.doAs(loginContext.getSubject(), new PrivilegedAction<Void>() {
+                                               @Override
+                                               public Void run() {
+                                                       if (!display.readAndDispatch()) {
+                                                               display.sleep();
+                                                       }
+                                                       return null;
+                                               }
+                                       });
                                } catch (Throwable e) {
                                        if (e instanceof SWTError) {
                                                SWTError swtError = (SWTError) e;