cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/deli/java/org/apache/cocoon/components/deli DeliImpl.java
Date Wed, 30 Jul 2003 02:21:32 GMT
joerg       2003/07/29 19:21:31

  Modified:    src/java/org/apache/cocoon/servlet BootstrapServlet.java
               src/java/org/apache/cocoon/servlet/multipart
                        MultipartHttpServletRequest.java
               src/blocks/deli/java/org/apache/cocoon/components/deli
                        DeliImpl.java
  Log:
  fixed Javadoc, added deprecation tags to inherited deprecated methods from servlet API,
code formatting
  
  Revision  Changes    Path
  1.4       +21 -5     cocoon-2.1/src/java/org/apache/cocoon/servlet/BootstrapServlet.java
  
  Index: BootstrapServlet.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/servlet/BootstrapServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BootstrapServlet.java	2 Jul 2003 18:33:38 -0000	1.3
  +++ BootstrapServlet.java	30 Jul 2003 02:21:31 -0000	1.4
  @@ -239,15 +239,30 @@
           public RequestDispatcher getNamedDispatcher(String param) {
               return this.context.getNamedDispatcher(param);
           }
  -    
  +
  +        /**
  +         * @deprecated The method BootstrapServlet.ContextWrapper.getServlet(String)
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServlet(java.lang.String)">ServletContext#getServlet(java.lang.String)</a>
  +         */
           public Servlet getServlet(String param) throws ServletException {
               return this.context.getServlet(param);
           }
  -    
  +
  +        /**
  +         * @deprecated The method BootstrapServlet.ContextWrapper.getServlets()
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServlets()">ServletContext#getServlets()</a>
  +         */
           public Enumeration getServlets() {
               return this.context.getServlets();
           }
  -    
  +
  +        /**
  +         * @deprecated The method BootstrapServlet.ContextWrapper.getServletNames()
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServletNames()">ServletContext#getServletNames()</a>
  +         */
           public Enumeration getServletNames() {
               return this.context.getServletNames();
           }
  @@ -255,7 +270,8 @@
           public void log(String msg) {
               this.context.log(msg);
           }
  -    
  +
  +        /** @deprecated use {@link #log(String message, Throwable throwable)} instead.
*/
           public void log(Exception ex, String msg) {
               this.context.log(ex, msg);
           }
  
  
  
  1.4       +4 -6      cocoon-2.1/src/java/org/apache/cocoon/servlet/multipart/MultipartHttpServletRequest.java
  
  Index: MultipartHttpServletRequest.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/servlet/multipart/MultipartHttpServletRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MultipartHttpServletRequest.java	18 May 2003 18:34:01 -0000	1.3
  +++ MultipartHttpServletRequest.java	30 Jul 2003 02:21:31 -0000	1.4
  @@ -83,7 +83,7 @@
       private Hashtable values = null;
   
       /**
  -     * Create this wrapper around the given request and including the given 
  +     * Create this wrapper around the given request and including the given
        * parts.
        */
       public MultipartHttpServletRequest(HttpServletRequest request, Hashtable values) {
  @@ -93,8 +93,6 @@
   
       /**
        * Cleanup eventually uploaded parts that were saved on disk
  -     * 
  -     * @return a set containing the part names
        */
       public void cleanup() throws IOException {
           Enumeration e = getParameterNames();
  @@ -207,7 +205,7 @@
               return request.getParameterValues(name);
           }
       }
  -    
  +
       /**
        * Method getAttribute
        *
  @@ -579,7 +577,7 @@
   
       /**
        * Method isRequestedSessionIdFromUrl
  -     *
  +     * @deprecated use {@link #isRequestedSessionIdFromURL()} instead
        */
       public boolean isRequestedSessionIdFromUrl() {
           return request.isRequestedSessionIdFromURL();
  
  
  
  1.4       +149 -136  cocoon-2.1/src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java
  
  Index: DeliImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/deli/java/org/apache/cocoon/components/deli/DeliImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeliImpl.java	24 Mar 2003 14:33:55 -0000	1.3
  +++ DeliImpl.java	30 Jul 2003 02:21:31 -0000	1.4
  @@ -101,13 +101,8 @@
    * @version CVS $Id$
    */
   public final class DeliImpl extends AbstractLogEnabled
  -    implements Parameterizable,
  -               Deli,
  -               Composable,
  -               Disposable,
  -               Initializable,
  -               ThreadSafe,
  -               Contextualizable {
  +    implements Parameterizable, Deli, Composable, Disposable, Initializable,
  +               ThreadSafe, Contextualizable {
   
       /** The name of the main DELI configuration file */
       private String deliConfig = "resources/deli/config/deliConfig.xml";
  @@ -122,15 +117,15 @@
       protected CocoonServletContext servletContext;
   
       /** Contextualize this class */
  -    public void contextualize(Context context)
  -    throws ContextException {
  -        org.apache.cocoon.environment.Context ctx = (org.apache.cocoon.environment.Context)
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  +    public void contextualize(Context context) throws ContextException {
  +        org.apache.cocoon.environment.Context ctx =
  +            (org.apache.cocoon.environment.Context)context.get(
  +                Constants.CONTEXT_ENVIRONMENT_CONTEXT);
           this.servletContext = new CocoonServletContext(ctx);
       }
   
       /** Compose this class */
  -    public void compose(ComponentManager manager)
  -    throws ComponentException {
  +    public void compose(ComponentManager manager) throws ComponentException {
           this.manager = manager;
           try {
               this.parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
  @@ -140,27 +135,28 @@
           }
       }
   
  -     /** Configure this class */
  -     public void parameterize(Parameters params) {
  -         this.deliConfig = params.getParameter("deli-config-file", this.deliConfig);
  -     }
  +    /** Configure this class */
  +    public void parameterize(Parameters params) {
  +        this.deliConfig = params.getParameter("deli-config-file", this.deliConfig);
  +    }
   
       /**
        * Initialize
        */
  -    public void initialize()
  -    throws Exception {
  -    try {
  -	 Workspace.getInstance().configure(this.servletContext, this.deliConfig);
  -    } catch (Exception e) {
  -        getLogger().error("DELI Exception while creating workspace: ", e);
  -        throw e;
  -    }
  +    public void initialize() throws Exception {
  +        try {
  +            Workspace.getInstance().configure(this.servletContext, this.deliConfig);
  +        } catch (Exception e) {
  +            getLogger().error("DELI Exception while creating workspace: ", e);
  +            throw e;
  +        }
       }
   
       /** Dispose of this class */
       public void dispose() {
  -        if (parser != null) this.manager.release((Component)parser);
  +        if (parser != null) {
  +            this.manager.release((Component)parser);
  +        }
           this.parser = null;
       }
   
  @@ -170,76 +166,76 @@
        *  this using the DELI legacy device database, and use this
        *  information to retrieve the appropriate CC/PP profile.
        *
  -     *@param	theRequest	The Request.
  -     *@return	The profile as a vector of profile attributes.
  -     *@exception	IOException.
  -     *@exception	ServletException.
  -     *@exception	Exception.
  +     * @param	theRequest	The Request.
  +     * @return	The profile as a vector of profile attributes.
  +     * @throws	IOException
  +     * @throws	ServletException
  +     * @throws	Exception
        */
       public Profile getProfile(Request theRequest)
  -    throws IOException, ServletException, Exception {
  -    try {
  -         CocoonServletRequest servletRequest = new CocoonServletRequest(theRequest);
  -         Profile theProfile = new Profile((HttpServletRequest) servletRequest);
  -         return theProfile;
  -    } catch (Exception e) {
  -        getLogger().error("DELI Exception while retrieving profile: ", e);
  -        throw e;
  -    }
  +        throws IOException, ServletException, Exception {
  +        Profile theProfile = null;
  +        try {
  +            CocoonServletRequest servletRequest = new CocoonServletRequest(theRequest);
  +            theProfile = new Profile(servletRequest);
  +        } catch (Exception e) {
  +            getLogger().error("DELI Exception while retrieving profile: ", e);
  +            throw e;
  +        }
  +        return theProfile;
       }
   
       /** Convert a profile stored as a vector of profile attributes
        *  to a DOM tree.
        *
  -     *@param	theProfile	The profile as a vector of profile attributes.
  -     *@return	The DOM tree.
  +     * @param	theProfile	The profile as a vector of profile attributes.
  +     * @return	The DOM tree.
        */
  -    public Document getUACapabilities(Profile theProfile)
  -    throws Exception {
  -    try {
  -        Document document;
  -        Element rootElement;
  -        Element attributeNode;
  -        Element complexAttributeNode;
  -        Text text;
  -
  -        document = parser.createDocument();
  -        rootElement = document.createElementNS(null, "browser");
  -        document.appendChild(rootElement);
  -
  -        Iterator profileIter = theProfile.iterator();
  -        while (profileIter.hasNext()) {
  -            ProfileAttribute p = (ProfileAttribute) profileIter.next();
  -            attributeNode = document.createElementNS(null, p.getAttribute());
  -            rootElement.appendChild(attributeNode);
  -            Vector attributeValue = p.get();
  -            Iterator complexValueIter = attributeValue.iterator();
  -            if (p.getCollectionType().equals("Simple")) {
  -                // Simple attribute
  -                String value = (String) complexValueIter.next();
  -                text = document.createTextNode(value);
  -                attributeNode.appendChild(text);
  -            } else {
  -                // Complex attribute e.g. Seq or Bag
  -                while (complexValueIter.hasNext()) {
  -                    String value = (String) complexValueIter.next();
  -                    complexAttributeNode = document.createElementNS(null, "li");
  -                    attributeNode.appendChild(complexAttributeNode);
  +    public Document getUACapabilities(Profile theProfile) throws Exception {
  +        Document document = null;
  +        try {
  +            Element rootElement;
  +            Element attributeNode;
  +            Element complexAttributeNode;
  +            Text text;
  +
  +            document = parser.createDocument();
  +            rootElement = document.createElementNS(null, "browser");
  +            document.appendChild(rootElement);
  +
  +            Iterator profileIter = theProfile.iterator();
  +            while (profileIter.hasNext()) {
  +                ProfileAttribute p = (ProfileAttribute)profileIter.next();
  +                attributeNode = document.createElementNS(null, p.getAttribute());
  +                rootElement.appendChild(attributeNode);
  +                Vector attributeValue = p.get();
  +                Iterator complexValueIter = attributeValue.iterator();
  +                if (p.getCollectionType().equals("Simple")) {
  +                    // Simple attribute
  +                    String value = (String)complexValueIter.next();
                       text = document.createTextNode(value);
  -                    complexAttributeNode.appendChild(text);
  +                    attributeNode.appendChild(text);
  +                } else {
  +                    // Complex attribute e.g. Seq or Bag
  +                    while (complexValueIter.hasNext()) {
  +                        String value = (String)complexValueIter.next();
  +                        complexAttributeNode = document.createElementNS(null, "li");
  +                        attributeNode.appendChild(complexAttributeNode);
  +                        text = document.createTextNode(value);
  +                        complexAttributeNode.appendChild(text);
  +                    }
                   }
               }
  +        } catch (Exception e) {
  +            getLogger().error("DELI Exception while converting profile to DOM fragment:
", e);
  +            throw e;
           }
           return document;
  -    } catch (Exception e) {
  -        getLogger().error("DELI Exception while converting profile to DOM fragment: ",
e);
  -        throw e;
  -    }
       }
   
       public Document getUACapabilities(Request theRequest)
  -    throws IOException, Exception {
  -          return this.getUACapabilities(this.getProfile(theRequest));
  +        throws IOException, Exception {
  +        return this.getUACapabilities(this.getProfile(theRequest));
       }
   
       /**
  @@ -256,29 +252,45 @@
           public Object getAttribute(String name) { return envContext.getAttribute(name);
}
           public void setAttribute(String name, Object value) { envContext.setAttribute(name,
value); }
           public Enumeration getAttributeNames() { return envContext.getAttributeNames();
}
  -        public java.net.URL getResource(String path) throws MalformedURLException { return
envContext.getResource(path);}
  +        public java.net.URL getResource(String path) throws MalformedURLException { return
envContext.getResource(path); }
           public String getRealPath(String path) { return envContext.getRealPath(path); }
           public String getMimeType(String file) { return envContext.getMimeType(file); }
           public String getInitParameter(String name) { return envContext.getInitParameter(name);
}
  -        public java.io.InputStream getResourceAsStream(String path){ return envContext.getResourceAsStream(path);}
  +        public java.io.InputStream getResourceAsStream(String path) { return envContext.getResourceAsStream(path);
}
   
           public ServletContext getContext(String uripath) { return (null); }
  -        public Enumeration getInitParameterNames() {return (null); }
  +        public Enumeration getInitParameterNames() { return (null); }
           public int getMajorVersion() { return (2); }
           public int getMinorVersion() { return (3); }
           public RequestDispatcher getNamedDispatcher(String name) { return (null); }
           public RequestDispatcher getRequestDispatcher(String path) { return (null); }
           public Set getResourcePaths(String path) { return null; }
           public String getServerInfo() { return (null); }
  +        /**
  +         * @deprecated The method DeliImpl.CocoonServletContext.getServlet(String)
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServlet(java.lang.String)">ServletContext#getServlet(java.lang.String)</a>
  +         */
           public Servlet getServlet(String name) throws ServletException { return (null);
}
           public String getServletContextName() { return (null); }
  +        /**
  +         * @deprecated The method DeliImpl.CocoonServletContext.getServletNames()
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServletNames()">ServletContext#getServletNames()</a>
  +         */
           public Enumeration getServletNames() { return (null); }
  -        public Enumeration getServlets() {  return (null); }
  +        /**
  +         * @deprecated The method DeliImpl.CocoonServletContext.getServlets()
  +         *             overrides a deprecated method from ServletContext.
  +         * @see <a href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServlets()">ServletContext#getServlets()</a>
  +         */
  +        public Enumeration getServlets() { return (null); }
           public void log(String message) {}
  +        /** @deprecated use {@link #log(String message, Throwable throwable)} instead.
*/
           public void log(Exception exception, String message) {}
  -        public void log(String message, Throwable exception) {}
  +        public void log(String message, Throwable throwable) {}
           public void removeAttribute(String name) {}
  -   }
  +    }
   
       /**
        * Stub implementation of HttpServletRequest
  @@ -290,58 +302,59 @@
               this.request = request;
           }
   
  -        public String getAuthType(){ return request.getAuthType(); }
  -        public long getDateHeader(String s){ return request.getDateHeader(s); }
  -        public String getHeader(String s){ return request.getHeader(s); }
  -        public Enumeration getHeaders(String s){ return request.getHeaders(s); }
  -        public Enumeration getHeaderNames(){ return request.getHeaderNames(); }
  -        public String getMethod(){ return request.getMethod(); }
  -        public String getPathInfo(){ return request.getPathInfo(); }
  -        public String getPathTranslated(){ return request.getPathTranslated(); }
  -        public String getContextPath(){ return request.getContextPath(); }
  -        public String getQueryString(){ return request.getQueryString(); }
  -        public String getRemoteUser(){ return request.getRemoteUser(); }
  -        public boolean isUserInRole(String s){ return request.isUserInRole(s); }
  -        public String getRequestedSessionId(){ return request.getRequestedSessionId();
}
  -        public String getRequestURI(){ return request.getRequestURI(); }
  -        public String getServletPath(){ return request.getServletPath(); }
  -        public boolean isRequestedSessionIdValid(){ return request.isRequestedSessionIdValid();
}
  -        public boolean isRequestedSessionIdFromCookie(){ return request.isRequestedSessionIdFromCookie();
}
  -        public Object getAttribute(String s){ return request.getAttribute(s); }
  -        public Enumeration getAttributeNames(){ return request.getAttributeNames(); }
  -        public String getCharacterEncoding(){ return request.getCharacterEncoding(); }
  -        public int getContentLength(){ return request.getContentLength(); }
  -        public String getContentType(){ return request.getContentType(); }
  -        public String getParameter(String s){ return request.getParameter(s); }
  -        public Enumeration getParameterNames(){ return request.getParameterNames(); }
  -        public String[] getParameterValues(String s){ return request.getParameterValues(s);
}
  -        public String getProtocol(){ return request.getProtocol(); }
  -        public String getScheme(){ return request.getScheme(); }
  -        public String getServerName(){ return request.getServerName(); }
  -        public int getServerPort(){ return request.getServerPort(); }
  -        public String getRemoteAddr(){ return request.getRemoteAddr(); }
  -        public String getRemoteHost(){ return request.getRemoteHost(); }
  -        public void setAttribute(String s, Object obj){ request.setAttribute(s,obj); }
  -        public void removeAttribute(String s){ request.removeAttribute(s); }
  -        public boolean isSecure(){ return request.isSecure(); }
  +        public String getAuthType() { return request.getAuthType(); }
  +        public long getDateHeader(String s) { return request.getDateHeader(s); }
  +        public String getHeader(String s) { return request.getHeader(s); }
  +        public Enumeration getHeaders(String s) { return request.getHeaders(s); }
  +        public Enumeration getHeaderNames() { return request.getHeaderNames(); }
  +        public String getMethod() { return request.getMethod(); }
  +        public String getPathInfo() { return request.getPathInfo(); }
  +        public String getPathTranslated() { return request.getPathTranslated(); }
  +        public String getContextPath() { return request.getContextPath(); }
  +        public String getQueryString() { return request.getQueryString(); }
  +        public String getRemoteUser() { return request.getRemoteUser(); }
  +        public boolean isUserInRole(String s) { return request.isUserInRole(s); }
  +        public String getRequestedSessionId() { return request.getRequestedSessionId();
}
  +        public String getRequestURI() { return request.getRequestURI(); }
  +        public String getServletPath() { return request.getServletPath(); }
  +        public boolean isRequestedSessionIdValid() { return request.isRequestedSessionIdValid();
}
  +        public boolean isRequestedSessionIdFromCookie() { return request.isRequestedSessionIdFromCookie();
}
  +        public Object getAttribute(String s) { return request.getAttribute(s); }
  +        public Enumeration getAttributeNames() { return request.getAttributeNames(); }
  +        public String getCharacterEncoding() { return request.getCharacterEncoding(); }
  +        public int getContentLength() { return request.getContentLength(); }
  +        public String getContentType() { return request.getContentType(); }
  +        public String getParameter(String s) { return request.getParameter(s); }
  +        public Enumeration getParameterNames() { return request.getParameterNames(); }
  +        public String[] getParameterValues(String s) { return request.getParameterValues(s);
}
  +        public String getProtocol() { return request.getProtocol(); }
  +        public String getScheme() { return request.getScheme(); }
  +        public String getServerName() { return request.getServerName(); }
  +        public int getServerPort() { return request.getServerPort(); }
  +        public String getRemoteAddr() { return request.getRemoteAddr(); }
  +        public String getRemoteHost() { return request.getRemoteHost(); }
  +        public void setAttribute(String s, Object obj) { request.setAttribute(s, obj);
}
  +        public void removeAttribute(String s) { request.removeAttribute(s); }
  +        public boolean isSecure() { return request.isSecure(); }
           public StringBuffer getRequestURL() { return null; }
           public Map getParameterMap() { return null; }
  -        public void setCharacterEncoding(String s) { }
  -        public Principal getUserPrincipal(){ return request.getUserPrincipal(); }
  -        public Locale getLocale(){ return request.getLocale(); }
  -        public Enumeration getLocales(){ return request.getLocales(); }
  -
  -        public String getRealPath(String s){ return null; }
  -        public Cookie[] getCookies(){ return null; }
  -        public RequestDispatcher getRequestDispatcher(String s){ return null; }
  -        public BufferedReader getReader() throws IOException{ return null; }
  -        public ServletInputStream getInputStream() throws IOException{ return null; }
  -        public HttpSession getSession(boolean flag){ return null; }
  -        public HttpSession getSession(){ return null; }
  -        public boolean isRequestedSessionIdFromURL(){ return false; }
  -        public boolean isRequestedSessionIdFromUrl(){ return false; }
  -        public int getIntHeader(String s){ return 0; }
  +        public void setCharacterEncoding(String s) {}
  +        public Principal getUserPrincipal() { return request.getUserPrincipal(); }
  +        public Locale getLocale() { return request.getLocale(); }
  +        public Enumeration getLocales() { return request.getLocales(); }
  +
  +        /** @deprecated use {@link CocoonServletContext#getRealPath(java.lang.String)}
instead. */
  +        public String getRealPath(String s) { return null; }
  +        public Cookie[] getCookies() { return null; }
  +        public RequestDispatcher getRequestDispatcher(String s) { return null; }
  +        public BufferedReader getReader() throws IOException { return null; }
  +        public ServletInputStream getInputStream() throws IOException { return null; }
  +        public HttpSession getSession(boolean flag) { return null; }
  +        public HttpSession getSession() { return null; }
  +        public boolean isRequestedSessionIdFromURL() { return false; }
  +        /** @deprecated use {@link #isRequestedSessionIdFromURL()} instead */
  +        public boolean isRequestedSessionIdFromUrl() { return false; }
  +        public int getIntHeader(String s) { return 0; }
       }
   
   }
  -
  
  
  

Mime
View raw message