2 * Copyright 2004-2005 the original author or authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.codehaus
.groovy
.grails
.scaffolding
;
18 import org
.codehaus
.groovy
.grails
.commons
.GrailsApplication
;
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
27 * Created: 30 Nov 2005
30 public class DefaultGrailsResponseHandlerFactory
implements
31 ScaffoldResponseHandlerFactory
{
33 private ScaffoldResponseHandler defaultResponseHandler
;
36 public DefaultGrailsResponseHandlerFactory(GrailsApplication application
, ScaffoldResponseHandler defaultResponseHandler
) {
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
;