- public static CmsSession cmsSessionFromHttpSession(BundleContext bc, String httpSessionId) {
- Authorization authorization = null;
- Collection<ServiceReference<CmsSession>> sr;
- try {
- sr = bc.getServiceReferences(CmsSession.class,
- "(" + CmsSession.SESSION_LOCAL_ID + "=" + httpSessionId + ")");
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException("Cannot get CMS session for id " + httpSessionId, e);
- }
- CmsSession cmsSession;
- if (sr.size() == 1) {
- cmsSession = bc.getService(sr.iterator().next());
-// locale = cmsSession.getLocale();
- authorization = cmsSession.getAuthorization();
- if (authorization.getName() == null)
- return null;// anonymous is not sufficient
- } else if (sr.size() == 0)
- return null;
- else
- throw new IllegalStateException(sr.size() + ">1 web sessions detected for http session " + httpSessionId);
- return cmsSession;
- }
+// public static CmsSessionImpl cmsSessionFromHttpSession(BundleContext bc, String httpSessionId) {
+// Authorization authorization = null;
+// Collection<ServiceReference<CmsSession>> sr;
+// try {
+// sr = bc.getServiceReferences(CmsSession.class,
+// "(" + CmsSession.SESSION_LOCAL_ID + "=" + httpSessionId + ")");
+// } catch (InvalidSyntaxException e) {
+// throw new IllegalArgumentException("Cannot get CMS session for id " + httpSessionId, e);
+// }
+// CmsSessionImpl cmsSession;
+// if (sr.size() == 1) {
+// cmsSession = (CmsSessionImpl) bc.getService(sr.iterator().next());
+//// locale = cmsSession.getLocale();
+// authorization = cmsSession.getAuthorization();
+// if (authorization.getName() == null)
+// return null;// anonymous is not sufficient
+// } else if (sr.size() == 0)
+// return null;
+// else
+// throw new IllegalStateException(sr.size() + ">1 web sessions detected for http session " + httpSessionId);
+// return cmsSession;
+// }