1 /* 2 * Copyright 2005 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 * $Header:$ 17 */ 18 package org.apache.beehive.netui.core.urls; 19 20 import javax.servlet.ServletRequest; 21 22 /** 23 * Offers a method for formatting URLs based on templates from a URL 24 * template config file. A template is chosen from a reference group 25 * based on the template type (key). 26 */ 27 public interface TemplatedURLFormatter 28 { 29 /** 30 * Format the given URL using a URL template, if defined in a URL 31 * template config file. The {@link URIContext} 32 * encapsulates some additional data needed to write out the string form. 33 * E.g. It defines if the "&amp;" entity or the 34 * '&' character should be used to separate quary parameters. 35 * 36 * @param request the current ServletRequest. 37 * @param uri the MutableURI to be formatted into a String. 38 * @param key key for the URL template type to use for formatting the URI 39 * @param uriContext data required to write out the string form. 40 * @return the URL as a <code>String</code> 41 */ 42 public String getTemplatedURL( ServletRequest request, MutableURI uri, String key, URIContext uriContext ); 43 } 44