diff --git a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java b/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java
deleted file mode 100644
index 6266182..0000000
--- a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Collections;
-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.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.OutgoingLinkRewriter;
-import org.apache.lenya.cms.publication.Repository;
-import org.apache.lenya.cms.publication.Session;
-
-/**
- * <p>
- * Input module for getting the base URL which may be prepended to internal URLs to construct links.
- * The functionality corresponds to the
- * {@link org.apache.lenya.cms.cocoon.transformation.ProxyTransformer} with one exception: If the
- * <em>webappUrl</em> parameter is an empty string, the root proxy URL (or the context prefix,
- * resp.) is returned.
- * </p>
- * <p>
- * Usage: <code>{proxy:{webappUrl}}</code>
- * </p>
- * <p>
- * The module can be configured to use absolute or relative URLs in the same way as the
- * {@link org.apache.lenya.cms.cocoon.transformation.ProxyTransformer}.
- * </p>
- */
-public class ProxyModule extends AbstractInputModule {
-
-    protected static final String ATTRIBUTE_TYPE = "type";
-    protected static final String URL_TYPE_ABSOLUTE = "absolute";
-    protected static final String URL_TYPE_RELATIVE = "relative";
-    protected static final String PARAMETER_URLS = "urls";
-
-    private boolean relativeUrls;
-    protected Repository repository;
-
-    /**
-     * @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 {
-
-        final String webappUrl = name;
-        Request request = ObjectModelHelper.getRequest(objectModel);
-
-        String value = null;
-        try {
-            if (webappUrl.equals("")) {
-                value = rewrite(request, "/");
-                if (value.endsWith("/")) {
-                    value = value.substring(0, value.length() - 1);
-                }
-            } else {
-                value = rewrite(request, webappUrl);
-            }
-        } catch (ConfigurationException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
-        }
-        return value;
-    }
-
-    protected String rewrite(Request request, String url) throws ConfigurationException {
-        Session session = this.repository.getSession(request);
-        LinkRewriter rewriter = new OutgoingLinkRewriter(session, request.getRequestURI(), request
-                .isSecure(), false, this.relativeUrls);
-        if (!rewriter.matches(url)) {
-            throw new ConfigurationException("The URL [" + url + "] can't be rewritten!");
-        }
-        return rewriter.rewrite(url);
-    }
-
-    /**
-     * @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 {
-        return Collections.EMPTY_SET.iterator();
-    }
-
-    /**
-     * @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 {
-        Object[] objects = { getAttribute(name, modeConf, objectModel) };
-        return objects;
-    }
-
-    public void configure(Configuration conf) throws ConfigurationException {
-        super.configure(conf);
-        Configuration urlConfig = conf.getChild(PARAMETER_URLS, false);
-        if (urlConfig != null) {
-            String value = urlConfig.getAttribute(ATTRIBUTE_TYPE);
-            setUrlType(value);
-        }
-    }
-
-    protected void setUrlType(String value) throws ConfigurationException {
-        if (value.equals(URL_TYPE_RELATIVE)) {
-            this.relativeUrls = true;
-        } else if (value.equals(URL_TYPE_ABSOLUTE)) {
-            this.relativeUrls = false;
-        } else {
-            throw new ConfigurationException("Invalid URL type [" + value
-                    + "], must be relative or absolute.");
-        }
-    }
-
-    public void setRepository(Repository repository) {
-        this.repository = repository;
-    }
-
-}
\ No newline at end of file
diff --git a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java b/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java
deleted file mode 100644
index 97e43f5..0000000
--- a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.OutgoingLinkRewriter;
-import org.apache.lenya.cms.publication.Repository;
-import org.apache.lenya.cms.publication.Session;
-import org.xml.sax.SAXException;
-
-/**
- * <p>
- * Proxy transformer.
- * </p>
- * <p>
- * The resulting URLs can either be absolute (default) or relative. You can either configure this
- * when declaring the transformer:
- * </p>
- * <code><pre>
- *     &lt;map:transformer ... &gt;
- *       &lt;urls type=&quot;relative&quot;/&gt;
- *       ...
- *     &lt;/map:transformer&gt;
- * </pre></code>
- * <p>
- * or pass a parameter:
- * </p>
- * <code><pre>
- *     &lt;map:parameter name=&quot;urls&quot; value=&quot;relative&quot;/&gt;
- * </pre></code>
- * @see OutgoingLinkRewriter
- */
-public class ProxyTransformer extends AbstractLinkTransformer {
-
-    protected static final String ATTRIBUTE_TYPE = "type";
-    protected static final String URL_TYPE_ABSOLUTE = "absolute";
-    protected static final String URL_TYPE_RELATIVE = "relative";
-    protected static final String PARAMETER_URLS = "urls";
-
-    private boolean relativeUrls = false;
-    private LinkRewriter rewriter;
-    private Repository repository;
-
-    public void setup(SourceResolver resolver, Map objectModel, String source, Parameters params)
-            throws ProcessingException, SAXException, IOException {
-        super.setup(resolver, objectModel, source, params);
-        Request request = ObjectModelHelper.getRequest(objectModel);
-
-        try {
-            if (params.isParameter(PARAMETER_URLS)) {
-                setUrlType(params.getParameter(PARAMETER_URLS));
-            }
-            Session session = this.repository.getSession(request);
-            String webappUrl = getWebappUrl(params, objectModel);
-            this.rewriter = new OutgoingLinkRewriter(session, webappUrl, request.isSecure(), false,
-                    this.relativeUrls);
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public void configure(Configuration config) throws ConfigurationException {
-        super.configure(config);
-        Configuration urlConfig = config.getChild(PARAMETER_URLS, false);
-        if (urlConfig != null) {
-            String value = urlConfig.getAttribute(ATTRIBUTE_TYPE);
-            setUrlType(value);
-        }
-    }
-
-    protected void setUrlType(String value) throws ConfigurationException {
-        if (value.equals(URL_TYPE_RELATIVE)) {
-            this.relativeUrls = true;
-        } else if (value.equals(URL_TYPE_ABSOLUTE)) {
-            this.relativeUrls = false;
-        } else {
-            throw new ConfigurationException("Invalid URL type [" + value
-                    + "], must be relative or absolute.");
-        }
-    }
-
-    protected LinkRewriter getLinkRewriter() {
-        return this.rewriter;
-    }
-
-    public void recycle() {
-        super.recycle();
-        this.rewriter = null;
-    }
-
-    public void setRepository(Repository repository) {
-        this.repository = repository;
-    }
-
-
-}
diff --git a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/GlobalProxies.java b/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/GlobalProxies.java
deleted file mode 100644
index 743fcf4..0000000
--- a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/GlobalProxies.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Proxy;
-
-/**
- * Service to manage the web-application-wide proxy settings.
- */
-public interface GlobalProxies {
-    
-    /**
-     * The service role.
-     */
-    String ROLE = GlobalProxies.class.getName();
-    
-    /**
-     * @param ssl If SSL is used.
-     * @return A proxy.
-     */
-    Proxy getProxy(boolean ssl);
-
-}
diff --git a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java b/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java
deleted file mode 100644
index 0b78b0e..0000000
--- a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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.lenya.cms.linking;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cocoon.spring.configurator.WebAppContextUtils;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.cms.publication.Proxy;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.Session;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.util.StringUtil;
-
-/**
- * <p>
- * Converts web application links to links which will be sent to the browser by using the
- * publication's proxy settings. If the current request is SSL-encrypted, all link URLs will use the
- * SSL proxy.
- * </p>
- * <p>
- * Objects of this class are not thread-safe.
- * </p>
- */
-public class OutgoingLinkRewriter extends ServletLinkRewriter {
-
-    private boolean relativeUrls;
-    private PolicyManager policyManager;
-    private AccreditableManager accreditableManager;
-    private boolean ssl;
-    private GlobalProxies globalProxies;
-    private boolean considerSslPolicies;
-    private Session session;
-
-    /**
-     * @param session The current session.
-     * @param requestUrl The requested web application URL (without servlet context path) where the
-     *            links should be rewritten.
-     * @param ssl If the current page is SSL-encrypted.
-     * @param considerSslPolicies If the SSL protection of policies should be considered when
-     *            resolving the corresponding proxy. Setting this to <code>true</code> leads to a
-     *            substantial performance overhead.
-     * @param relativeUrls If relative URLs should be created.
-     */
-    public OutgoingLinkRewriter(Session session, String requestUrl, boolean ssl,
-            boolean considerSslPolicies, boolean relativeUrls) {
-        this.requestUrl = requestUrl;
-        this.relativeUrls = relativeUrls;
-        this.ssl = ssl;
-        this.considerSslPolicies = considerSslPolicies;
-
-        try {
-            this.session = session;
-
-            if (this.considerSslPolicies) {
-                AccessControllerResolver acResolver = (AccessControllerResolver) WebAppContextUtils
-                        .getCurrentWebApplicationContext().getBean(AccessControllerResolver.ROLE);
-                AccessController accessController = acResolver.resolveAccessController(requestUrl);
-                if (accessController != null) {
-                    this.accreditableManager = accessController.getAccreditableManager();
-                    this.policyManager = accessController.getPolicyManager();
-                }
-            }
-
-            String[] pubIds = this.session.getPublicationIds();
-            for (String pubId : pubIds) {
-                this.publicationCache.put(pubId, this.session.getPublication(pubId));
-            }
-
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected GlobalProxies getGlobalProxies() {
-        if (this.globalProxies == null) {
-            this.globalProxies = (GlobalProxies) WebAppContextUtils
-                    .getCurrentWebApplicationContext().getBean(GlobalProxies.ROLE);
-        }
-        return this.globalProxies;
-    }
-
-    public boolean matches(String url) {
-        return url.startsWith("/");
-    }
-
-    private Map<String, Publication> publicationCache = new HashMap<String, Publication>();
-
-    protected Publication getPublication(String pubId) throws PublicationException {
-        return (Publication) this.publicationCache.get(pubId);
-    }
-
-    public String rewrite(final String url) {
-
-        String rewrittenUrl = "";
-
-        String path;
-        String suffix;
-
-        int numIndex = url.indexOf('#');
-        if (numIndex > -1) {
-            path = url.substring(0, numIndex);
-            suffix = url.substring(numIndex);
-        } else {
-            int qmIndex = url.indexOf('?');
-            if (qmIndex > -1) {
-                path = url.substring(0, qmIndex);
-                suffix = url.substring(qmIndex);
-            } else {
-                path = url;
-                suffix = "";
-            }
-        }
-
-        try {
-            String normalizedUrl = normalizeUrl(path);
-            if (this.relativeUrls) {
-                rewrittenUrl = getRelativeUrlTo(normalizedUrl);
-            } else {
-                boolean useSsl = this.ssl;
-                if (!useSsl && this.policyManager != null) {
-                    Policy policy = this.policyManager.getPolicy(this.accreditableManager,
-                            normalizedUrl);
-                    useSsl = policy.isSSLProtected();
-                }
-
-                URLInformation info = new URLInformation(normalizedUrl);
-                String pubId = info.getPublicationId();
-
-                Publication pub = null;
-                if (pubId != null) {
-                    pub = getPublication(pubId);
-                }
-
-                // link points to publication
-                if (pub != null) {
-                    rewrittenUrl = rewriteLink(normalizedUrl, pub, useSsl);
-                }
-
-                // link doesn't point to publication
-                else {
-                    Proxy proxy = getGlobalProxies().getProxy(ssl);
-                    rewrittenUrl = proxy.getUrl() + normalizedUrl;
-                }
-            }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-        return rewrittenUrl + suffix;
-    }
-
-    protected String normalizeUrl(final String url) throws URISyntaxException {
-        String normalizedUrl;
-        if (url.indexOf("..") > -1) {
-            normalizedUrl = new URI(url).normalize().toString();
-        } else {
-            normalizedUrl = url;
-        }
-        return normalizedUrl;
-    }
-
-    private String requestUrl;
-
-    private Map pubId2areaList = new HashMap();
-
-    /**
-     * Checks if a publication has an area by using a cache for performance reasons.
-     * @param pub The publication.
-     * @param area The area name.
-     * @return if the publication contains the area.
-     */
-    protected boolean hasArea(Publication pub, String area) {
-        String pubId = pub.getId();
-        List areas = (List) this.pubId2areaList.get(pubId);
-        if (areas == null) {
-            areas = Arrays.asList(pub.getAreaNames());
-            this.pubId2areaList.put(pubId, areas);
-        }
-        return areas.contains(area);
-    }
-
-    /**
-     * @param linkUrl The original link URL.
-     * @param pub The publication to use for proxy resolving.
-     * @param ssl If the URL uses SSL.
-     * @return A link URL.
-     */
-    protected String rewriteLink(String linkUrl, Publication pub, boolean ssl) {
-        URLInformation info = new URLInformation(linkUrl);
-        String rewrittenUrl;
-        String areaName = info.getArea();
-
-        // valid area
-        if (areaName != null && hasArea(pub, areaName)) {
-            Proxy proxy = pub.getProxy(areaName, ssl);
-            rewrittenUrl = proxy.getUrl() + info.getDocumentUrl();
-        }
-
-        // invalid area
-        else {
-            Proxy proxy = getGlobalProxies().getProxy(ssl);
-            rewrittenUrl = proxy.getUrl() + linkUrl;
-        }
-        return rewrittenUrl;
-    }
-
-    protected String getRelativeUrlTo(String webappUrl) {
-        String relativeUrl;
-        if (this.requestUrl.equals(webappUrl)) {
-            relativeUrl = getLastStep(webappUrl);
-        } else {
-            List sourceSteps = toList(this.requestUrl);
-            List targetSteps = toList(webappUrl);
-
-            String lastEqualStep = null;
-
-            while (!sourceSteps.isEmpty() && !targetSteps.isEmpty()
-                    && sourceSteps.get(0).equals(targetSteps.get(0))) {
-                lastEqualStep = (String) sourceSteps.remove(0);
-                targetSteps.remove(0);
-            }
-
-            String prefix = "";
-            if (targetSteps.isEmpty()) {
-                prefix = generateUpDots(sourceSteps.size());
-            } else if (sourceSteps.isEmpty()) {
-                prefix = getLastStep(this.requestUrl) + "/";
-            } else if (sourceSteps.size() > 1) {
-                prefix = generateUpDots(sourceSteps.size() - 1) + "/";
-            } else if (sourceSteps.size() == 1 && targetSteps.get(0).equals("")) {
-                prefix = generateUpDots(1) + "/" + lastEqualStep + "/";
-            }
-
-            String[] targetArray = (String[]) targetSteps.toArray(new String[targetSteps.size()]);
-            String targetPath = StringUtil.join(targetArray, "/");
-            relativeUrl = prefix + targetPath;
-        }
-        return relativeUrl;
-    }
-
-    protected String getLastStep(String url) {
-        return url.substring(url.lastIndexOf("/") + 1);
-    }
-
-    protected String generateUpDots(int length) {
-        String upDots;
-        String[] upDotsArray = new String[length];
-        Arrays.fill(upDotsArray, "..");
-        upDots = StringUtil.join(upDotsArray, "/");
-        return upDots;
-    }
-
-    protected List toList(String url) {
-        return new ArrayList(Arrays.asList(url.substring(1).split("/", -1)));
-    }
-
-}
diff --git a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java b/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java
deleted file mode 100644
index 893b9f9..0000000
--- a/org.apache.lenya.core.linking/src/main/java/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.lenya.cms.linking.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cocoon.processing.ProcessInfoProvider;
-import org.apache.cocoon.spring.configurator.WebAppContextUtils;
-import org.apache.cocoon.util.AbstractLogEnabled;
-import org.apache.lenya.cms.linking.GlobalProxies;
-import org.apache.lenya.cms.publication.Proxy;
-
-/**
- * GlobalProxy service implementation.
- * The class is implemented as a singleton.
- */
-public class GlobalProxiesImpl extends AbstractLogEnabled implements GlobalProxies {
-    
-    private Map ssl2proxy = new HashMap();
-
-    public Proxy getProxy(boolean ssl) {
-        Object key = Boolean.valueOf(ssl);
-        Proxy proxy = (Proxy) this.ssl2proxy.get(key);
-        if (proxy == null) {
-            proxy = initializeProxy(key);
-        }
-        return proxy;
-    }
-
-    protected synchronized Proxy initializeProxy(Object key) {
-        ProcessInfoProvider process = (ProcessInfoProvider) WebAppContextUtils
-                .getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
-        Proxy proxy = new Proxy();
-        proxy.setUrl(process.getRequest().getContextPath());
-        this.ssl2proxy.put(key, proxy);
-        return proxy;
-    }
-    
-    public void setNonSslProxyUrl(String url) {
-        Proxy proxy = new Proxy();
-        proxy.setUrl(url);
-        setProxy(false, proxy);
-    }
-
-    public void setSslProxyUrl(String url) {
-        Proxy proxy = new Proxy();
-        proxy.setUrl(url);
-        setProxy(true, proxy);
-    }
-
-    /**
-     * @param ssl If the proxy is responsible for SSL requests.
-     * @param proxy A proxy.
-     */
-    public void setProxy(boolean ssl, Proxy proxy) {
-        this.ssl2proxy.put(Boolean.valueOf(ssl), proxy);
-    }
-
-}
