[embjopr-commits] EMBJOPR SVN: r583 - trunk/core/src/main/java/org/jboss/on/embedded/ui.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Fri Jul 24 12:05:55 EDT 2009


Author: ips
Date: 2009-07-24 12:05:54 -0400 (Fri, 24 Jul 2009)
New Revision: 583

Added:
   trunk/core/src/main/java/org/jboss/on/embedded/ui/SessionInfoAction.java
Removed:
   trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java
Log:
store the baseUrl Seam variable in SESSION, rather than APPLICATION, scope (fix for https://jira.jboss.org/jira/browse/EMBJOPR-218); rename ApplicationInfoAction to SessionInfoAction to reflect its new scope



Deleted: trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java	2009-07-24 01:29:30 UTC (rev 582)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java	2009-07-24 16:05:54 UTC (rev 583)
@@ -1,54 +0,0 @@
-/*
- * Embedded Jopr Project
- * Copyright (C) 2006-2009 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.jboss.on.embedded.ui;
-
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Factory;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-
-/**
- * @author Ian Springer
- */
- at Name("applicationInfoAction")
- at Scope(ScopeType.APPLICATION)
- at Startup
-public class ApplicationInfoAction
-{
-    private final Log log = LogFactory.getLog(this.getClass());
-
-    @Factory(value = "baseUrl")
-    public String getBaseUrl()
-    {
-        FacesContext context = FacesContext.getCurrentInstance();
-        HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
-        int indexAfterContextRoot = request.getRequestURL().indexOf(request.getServletPath());
-        String baseUrl = request.getRequestURL().substring(0, indexAfterContextRoot) + "/";
-        log.debug("Base URL: " + baseUrl);
-        return baseUrl;
-    }
-}

Copied: trunk/core/src/main/java/org/jboss/on/embedded/ui/SessionInfoAction.java (from rev 579, trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java)
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/SessionInfoAction.java	                        (rev 0)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SessionInfoAction.java	2009-07-24 16:05:54 UTC (rev 583)
@@ -0,0 +1,58 @@
+/*
+ * Embedded Jopr Project
+ * Copyright (C) 2006-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.ui;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+
+/**
+ * A Seam component for exposing miscellaneous information specific to the current session.
+ *
+ * @author Ian Springer
+ */
+ at Name("sessionInfoAction")
+ at Scope(ScopeType.SESSION)
+ at Startup
+public class SessionInfoAction
+{
+    private final Log log = LogFactory.getLog(this.getClass());
+
+    @Factory(value = "baseUrl")
+    public String getBaseUrl()
+    {
+        FacesContext context = FacesContext.getCurrentInstance();
+        HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
+        int indexAfterContextRoot = request.getRequestURL().indexOf(request.getServletPath());
+        String baseUrl = request.getRequestURL().substring(0, indexAfterContextRoot) + "/";
+        HttpSession session = request.getSession();
+        log.debug("Base URL for HTTP session with id " + session.getId() + ": " + baseUrl);
+        return baseUrl;
+    }
+}


Property changes on: trunk/core/src/main/java/org/jboss/on/embedded/ui/SessionInfoAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Author Id Revision HeadURL
Name: svn:eol-style
   + LF



More information about the embjopr-commits mailing list