X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2FAbstractCmsEntryPoint.java;h=cd7eae42346104197264428562d6768bf26da6a1;hb=3dd2fac453c0268721370c009d4b1515a9b02cd8;hp=1c9fc483d5bac03f52209d6d5de251e7328d89ba;hpb=04dade003a08c5915280ae653639b0af7cddeb0c;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/AbstractCmsEntryPoint.java b/org.argeo.cms/src/org/argeo/cms/AbstractCmsEntryPoint.java index 1c9fc483d..cd7eae423 100644 --- a/org.argeo.cms/src/org/argeo/cms/AbstractCmsEntryPoint.java +++ b/org.argeo.cms/src/org/argeo/cms/AbstractCmsEntryPoint.java @@ -1,7 +1,5 @@ package org.argeo.cms; -import static org.argeo.cms.internal.kernel.KernelConstants.SPRING_SECURITY_CONTEXT_KEY; - import java.util.Locale; import java.util.ResourceBundle; @@ -10,10 +8,10 @@ import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.nodetype.NodeType; -import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.argeo.cms.i18n.Msg; import org.argeo.jcr.JcrUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.application.AbstractEntryPoint; @@ -22,7 +20,6 @@ import org.eclipse.rap.rwt.client.service.BrowserNavigationEvent; import org.eclipse.rap.rwt.client.service.BrowserNavigationListener; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; /** Manages history and navigation */ @@ -37,22 +34,23 @@ abstract class AbstractCmsEntryPoint extends AbstractEntryPoint implements // current state private Node node; private String state; - // private String page; + private String page; private Throwable exception; private BrowserNavigation history; public AbstractCmsEntryPoint(Repository repository, String workspace) { - if (SecurityContextHolder.getContext().getAuthentication() == null) { - HttpSession httpSession = RWT.getRequest().getSession(); - // log.debug("Session: " + httpSession.getId()); - SecurityContext contextFromSessionObject = (SecurityContext) httpSession - .getAttribute(SPRING_SECURITY_CONTEXT_KEY); - if (contextFromSessionObject != null) - SecurityContextHolder.setContext(contextFromSessionObject); - else - logAsAnonymous(); - } + // if (SecurityContextHolder.getContext().getAuthentication() == null) { + // HttpSession httpSession = RWT.getRequest().getSession(); + // // log.debug("Session: " + httpSession.getId()); + // SecurityContext contextFromSessionObject = (SecurityContext) + // httpSession + // .getAttribute(SPRING_SECURITY_CONTEXT_KEY); + // if (contextFromSessionObject != null) + // SecurityContextHolder.setContext(contextFromSessionObject); + // else + // logAsAnonymous(); + // } this.repository = repository; this.workspace = workspace; @@ -166,7 +164,7 @@ abstract class AbstractCmsEntryPoint extends AbstractEntryPoint implements String previousState = this.state; node = null; - // page = null; + page = null; this.state = newState; try { @@ -176,7 +174,7 @@ abstract class AbstractCmsEntryPoint extends AbstractEntryPoint implements node = addNode(session, state, null); else node = session.getNode(state); - // page = ""; + page = ""; } else if (firstSlash > 0) { String prefix = state.substring(0, firstSlash); String path = state.substring(firstSlash); @@ -209,19 +207,15 @@ abstract class AbstractCmsEntryPoint extends AbstractEntryPoint implements throw new CmsException("Data " + path + " does not exist"); } - throw new CmsException("Unsupported state prefix '" + prefix - + "'"); - // page = prefix; + page = prefix; } else { node = getDefaultNode(session); - // if (state.equals("~")) - // page = ""; - // else - // page = state; + page = state; } if (log.isTraceEnabled()) - log.trace("node=" + node + ", state=" + state); + log.trace("node=" + node + ", state=" + state + " (page=" + + page); } catch (RepositoryException e) { throw new CmsException("Cannot retrieve node", e); @@ -244,7 +238,7 @@ abstract class AbstractCmsEntryPoint extends AbstractEntryPoint implements return state; } - // protected String getPage() { + // String getPage() { // return page; // }