myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r906828 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Date Fri, 05 Feb 2010 07:25:51 GMT
Author: matzew
Date: Fri Feb  5 07:25:50 2010
New Revision: 906828

URL: http://svn.apache.org/viewvc?rev=906828&view=rev
Log:
added getServerInfo() call

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java?rev=906828&r1=906827&r2=906828&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Fri Feb  5 07:25:50 2010
@@ -311,6 +311,33 @@
   }
 
   /**
+   * Returns the name and version of the underlying servlet container or <code>null</code>
if something
+   * went wrong in trying to retrieve the context.
+   *
+   * @param ec the current external context
+   * @return a String containing the name and version of the underlying servlet container
+   */
+  public static String getServerInfo(ExternalContext ec)
+  {
+    try
+    {
+      if (isPortlet(ec))
+      {
+        return (String) _runMethod(ec.getContext(), "getServerInfo");
+      }
+      else
+      {
+        return ((ServletContext) ec.getContext()).getServerInfo();
+      }
+    }
+    catch (final ClassCastException e)
+    {
+      _LOG.severe(e);
+    }
+    return null;
+  }
+
+  /**
    * Returns the content length or -1 if the unknown.
    *
    * @param ec the current external context



Mime
View raw message