Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 74968 invoked from network); 13 Mar 2007 16:00:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Mar 2007 16:00:25 -0000 Received: (qmail 68502 invoked by uid 500); 13 Mar 2007 16:00:33 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 68442 invoked by uid 500); 13 Mar 2007 16:00:33 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 68427 invoked by uid 99); 13 Mar 2007 16:00:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2007 09:00:33 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2007 09:00:23 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id D6EFA1A9838; Tue, 13 Mar 2007 09:00:02 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r517743 - in /cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice: ServletConnection.java ServletService.java ServletServiceContext.java ServletServiceContextAware.java Date: Tue, 13 Mar 2007 16:00:02 -0000 To: cvs@cocoon.apache.org From: gkossakowski@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070313160002.D6EFA1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gkossakowski Date: Tue Mar 13 09:00:01 2007 New Revision: 517743 URL: http://svn.apache.org/viewvc?view=rev&rev=517743 Log: correct svn properties Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java (contents, props changed) cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java (contents, props changed) cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java (contents, props changed) cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java (contents, props changed) Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java?view=diff&rev=517743&r1=517742&r2=517743 ============================================================================== --- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java (original) +++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java Tue Mar 13 09:00:01 2007 @@ -40,7 +40,7 @@ * * TODO Plenty of work left to have a meaningfull implementation of all methods * - * @version $Id: BlockConnection.java 496060 2007-01-14 11:03:06Z danielf $ + * @version $Id$ */ public final class ServletConnection { Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java?view=diff&rev=517743&r1=517742&r2=517743 ============================================================================== --- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java (original) +++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java Tue Mar 13 09:00:01 2007 @@ -1,206 +1,206 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.cocoon.servletservice; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Map; - -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.cocoon.servletservice.util.ServletConfigurationWrapper; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.web.context.ServletContextAware; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.GenericWebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -/** - * @version $Id: BlockServlet.java 496060 2007-01-14 11:03:06Z danielf $ - */ -public class ServletService extends HttpServlet - implements ApplicationContextAware, ServletContextAware, BeanNameAware, - InitializingBean, DisposableBean, ServletServiceContextAware { - - private ServletServiceContext servletServiceContext; - private String embeddedServletClass; - private Servlet embeddedServlet; - private ServletContext servletContext; - private String beanName; - private ApplicationContext parentContainer; - - public ServletService() { - this.servletServiceContext = new ServletServiceContext(); - } - - /* (non-Javadoc) - * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig) - */ - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - this.servletServiceContext.setServletContext(servletConfig.getServletContext()); - - // create a sub container that resolves paths relative to the block - // context rather than the parent context and make it available in - // a context attribute - if (this.parentContainer == null) - this.parentContainer = - WebApplicationContextUtils.getRequiredWebApplicationContext(servletConfig.getServletContext()); - GenericWebApplicationContext container = new GenericWebApplicationContext(); - container.setParent(this.parentContainer); - container.setServletContext(this.servletServiceContext); - container.refresh(); - this.servletServiceContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, container); - - // create a servlet config based on the block servlet context - ServletConfig blockServletConfig = - new ServletConfigurationWrapper(servletConfig, this.servletServiceContext) { - - // FIXME: The context should get the init parameters from the - // config rather than the oposite way around. - public String getInitParameter(String name) { - return super.getServletContext().getInitParameter(name); - } - - public Enumeration getInitParameterNames() { - return super.getServletContext().getInitParameterNames(); - } - }; - - // create and initialize the embeded servlet - this.embeddedServlet = createEmbeddedServlet(this.embeddedServletClass, blockServletConfig); - this.embeddedServlet.init(blockServletConfig); - this.servletServiceContext.setServlet(this.embeddedServlet); - } - - /** - * Creates and initializes the embedded servlet - * @param string - * @throws ServletException - */ - protected Servlet createEmbeddedServlet(String embeddedServletClassName, ServletConfig servletConfig) - throws ServletException { - try { - return (Servlet) this.getClass().getClassLoader().loadClass(embeddedServletClassName).newInstance(); - } catch (Exception e) { - throw new ServletException("Loading class for embedded servlet failed " + embeddedServletClassName, e); - } - } - - /* (non-Javadoc) - * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) - */ - protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - RequestDispatcher dispatcher = - this.servletServiceContext.getRequestDispatcher(request.getPathInfo()); - dispatcher.forward(request, response); - } - - public void destroy() { - this.embeddedServlet.destroy(); - super.destroy(); - } - - /** - * @return the servletServiceContext - */ - public ServletContext getServletServiceContext() { - return this.servletServiceContext; - } - - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.parentContainer = applicationContext; - } - - public void setServletContext(ServletContext servletContext) { - this.servletContext = servletContext; - } - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public void setMountPath(String mountPath) { - this.servletServiceContext.setMountPath(mountPath); - } - - public String getMountPath() { - return this.servletServiceContext.getMountPath(); - } - - /** - * The path to the blocks resources relative to the servlet context URL, - * must start with an '/'. - * @param blockContextURL - */ - // FIXME: would like to throw an exeption if the form of the url is faulty, - // what is the prefered way of handling faulty properties in Spring? - public void setBlockContextURL(String blockContextURL) { - this.servletServiceContext.setContextPath(blockContextURL); - } - - public void setServletClass(String servletClass) { - this.embeddedServletClass = servletClass; - } - - public void setProperties(Map properties) { - this.servletServiceContext.setInitParams(properties); - } - - public void setConnections(Map connections) { - this.servletServiceContext.setConnections(connections); - } - - public void afterPropertiesSet() throws Exception { - - // Create a servlet config object based on the servlet context - // from the webapp container - ServletConfig servletConfig = new ServletConfig() { - - public String getInitParameter(String parameter) { - return ServletService.this.servletContext.getInitParameter(parameter); - } - - public Enumeration getInitParameterNames() { - return ServletService.this.servletContext.getInitParameterNames(); - } - - public ServletContext getServletContext() { - return ServletService.this.servletContext; - } - - public String getServletName() { - return ServletService.this.beanName; - } - - }; - this.init(servletConfig); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.servletservice; + +import java.io.IOException; +import java.util.Enumeration; +import java.util.Map; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.cocoon.servletservice.util.ServletConfigurationWrapper; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.web.context.ServletContextAware; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * @version $Id$ + */ +public class ServletService extends HttpServlet + implements ApplicationContextAware, ServletContextAware, BeanNameAware, + InitializingBean, DisposableBean, ServletServiceContextAware { + + private ServletServiceContext servletServiceContext; + private String embeddedServletClass; + private Servlet embeddedServlet; + private ServletContext servletContext; + private String beanName; + private ApplicationContext parentContainer; + + public ServletService() { + this.servletServiceContext = new ServletServiceContext(); + } + + /* (non-Javadoc) + * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig) + */ + public void init(ServletConfig servletConfig) throws ServletException { + super.init(servletConfig); + this.servletServiceContext.setServletContext(servletConfig.getServletContext()); + + // create a sub container that resolves paths relative to the block + // context rather than the parent context and make it available in + // a context attribute + if (this.parentContainer == null) + this.parentContainer = + WebApplicationContextUtils.getRequiredWebApplicationContext(servletConfig.getServletContext()); + GenericWebApplicationContext container = new GenericWebApplicationContext(); + container.setParent(this.parentContainer); + container.setServletContext(this.servletServiceContext); + container.refresh(); + this.servletServiceContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, container); + + // create a servlet config based on the block servlet context + ServletConfig blockServletConfig = + new ServletConfigurationWrapper(servletConfig, this.servletServiceContext) { + + // FIXME: The context should get the init parameters from the + // config rather than the oposite way around. + public String getInitParameter(String name) { + return super.getServletContext().getInitParameter(name); + } + + public Enumeration getInitParameterNames() { + return super.getServletContext().getInitParameterNames(); + } + }; + + // create and initialize the embeded servlet + this.embeddedServlet = createEmbeddedServlet(this.embeddedServletClass, blockServletConfig); + this.embeddedServlet.init(blockServletConfig); + this.servletServiceContext.setServlet(this.embeddedServlet); + } + + /** + * Creates and initializes the embedded servlet + * @param string + * @throws ServletException + */ + protected Servlet createEmbeddedServlet(String embeddedServletClassName, ServletConfig servletConfig) + throws ServletException { + try { + return (Servlet) this.getClass().getClassLoader().loadClass(embeddedServletClassName).newInstance(); + } catch (Exception e) { + throw new ServletException("Loading class for embedded servlet failed " + embeddedServletClassName, e); + } + } + + /* (non-Javadoc) + * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + protected void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + RequestDispatcher dispatcher = + this.servletServiceContext.getRequestDispatcher(request.getPathInfo()); + dispatcher.forward(request, response); + } + + public void destroy() { + this.embeddedServlet.destroy(); + super.destroy(); + } + + /** + * @return the servletServiceContext + */ + public ServletContext getServletServiceContext() { + return this.servletServiceContext; + } + + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.parentContainer = applicationContext; + } + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + } + + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public void setMountPath(String mountPath) { + this.servletServiceContext.setMountPath(mountPath); + } + + public String getMountPath() { + return this.servletServiceContext.getMountPath(); + } + + /** + * The path to the blocks resources relative to the servlet context URL, + * must start with an '/'. + * @param blockContextURL + */ + // FIXME: would like to throw an exeption if the form of the url is faulty, + // what is the prefered way of handling faulty properties in Spring? + public void setBlockContextURL(String blockContextURL) { + this.servletServiceContext.setContextPath(blockContextURL); + } + + public void setServletClass(String servletClass) { + this.embeddedServletClass = servletClass; + } + + public void setProperties(Map properties) { + this.servletServiceContext.setInitParams(properties); + } + + public void setConnections(Map connections) { + this.servletServiceContext.setConnections(connections); + } + + public void afterPropertiesSet() throws Exception { + + // Create a servlet config object based on the servlet context + // from the webapp container + ServletConfig servletConfig = new ServletConfig() { + + public String getInitParameter(String parameter) { + return ServletService.this.servletContext.getInitParameter(parameter); + } + + public Enumeration getInitParameterNames() { + return ServletService.this.servletContext.getInitParameterNames(); + } + + public ServletContext getServletContext() { + return ServletService.this.servletContext; + } + + public String getServletName() { + return ServletService.this.beanName; + } + + }; + this.init(servletConfig); + } +} Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletService.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java?view=diff&rev=517743&r1=517742&r2=517743 ============================================================================== --- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java (original) +++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java Tue Mar 13 09:00:01 2007 @@ -1,550 +1,550 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.cocoon.servletservice; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; - -import org.apache.cocoon.servletservice.util.ServletContextWrapper; -import org.apache.excalibur.source.Source; -import org.apache.excalibur.source.SourceResolver; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.web.context.support.WebApplicationContextUtils; - -/** - * @version $Id: BlockContext.java 496060 2007-01-14 11:03:06Z danielf $ - */ -public class ServletServiceContext extends ServletContextWrapper { - - public static final String SUPER = "super"; - - private Map attributes = new Hashtable(); - private Servlet servlet; - private String mountPath; - private String contextPath; - private Map properties; - private Map connections; - - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getAttribute(java.lang.String) - */ - /* - * TODO ineritance of attributes from the parent context is only - * partly implemented: removeAttribute and getAttributeNames - * doesn't respect inheritance yet. - */ - public Object getAttribute(String name) { - Object value = this.attributes.get(name); - return value != null ? value : super.getAttribute(name); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#setAttribute(java.lang.String, - * java.lang.Object) - */ - public void setAttribute(String name, Object value) { - this.attributes.put(name, value); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#removeAttribute(java.lang.String) - */ - public void removeAttribute(String name) { - this.attributes.remove(name); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getAttributeNames() - */ - public Enumeration getAttributeNames() { - return Collections.enumeration(this.attributes.keySet()); - } - - /** - * @param map the attributes to set - */ - public void setAttributes(Map map) { - if (map != null) - this.attributes = map; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getResource(java.lang.String) - */ - public URL getResource(String path) throws MalformedURLException { - // hack for getting a file protocol or other protocols that can be used as context - // path in the getResource method in the servlet context - if (!(contextPath.startsWith("file:") || contextPath.startsWith("/") - || contextPath.indexOf(':') == -1)) { - SourceResolver resolver = null; - Source source = null; - try { - BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(this); - resolver = (SourceResolver) factory.getBean(SourceResolver.ROLE); - source = resolver.resolveURI(contextPath); - contextPath = source.getURI(); - } catch (IOException e) { - throw new MalformedURLException("Could not resolve " + contextPath); - } finally { - if (resolver != null) - resolver.release(source); - } - } - - // HACK: allow file:/ URLs for reloading of sitemaps during development - if (this.contextPath.startsWith("file:")) { - return new URL("file", null, this.contextPath.substring("file:".length()) + path); - } else { - if (this.contextPath.length() != 0 && this.contextPath.charAt(0) != '/') - throw new MalformedURLException("The contextPath must be empty or start with '/' " - + this.contextPath); - - // prefix the path with the servlet context resolve and resolve in the embeding - // servlet context - return super.getResource(this.contextPath + path); - } - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getRealPath(java.lang.String) - */ - public String getRealPath(String path) { - // We better don't assume that blocks are unpacked - return null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getInitParameter(java.lang.String) - */ - // FIXME, this should be defined in the config instead - public String getInitParameter(String name) { - if (this.properties == null) - return null; - String value = (String) this.properties.get(name); - // Ask the super servlet for the property - if (value == null) { - ServletContext superContext = this.getNamedContext(SUPER); - if (superContext != null) - value = superContext.getInitParameter(name); - } - // Ask the parent context - if (value == null) { - super.getInitParameter(name); - } - return value; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getInitParameterNames() - */ - public Enumeration getInitParameterNames() { - Vector names = new Vector(); - - // add all names of the parent servlet context - Enumeration enumeration = super.getInitParameterNames(); - while (enumeration.hasMoreElements()) { - names.add(enumeration.nextElement()); - } - - // add names of the super servlet - ServletContext superContext = this.getNamedContext(SUPER); - if (superContext != null) { - enumeration = superContext.getInitParameterNames(); - while (enumeration.hasMoreElements()) { - names.add(enumeration.nextElement()); - } - } - - // add property names of this servlet - if (this.properties != null) { - names.addAll(this.properties.keySet()); - } - - return names.elements(); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String) - */ - public InputStream getResourceAsStream(String path) { - try { - return this.getResource(path).openStream(); - } catch (IOException e) { - // FIXME Error handling - e.printStackTrace(); - return null; - } - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getContext(java.lang.String) - */ - public ServletContext getContext(String uripath) { - return null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getMajorVersion() - */ - public int getMajorVersion() { - return 2; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getMinorVersion() - */ - public int getMinorVersion() { - return 3; - } - - private Collection getDirectoryList(File file, String pathPrefix) { - ArrayList filenames = new ArrayList(); - - if (!file.isDirectory()) { - filenames.add("/" + file.toString().substring(pathPrefix.length()-1)); - return filenames; - } - - File[] files = file.listFiles(); - - for (int i = 0; i < files.length; i++) { - File subfile = files[i]; - filenames.addAll(getDirectoryList(subfile, pathPrefix)); - } - - return filenames; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String) - */ - public Set getResourcePaths(String path) { - String pathPrefix; - if (this.contextPath.startsWith("file:")) { - pathPrefix = this.contextPath.substring("file:".length()); - } else { - pathPrefix = this.contextPath; - } - - path = pathPrefix + path; - - if (path == null) { - return Collections.EMPTY_SET; - } - - File file = new File(path); - - if (!file.exists()) { - return Collections.EMPTY_SET; - } - - HashSet set = new HashSet(); - set.addAll(getDirectoryList(file, pathPrefix)); - - return set; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String) - */ - public RequestDispatcher getRequestDispatcher(String path) { - PathDispatcher dispatcher = new PathDispatcher(path); - return dispatcher.exists() ? dispatcher : null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String) - */ - public RequestDispatcher getNamedDispatcher(String name) { - NamedDispatcher dispatcher = new NamedDispatcher(name); - return dispatcher.exists() ? dispatcher : null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getServerInfo() - */ - public String getServerInfo() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContext#getServletContextName() - */ - public String getServletContextName() { - // TODO Auto-generated method stub - return null; - } - - // Servlet service specific methods - - /** - * Set the servlet of the context - * @param servlet - */ - public void setServlet(Servlet servlet) { - this.servlet = servlet; - } - - /** - * Takes the scheme specific part of a servlet service URI (the scheme is the - * responsibilty of the ServletSource) and resolve it with respect to the - * servlets mount point. - */ - public URI absolutizeURI(URI uri) throws URISyntaxException { - String servletServiceName = uri.getScheme(); - ServletServiceContext servletServiceContext; - if (servletServiceName == null) { - // this servlet service - servletServiceContext = this; - } else { - // another servlet service - servletServiceContext = (ServletServiceContext) this.getNamedContext(servletServiceName); - if (servletServiceContext == null) - throw new URISyntaxException(uri.toString(), "Unknown servlet service name"); - } - - String mountPath = servletServiceContext.getMountPath(); - if (mountPath == null) - throw new URISyntaxException(uri.toString(), - "No mount point for this URI"); - if (mountPath.endsWith("/")) - mountPath = mountPath.substring(0, mountPath.length() - 1); - String absoluteURI = mountPath + uri.getSchemeSpecificPart(); - log("Resolving " + uri.toString() + " to " + absoluteURI); - return new URI(absoluteURI); - } - - /** - * Get the context of a servlet service with a given name. - */ - // FIXME implement NPE handling - public ServletContext getNamedContext(String name) { - if (this.connections == null) { - return null; - } - - Servlet servlet = - (Servlet) this.connections.get(name); - return servlet != null ? ((ServletServiceContextAware)servlet).getServletServiceContext() : null; - } - - /** - * @param mountPath The mountPath to set. - */ - public void setMountPath(String mountPath) { - this.mountPath = mountPath; - } - - /** - * Get the mount path of the servlet service context - */ - public String getMountPath() { - return this.mountPath; - } - - /** - * @param contextPath - */ - public void setContextPath(String contextPath) { - this.contextPath = contextPath; - } - - /** - * @param properties The properties to set. - */ - public void setInitParams(Map properties) { - this.properties = properties; - } - - /** - * @param connections the connections to set - */ - public void setConnections(Map connections) { - this.connections = connections; - } - - protected class NamedDispatcher implements RequestDispatcher { - - private String servletServiceName; - private boolean superCall = false; - private ServletContext context; - - public NamedDispatcher(String servletServiceName) { - this.servletServiceName = servletServiceName; - this.superCall = SUPER.equals(this.servletServiceName); - - // Call to a named servlet service that exists in the current context - this.context = ServletServiceContext.this.getNamedContext(this.servletServiceName); - if (this.context == null) { - // If there is a super servlet service, the connection might - // be defined there instead. - ServletServiceContext superContext = - (ServletServiceContext) ServletServiceContext.this.getNamedContext(SUPER); - if (superContext != null) { - this.context = superContext.getNamedContext(this.servletServiceName); - this.superCall = true; - } - } - } - - protected boolean exists() { - return this.context != null; - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.RequestDispatcher#forward(javax.servlet.ServletRequest, - * javax.servlet.ServletResponse) - */ - public void forward(ServletRequest request, ServletResponse response) - throws ServletException, IOException { - // Call to named servlet service - - ServletServiceContext.this.log("Enter processing in servlet service " + this.servletServiceName); - RequestDispatcher dispatcher = - this.context.getRequestDispatcher(((HttpServletRequest)request).getPathInfo()); - if (dispatcher != null && dispatcher instanceof PathDispatcher) { - ((PathDispatcher)dispatcher).forward(request, response, this.superCall); - } else { - // Cannot happen - throw new IllegalStateException(); - } - ServletServiceContext.this.log("Leaving processing in servlet service " + this.servletServiceName); - } - - /* - * (non-Javadoc) - * - * @see javax.servlet.RequestDispatcher#include(javax.servlet.ServletRequest, - * javax.servlet.ServletResponse) - */ - public void include(ServletRequest request, ServletResponse response) - throws ServletException, IOException { - throw new UnsupportedOperationException(); - } - } - - /** - * Limited functionality, assumes that there is at most one servlet in the context - */ - private class PathDispatcher implements RequestDispatcher { - - // Ignores path, as the assumed only servlet within the context is - // implicitly mounted on '/*' - private PathDispatcher(String path) { - } - - private boolean exists() { - return ServletServiceContext.this.servlet != null; - } - - /* (non-Javadoc) - * @see javax.servlet.RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) - */ - public void forward(ServletRequest request, ServletResponse response) - throws ServletException, IOException { - this.forward(request, response, false); - } - - protected void forward(ServletRequest request, ServletResponse response, boolean superCall) - throws ServletException, IOException { - try { - if (!superCall) { - // It is important to set the current context each time - // a new context is entered, this is used for the servlet - // protocol - CallStackHelper.enterServlet(ServletServiceContext.this); - } else { - // A super servlet service should be called in the context of - // the called servlet service to get polymorphic calls resolved - // in the right way. We still need to register the - // current context for resolving super calls relative it. - CallStackHelper.enterSuperServlet(ServletServiceContext.this); - } - ServletServiceContext.this.servlet.service(request, response); - } finally { - CallStackHelper.leaveServlet(); - } - } - - /* (non-Javadoc) - * @see javax.servlet.RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) - */ - public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException { - throw new UnsupportedOperationException(); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.servletservice; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import org.apache.cocoon.servletservice.util.ServletContextWrapper; +import org.apache.excalibur.source.Source; +import org.apache.excalibur.source.SourceResolver; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * @version $Id$ + */ +public class ServletServiceContext extends ServletContextWrapper { + + public static final String SUPER = "super"; + + private Map attributes = new Hashtable(); + private Servlet servlet; + private String mountPath; + private String contextPath; + private Map properties; + private Map connections; + + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getAttribute(java.lang.String) + */ + /* + * TODO ineritance of attributes from the parent context is only + * partly implemented: removeAttribute and getAttributeNames + * doesn't respect inheritance yet. + */ + public Object getAttribute(String name) { + Object value = this.attributes.get(name); + return value != null ? value : super.getAttribute(name); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#setAttribute(java.lang.String, + * java.lang.Object) + */ + public void setAttribute(String name, Object value) { + this.attributes.put(name, value); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#removeAttribute(java.lang.String) + */ + public void removeAttribute(String name) { + this.attributes.remove(name); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getAttributeNames() + */ + public Enumeration getAttributeNames() { + return Collections.enumeration(this.attributes.keySet()); + } + + /** + * @param map the attributes to set + */ + public void setAttributes(Map map) { + if (map != null) + this.attributes = map; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getResource(java.lang.String) + */ + public URL getResource(String path) throws MalformedURLException { + // hack for getting a file protocol or other protocols that can be used as context + // path in the getResource method in the servlet context + if (!(contextPath.startsWith("file:") || contextPath.startsWith("/") + || contextPath.indexOf(':') == -1)) { + SourceResolver resolver = null; + Source source = null; + try { + BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(this); + resolver = (SourceResolver) factory.getBean(SourceResolver.ROLE); + source = resolver.resolveURI(contextPath); + contextPath = source.getURI(); + } catch (IOException e) { + throw new MalformedURLException("Could not resolve " + contextPath); + } finally { + if (resolver != null) + resolver.release(source); + } + } + + // HACK: allow file:/ URLs for reloading of sitemaps during development + if (this.contextPath.startsWith("file:")) { + return new URL("file", null, this.contextPath.substring("file:".length()) + path); + } else { + if (this.contextPath.length() != 0 && this.contextPath.charAt(0) != '/') + throw new MalformedURLException("The contextPath must be empty or start with '/' " + + this.contextPath); + + // prefix the path with the servlet context resolve and resolve in the embeding + // servlet context + return super.getResource(this.contextPath + path); + } + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getRealPath(java.lang.String) + */ + public String getRealPath(String path) { + // We better don't assume that blocks are unpacked + return null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getInitParameter(java.lang.String) + */ + // FIXME, this should be defined in the config instead + public String getInitParameter(String name) { + if (this.properties == null) + return null; + String value = (String) this.properties.get(name); + // Ask the super servlet for the property + if (value == null) { + ServletContext superContext = this.getNamedContext(SUPER); + if (superContext != null) + value = superContext.getInitParameter(name); + } + // Ask the parent context + if (value == null) { + super.getInitParameter(name); + } + return value; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getInitParameterNames() + */ + public Enumeration getInitParameterNames() { + Vector names = new Vector(); + + // add all names of the parent servlet context + Enumeration enumeration = super.getInitParameterNames(); + while (enumeration.hasMoreElements()) { + names.add(enumeration.nextElement()); + } + + // add names of the super servlet + ServletContext superContext = this.getNamedContext(SUPER); + if (superContext != null) { + enumeration = superContext.getInitParameterNames(); + while (enumeration.hasMoreElements()) { + names.add(enumeration.nextElement()); + } + } + + // add property names of this servlet + if (this.properties != null) { + names.addAll(this.properties.keySet()); + } + + return names.elements(); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String) + */ + public InputStream getResourceAsStream(String path) { + try { + return this.getResource(path).openStream(); + } catch (IOException e) { + // FIXME Error handling + e.printStackTrace(); + return null; + } + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getContext(java.lang.String) + */ + public ServletContext getContext(String uripath) { + return null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getMajorVersion() + */ + public int getMajorVersion() { + return 2; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getMinorVersion() + */ + public int getMinorVersion() { + return 3; + } + + private Collection getDirectoryList(File file, String pathPrefix) { + ArrayList filenames = new ArrayList(); + + if (!file.isDirectory()) { + filenames.add("/" + file.toString().substring(pathPrefix.length()-1)); + return filenames; + } + + File[] files = file.listFiles(); + + for (int i = 0; i < files.length; i++) { + File subfile = files[i]; + filenames.addAll(getDirectoryList(subfile, pathPrefix)); + } + + return filenames; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String) + */ + public Set getResourcePaths(String path) { + String pathPrefix; + if (this.contextPath.startsWith("file:")) { + pathPrefix = this.contextPath.substring("file:".length()); + } else { + pathPrefix = this.contextPath; + } + + path = pathPrefix + path; + + if (path == null) { + return Collections.EMPTY_SET; + } + + File file = new File(path); + + if (!file.exists()) { + return Collections.EMPTY_SET; + } + + HashSet set = new HashSet(); + set.addAll(getDirectoryList(file, pathPrefix)); + + return set; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String) + */ + public RequestDispatcher getRequestDispatcher(String path) { + PathDispatcher dispatcher = new PathDispatcher(path); + return dispatcher.exists() ? dispatcher : null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String) + */ + public RequestDispatcher getNamedDispatcher(String name) { + NamedDispatcher dispatcher = new NamedDispatcher(name); + return dispatcher.exists() ? dispatcher : null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getServerInfo() + */ + public String getServerInfo() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.ServletContext#getServletContextName() + */ + public String getServletContextName() { + // TODO Auto-generated method stub + return null; + } + + // Servlet service specific methods + + /** + * Set the servlet of the context + * @param servlet + */ + public void setServlet(Servlet servlet) { + this.servlet = servlet; + } + + /** + * Takes the scheme specific part of a servlet service URI (the scheme is the + * responsibilty of the ServletSource) and resolve it with respect to the + * servlets mount point. + */ + public URI absolutizeURI(URI uri) throws URISyntaxException { + String servletServiceName = uri.getScheme(); + ServletServiceContext servletServiceContext; + if (servletServiceName == null) { + // this servlet service + servletServiceContext = this; + } else { + // another servlet service + servletServiceContext = (ServletServiceContext) this.getNamedContext(servletServiceName); + if (servletServiceContext == null) + throw new URISyntaxException(uri.toString(), "Unknown servlet service name"); + } + + String mountPath = servletServiceContext.getMountPath(); + if (mountPath == null) + throw new URISyntaxException(uri.toString(), + "No mount point for this URI"); + if (mountPath.endsWith("/")) + mountPath = mountPath.substring(0, mountPath.length() - 1); + String absoluteURI = mountPath + uri.getSchemeSpecificPart(); + log("Resolving " + uri.toString() + " to " + absoluteURI); + return new URI(absoluteURI); + } + + /** + * Get the context of a servlet service with a given name. + */ + // FIXME implement NPE handling + public ServletContext getNamedContext(String name) { + if (this.connections == null) { + return null; + } + + Servlet servlet = + (Servlet) this.connections.get(name); + return servlet != null ? ((ServletServiceContextAware)servlet).getServletServiceContext() : null; + } + + /** + * @param mountPath The mountPath to set. + */ + public void setMountPath(String mountPath) { + this.mountPath = mountPath; + } + + /** + * Get the mount path of the servlet service context + */ + public String getMountPath() { + return this.mountPath; + } + + /** + * @param contextPath + */ + public void setContextPath(String contextPath) { + this.contextPath = contextPath; + } + + /** + * @param properties The properties to set. + */ + public void setInitParams(Map properties) { + this.properties = properties; + } + + /** + * @param connections the connections to set + */ + public void setConnections(Map connections) { + this.connections = connections; + } + + protected class NamedDispatcher implements RequestDispatcher { + + private String servletServiceName; + private boolean superCall = false; + private ServletContext context; + + public NamedDispatcher(String servletServiceName) { + this.servletServiceName = servletServiceName; + this.superCall = SUPER.equals(this.servletServiceName); + + // Call to a named servlet service that exists in the current context + this.context = ServletServiceContext.this.getNamedContext(this.servletServiceName); + if (this.context == null) { + // If there is a super servlet service, the connection might + // be defined there instead. + ServletServiceContext superContext = + (ServletServiceContext) ServletServiceContext.this.getNamedContext(SUPER); + if (superContext != null) { + this.context = superContext.getNamedContext(this.servletServiceName); + this.superCall = true; + } + } + } + + protected boolean exists() { + return this.context != null; + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.RequestDispatcher#forward(javax.servlet.ServletRequest, + * javax.servlet.ServletResponse) + */ + public void forward(ServletRequest request, ServletResponse response) + throws ServletException, IOException { + // Call to named servlet service + + ServletServiceContext.this.log("Enter processing in servlet service " + this.servletServiceName); + RequestDispatcher dispatcher = + this.context.getRequestDispatcher(((HttpServletRequest)request).getPathInfo()); + if (dispatcher != null && dispatcher instanceof PathDispatcher) { + ((PathDispatcher)dispatcher).forward(request, response, this.superCall); + } else { + // Cannot happen + throw new IllegalStateException(); + } + ServletServiceContext.this.log("Leaving processing in servlet service " + this.servletServiceName); + } + + /* + * (non-Javadoc) + * + * @see javax.servlet.RequestDispatcher#include(javax.servlet.ServletRequest, + * javax.servlet.ServletResponse) + */ + public void include(ServletRequest request, ServletResponse response) + throws ServletException, IOException { + throw new UnsupportedOperationException(); + } + } + + /** + * Limited functionality, assumes that there is at most one servlet in the context + */ + private class PathDispatcher implements RequestDispatcher { + + // Ignores path, as the assumed only servlet within the context is + // implicitly mounted on '/*' + private PathDispatcher(String path) { + } + + private boolean exists() { + return ServletServiceContext.this.servlet != null; + } + + /* (non-Javadoc) + * @see javax.servlet.RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) + */ + public void forward(ServletRequest request, ServletResponse response) + throws ServletException, IOException { + this.forward(request, response, false); + } + + protected void forward(ServletRequest request, ServletResponse response, boolean superCall) + throws ServletException, IOException { + try { + if (!superCall) { + // It is important to set the current context each time + // a new context is entered, this is used for the servlet + // protocol + CallStackHelper.enterServlet(ServletServiceContext.this); + } else { + // A super servlet service should be called in the context of + // the called servlet service to get polymorphic calls resolved + // in the right way. We still need to register the + // current context for resolving super calls relative it. + CallStackHelper.enterSuperServlet(ServletServiceContext.this); + } + ServletServiceContext.this.servlet.service(request, response); + } finally { + CallStackHelper.leaveServlet(); + } + } + + /* (non-Javadoc) + * @see javax.servlet.RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) + */ + public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException { + throw new UnsupportedOperationException(); + } + } +} Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java?view=diff&rev=517743&r1=517742&r2=517743 ============================================================================== --- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java (original) +++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java Tue Mar 13 09:00:01 2007 @@ -1,34 +1,34 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.cocoon.servletservice; - -import javax.servlet.ServletContext; - -/** - * Inteface for making the servlet service context of a servlet service - * available. It is needed for inter servlet communication in the servlet - * service framework. It is normaly introduced by an AOP mixin. - * - * @version $Id$ - */ -public interface ServletServiceContextAware { - /** - * The servlet context used for inter servlet service communication - * @return - */ - public ServletContext getServletServiceContext(); +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.servletservice; + +import javax.servlet.ServletContext; + +/** + * Inteface for making the servlet service context of a servlet service + * available. It is needed for inter servlet communication in the servlet + * service framework. It is normaly introduced by an AOP mixin. + * + * @version $Id$ + */ +public interface ServletServiceContextAware { + /** + * The servlet context used for inter servlet service communication + * @return + */ + public ServletContext getServletServiceContext(); } Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletServiceContextAware.java ------------------------------------------------------------------------------ svn:keywords = Id