cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rica...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library XSPContextLibrary.java
Date Sun, 09 Jan 2000 02:46:58 GMT
ricardo     00/01/08 18:46:58

  Modified:    src/org/apache/cocoon/processor/xsp/library
                        XSPContextLibrary.java
  Log:
  Provided support for deprecated methods. Made all methods static. Removed Java2 dependency
  
  Revision  Changes    Path
  1.3       +19 -50    xml-cocoon/src/org/apache/cocoon/processor/xsp/library/XSPContextLibrary.java
  
  Index: XSPContextLibrary.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/XSPContextLibrary.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSPContextLibrary.java	2000/01/05 19:37:57	1.2
  +++ XSPContextLibrary.java	2000/01/09 02:46:58	1.3
  @@ -67,31 +67,19 @@
   
   public class XSPContextLibrary {
     // ServletContext
  -  public static Object getAttribute(ServletContext context, String name) {
  -    if (name == null || name.length() == 0) {
  -      return null;
  -    }
  -
  -    return context.getAttribute(name);
  -  }
  -
     public static Element getAttribute(ServletContext context, String name, Document document)
{
  -    Object value = getAttribute(context, name);
  -
  -    if (value == null) {
  -      return null;
  -    }
  -
  +    Object value = context.getAttribute(name);
       Element element = document.createElement("context:attribute");
  -
       element.setAttribute("name", name);
   
  -    if (value instanceof XObject) {
  -      DocumentFragment fragment = document.createDocumentFragment();
  -      ((XObject) value).toDOM(fragment);
  -      element.appendChild(fragment);
  -    } else {
  -      element.appendChild(document.createTextNode(value.toString()));
  +    if (value != null) {
  +      if (value instanceof XObject) {
  +        DocumentFragment fragment = document.createDocumentFragment();
  +        ((XObject) value).toDOM(fragment);
  +        element.appendChild(fragment);
  +      } else {
  +        element.appendChild(document.createTextNode(value.toString()));
  +      }
       }
   
       return element;
  @@ -107,7 +95,6 @@
   
       String[] attributeNames = new String[v.size()];
       v.copyInto(attributeNames);
  -    Arrays.sort(attributeNames); // Since Java2
   
       return attributeNames;
     }
  @@ -126,34 +113,18 @@
       return element;
     }
   
  -  // Not supported by JSDK versions prior to 2.2
  -  /*
  -  public static String getInitParameter(ServletContext context, String name) {
  -    if (name == null || name.length() == 0) {
  -      return null;
  -    }
  -
  -    return context.getInitParameter(name);
  -  }
  -
     public static Element getInitParameter(ServletContext context, String name, Document
document) {
  -    String value = getInitParameter(context, name);
  -
  -    if (value == null) {
  -      return null;
  -    }
  -
  +    String value = context.getInitParameter(name);
       Element element = document.createElement("context:init-parameter");
  -
       element.setAttribute("name", name);
  -    element.appendChild(document.createTextNode(value));
  +
  +    if (value != null) {
  +      element.appendChild(document.createTextNode(value));
  +    }
   
       return element;
     }
  -  */
   
  -  // Not supported by JSDK versions prior to 2.2
  -  /*
     public static String[] getInitParameterNames(ServletContext context) {
       Vector v = new Vector();
       Enumeration e = context.getInitParameterNames();
  @@ -164,7 +135,6 @@
   
       String[] attributeNames = new String[v.size()];
       v.copyInto(attributeNames);
  -    Arrays.sort(attributeNames); // Since Java2
   
       return attributeNames;
     }
  @@ -182,33 +152,32 @@
   
       return element;
     }
  -  */
   
  -  public Element getMajorVersion(ServletContext context, Document document) {
  +  public static Element getMajorVersion(ServletContext context, Document document) {
       Element element = document.createElement("context:major-version");
       element.appendChild(document.createTextNode(String.valueOf(context.getMajorVersion())));
       return element;
     }
   
  -  public Element getMinorVersion(ServletContext context, Document document) {
  +  public static Element getMinorVersion(ServletContext context, Document document) {
       Element element = document.createElement("context:minor-version");
       element.appendChild(document.createTextNode(String.valueOf(context.getMinorVersion())));
       return element;
     }
   
  -  public Element getMimeType(ServletContext context, String file, Document document) {
  +  public static Element getMimeType(ServletContext context, String file, Document document)
{
       Element element = document.createElement("context:mime-type");
       element.appendChild(document.createTextNode(context.getMimeType(file)));
       return element;
     }
   
  -  public Element getRealPath(ServletContext context, String path, Document document) {
  +  public static Element getRealPath(ServletContext context, String path, Document document)
{
       Element element = document.createElement("context:real-path");
       element.appendChild(document.createTextNode(context.getRealPath(path)));
       return element;
     }
   
  -  public Element getServerInfo(ServletContext context, Document document) {
  +  public static Element getServerInfo(ServletContext context, Document document) {
       Element element = document.createElement("context:real-server-info");
       element.appendChild(document.createTextNode(context.getServerInfo()));
       return element;
  
  
  

Mime
View raw message