ovidiu 02/01/29 12:05:06 Modified: src/java/org/apache/cocoon/environment/http HttpContext.java Log: Removed extra CR/LF. Revision Changes Path 1.4 +84 -84 xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpContext.java Index: HttpContext.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HttpContext.java 29 Jan 2002 18:49:48 -0000 1.3 +++ HttpContext.java 29 Jan 2002 20:05:06 -0000 1.4 @@ -1,84 +1,84 @@ -/***************************************************************************** - * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * - *****************************************************************************/ -package org.apache.cocoon.environment.http; - -import org.apache.cocoon.environment.Context; - -import javax.servlet.ServletContext; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.io.InputStream; - -/** - * - * Implements the {@link org.apache.cocoon.environment.Context} interface - */ - -public class HttpContext implements Context { - - /** The ServletContext */ - private ServletContext servletContext = null; - - /** - * Constructs a HttpContext object from a ServletContext object - */ - public HttpContext (ServletContext servletContext) { - this.servletContext = servletContext; - } - - public Object getAttribute(String name) { - return servletContext.getAttribute(name); - } - - public void setAttribute(String name, Object value) { - servletContext.setAttribute(name, value); - } - - public void removeAttribute(String name) { - servletContext.removeAttribute(name); - } - - public Enumeration getAttributeNames() { - return servletContext.getAttributeNames(); - } - - public URL getResource(String path) - throws MalformedURLException { - return servletContext.getResource(path); - } - - public InputStream getResourceAsStream(String path) { - return servletContext.getResourceAsStream(path); - } - - public String getRealPath(String path) { - if (path.equals("/")) { - String value = servletContext.getRealPath(path); - if (value == null) { - // Try to figure out the path of the root from that of WEB-INF - try { - value = this.servletContext.getResource("/WEB-INF").toString(); - } catch (MalformedURLException mue) { - throw new RuntimeException("Cannot determine the base URL"); - } - value = value.substring(0,value.length()-"WEB-INF".length()); - } - return value; - } - return servletContext.getRealPath(path); - } - - public String getMimeType(String file) { - return servletContext.getMimeType(file); - } - - public String getInitParameter(String name) { - return servletContext.getInitParameter(name); - } -} +/***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ +package org.apache.cocoon.environment.http; + +import org.apache.cocoon.environment.Context; + +import javax.servlet.ServletContext; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Enumeration; +import java.io.InputStream; + +/** + * + * Implements the {@link org.apache.cocoon.environment.Context} interface + */ + +public class HttpContext implements Context { + + /** The ServletContext */ + private ServletContext servletContext = null; + + /** + * Constructs a HttpContext object from a ServletContext object + */ + public HttpContext (ServletContext servletContext) { + this.servletContext = servletContext; + } + + public Object getAttribute(String name) { + return servletContext.getAttribute(name); + } + + public void setAttribute(String name, Object value) { + servletContext.setAttribute(name, value); + } + + public void removeAttribute(String name) { + servletContext.removeAttribute(name); + } + + public Enumeration getAttributeNames() { + return servletContext.getAttributeNames(); + } + + public URL getResource(String path) + throws MalformedURLException { + return servletContext.getResource(path); + } + + public InputStream getResourceAsStream(String path) { + return servletContext.getResourceAsStream(path); + } + + public String getRealPath(String path) { + if (path.equals("/")) { + String value = servletContext.getRealPath(path); + if (value == null) { + // Try to figure out the path of the root from that of WEB-INF + try { + value = this.servletContext.getResource("/WEB-INF").toString(); + } catch (MalformedURLException mue) { + throw new RuntimeException("Cannot determine the base URL"); + } + value = value.substring(0,value.length()-"WEB-INF".length()); + } + return value; + } + return servletContext.getRealPath(path); + } + + public String getMimeType(String file) { + return servletContext.getMimeType(file); + } + + public String getInitParameter(String name) { + return servletContext.getInitParameter(name); + } +}
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]