Author: nbelaevski
Date: 2009-07-07 13:09:24 -0400 (Tue, 07 Jul 2009)
New Revision: 14814
Added:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java
Removed:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java
Log:
Reintegrated community/3.3.x into JSF 2.0 branch
Copied: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context (from rev
14238, trunk/framework/impl/src/main/java/org/richfaces/context)
Deleted:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/context/RequestContext.java 2009-05-18
14:55:17 UTC (rev 14238)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java 2009-07-07
17:09:24 UTC (rev 14814)
@@ -1,87 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.context;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.1
- */
-
-public final class RequestContext {
-
- private static final String REQUEST_ATTRIBUTE_NAME = RequestContext.class.getName();
-
- private Map<String, Object> attributesMap = null;
-
- private RequestContext() {
- super();
- }
-
- public static RequestContext getInstance() {
- return getInstance(FacesContext.getCurrentInstance());
- }
-
- public static RequestContext getInstance(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- RequestContext requestContext = (RequestContext)
requestMap.get(REQUEST_ATTRIBUTE_NAME);
- if (requestContext == null) {
- requestContext = new RequestContext();
-
- requestMap.put(REQUEST_ATTRIBUTE_NAME, requestContext);
- }
-
- return requestContext;
- }
-
- public Object getAttribute(String name) {
- Object result = null;
-
- if (attributesMap != null) {
- result = attributesMap.get(name);
- }
-
- return result;
- }
-
- public void setAttribute(String name, Object value) {
- if (value != null) {
- if (attributesMap == null) {
- attributesMap = new HashMap<String, Object>();
- }
-
- attributesMap.put(name, value);
- } else {
- if (attributesMap != null) {
- attributesMap.remove(name);
- }
- }
- }
-
-}
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/richfaces/context/RequestContext.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/context/RequestContext.java 2009-07-07
17:09:24 UTC (rev 14814)
@@ -0,0 +1,87 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.context;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+
+public final class RequestContext {
+
+ private static final String REQUEST_ATTRIBUTE_NAME = RequestContext.class.getName();
+
+ private Map<String, Object> attributesMap = null;
+
+ private RequestContext() {
+ super();
+ }
+
+ public static RequestContext getInstance() {
+ return getInstance(FacesContext.getCurrentInstance());
+ }
+
+ public static RequestContext getInstance(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ RequestContext requestContext = (RequestContext)
requestMap.get(REQUEST_ATTRIBUTE_NAME);
+ if (requestContext == null) {
+ requestContext = new RequestContext();
+
+ requestMap.put(REQUEST_ATTRIBUTE_NAME, requestContext);
+ }
+
+ return requestContext;
+ }
+
+ public Object getAttribute(String name) {
+ Object result = null;
+
+ if (attributesMap != null) {
+ result = attributesMap.get(name);
+ }
+
+ return result;
+ }
+
+ public void setAttribute(String name, Object value) {
+ if (value != null) {
+ if (attributesMap == null) {
+ attributesMap = new HashMap<String, Object>();
+ }
+
+ attributesMap.put(name, value);
+ } else {
+ if (attributesMap != null) {
+ attributesMap.remove(name);
+ }
+ }
+ }
+
+}