1 /* 2 * Copyright 2004-2005 the original author or authors. 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 package org.codehaus.groovy.grails.web.mapping; 17 18 import java.util.Map; 19 20 /** 21 * Creates URL patterns as Strings. A UrlCreator is passed is a set of parameter values and 22 * produces a valid relative URI. 23 * 24 * @author Graeme Rocher 25 * @since 0.5.5 26 */ 27 @SuppressWarnings("rawtypes") 28 public interface UrlCreator { 29 30 /** 31 * Creates a URL for the given parameter values 32 * 33 * @param parameterValues The parameter values 34 * @param encoding The encoding to use for parameters 35 * 36 * @return Returns the created URL for the given parameter values 37 */ createURL(Map parameterValues, String encoding)38 String createURL(Map parameterValues, String encoding); 39 40 /** 41 * Creates a URL for the given parameter values 42 * 43 * @param parameterValues The parameter values 44 * @param encoding The encoding to use for parameters 45 * @param fragment The URL fragment to be appended to the URL following a # 46 * 47 * @return Returns the created URL for the given parameter values 48 */ createURL(Map parameterValues, String encoding, String fragment)49 String createURL(Map parameterValues, String encoding, String fragment); 50 51 /** 52 * Creates a URL for the given parameters values, controller and action names 53 * 54 * @param controller The controller name 55 * @param action The action name 56 * @param parameterValues The parameter values 57 * @param encoding The encoding to use for parameters 58 * @return The created URL for the given arguments 59 */ createURL(String controller, String action, Map parameterValues, String encoding)60 String createURL(String controller, String action, Map parameterValues, String encoding); 61 62 /** 63 * Creates a URL for the given parameters values, controller and action names without the context path information 64 * 65 * @param controller The controller name 66 * @param action The action name 67 * @param parameterValues The parameter values 68 * @param encoding The encoding to use for parameters 69 * @return The created URL for the given arguments 70 */ createRelativeURL(String controller, String action, Map parameterValues, String encoding)71 String createRelativeURL(String controller, String action, Map parameterValues, String encoding); 72 73 /** 74 * Creates a URL for the given parameters values, controller and action names without the context path information 75 * 76 * @param controller The controller name 77 * @param action The action name 78 * @param parameterValues The parameter values 79 * @param encoding The encoding to use for parameters 80 * @param fragment The fragment to append to the end 81 * @return The created URL for the given arguments 82 */ createRelativeURL(String controller, String action, Map parameterValues, String encoding, String fragment)83 String createRelativeURL(String controller, String action, Map parameterValues, String encoding, String fragment); 84 85 /** 86 * Creates a URL for the given parameters values, controller and action names 87 * 88 * @param controller The controller name 89 * @param action The action name 90 * @param parameterValues The parameter values 91 * @param encoding The encoding to use for parameters 92 * @param fragment The URL fragment to be appended to the URL following a # 93 * @return The created URL for the given arguments 94 */ createURL(String controller, String action, Map parameterValues, String encoding, String fragment)95 String createURL(String controller, String action, Map parameterValues, String encoding, String fragment); 96 } 97