GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / src / scaffolding / org / codehaus / groovy / grails / scaffolding / DefaultGrailsResponseHandlerFactory.java
blob138286ae88519ada0bc192424a9b4674d1bd8d82
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.scaffolding;
18 import org.codehaus.groovy.grails.commons.GrailsApplication;
20 /**
21 * The default implementation of a ScaffoldResponseHandlerFactory that uses the uri extension to look-up
22 * an appropriate response handler. If none exists for the uri suffix it returns the default response handler
24 * @author Graeme Rocher
25 * @since 0.1
27 * Created: 30 Nov 2005
30 public class DefaultGrailsResponseHandlerFactory implements
31 ScaffoldResponseHandlerFactory {
33 private ScaffoldResponseHandler defaultResponseHandler;
36 public DefaultGrailsResponseHandlerFactory(GrailsApplication application, ScaffoldResponseHandler defaultResponseHandler) {
37 super();
38 if(defaultResponseHandler == null)
39 throw new IllegalStateException("Argument 'defaultResponseHandler' is required");
40 if(application == null)
41 throw new IllegalStateException("Argument 'application' is required");
43 this.defaultResponseHandler = defaultResponseHandler;
46 public ScaffoldResponseHandler getScaffoldResponseHandler(String uri) {
47 // for now just return the default
48 return defaultResponseHandler;