You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gk...@apache.org on 2007/03/29 21:34:13 UTC
svn commit: r523811 - in
/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main:
java/org/apache/cocoon/servletservice/components/
resources/META-INF/cocoon/avalon/ resources/META-INF/cocoon/spring/
Author: gkossakowski
Date: Thu Mar 29 12:34:12 2007
New Revision: 523811
URL: http://svn.apache.org/viewvc?view=rev&rev=523811
Log:
COCOON-2034: Implemented new module that returns the same as BlockPathModule prefixed with context path (path on which servlets are mounted).
This removes hardcoded prefix which it was only temporary solution.
Added:
cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java (with props)
cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml (with props)
Removed:
cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/avalon/cocoon-servlet-complete-path-resolver.xconf
Added: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java?view=auto&rev=523811
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java (added)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java Thu Mar 29 12:34:12 2007
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.apache.cocoon.servletservice.components;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.cocoon.components.modules.input.InputModule;
+import org.apache.cocoon.environment.ObjectModelHelper;
+
+/**
+ * This module provides almost exactly the same functionality as {@link BlockPathModule}. The only difference is that
+ * this module adds prefix-path on which block/servlet is mounted.<br>
+ * Use this module if you need a base path for URLs pointing resources in your block.
+ *
+ */
+public class BlockCompletePathModule implements InputModule {
+
+ BlockPathModule blockPathModule;
+
+ public BlockPathModule getBlockPathModule() {
+ return blockPathModule;
+ }
+
+ public void setBlockPathModule(BlockPathModule blockPathModule) {
+ this.blockPathModule = blockPathModule;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
+ public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
+ return ObjectModelHelper.getRequest(objectModel).getContextPath() + blockPathModule.getAttribute(name, modeConf, objectModel);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
+ public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
+ public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+
+}
Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/BlockCompletePathModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml?view=auto&rev=523811
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml (added)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml Thu Mar 29 12:34:12 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!-- SVN $Id: cocoon-servlet-service-block-path-module.xml 504719 2007-02-07 22:17:36Z danielf $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean name="org.apache.cocoon.components.modules.input.InputModule/servlet"
+ class="org.apache.cocoon.servletservice.components.BlockCompletePathModule">
+ <property name="blockPathModule" ref="org.apache.cocoon.components.modules.input.InputModule/block-path"/>
+ </bean>
+
+</beans>
Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-components/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-complete-block-path-module.xml
------------------------------------------------------------------------------
svn:eol-style = native