001    package org.apache.turbine.util.uri;
002    
003    
004    /*
005     * Licensed to the Apache Software Foundation (ASF) under one
006     * or more contributor license agreements.  See the NOTICE file
007     * distributed with this work for additional information
008     * regarding copyright ownership.  The ASF licenses this file
009     * to you under the Apache License, Version 2.0 (the
010     * "License"); you may not use this file except in compliance
011     * with the License.  You may obtain a copy of the License at
012     *
013     *   http://www.apache.org/licenses/LICENSE-2.0
014     *
015     * Unless required by applicable law or agreed to in writing,
016     * software distributed under the License is distributed on an
017     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018     * KIND, either express or implied.  See the License for the
019     * specific language governing permissions and limitations
020     * under the License.
021     */
022    
023    
024    import org.apache.turbine.Turbine;
025    
026    /**
027     * Bundles a few static routines concerning URIs, that you
028     * will need all the time.
029     *
030     * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
031     * @version $Id: URIUtils.java 615328 2008-01-25 20:25:05Z tv $
032     */
033    
034    public abstract class URIUtils
035    {
036        /**
037         * Convert a given Path into a Turbine Data URI. The resulting
038         * path contains no path_info or query data. If you have a current
039         * runData object around, you should use DataURI and setScriptName()!.
040         *
041         * @param path A relative path
042         *
043         * @return the absolute path for the request.
044         *
045         */
046    
047        public static String getAbsoluteLink(String path)
048        {
049            DataURI du = new DataURI(Turbine.getDefaultServerData());
050            du.setScriptName(path);
051            return du.getAbsoluteLink();
052        }
053    }