GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / src / web / org / codehaus / groovy / grails / web / servlet / mvc / GrailsControllerHelper.java
blob2d55d66d4bb3453f2d8cab966068f6ff6e3d6d27
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.
16 package org.codehaus.groovy.grails.web.servlet.mvc;
18 import groovy.lang.Closure;
19 import groovy.lang.GroovyObject;
21 import java.util.Map;
23 import javax.servlet.ServletContext;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
27 import org.codehaus.groovy.grails.commons.GrailsControllerClass;
28 import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes;
29 import org.springframework.web.servlet.ModelAndView;
30 /**
31 * An interface for a helper class that processes Grails controller requests and responses
33 * @author Graeme Rocher
34 * @since 0.2
36 * Created: Oct 27, 2005
38 public interface GrailsControllerHelper {
40 /**
41 * @return The servlet context instance
43 public abstract ServletContext getServletContext();
44 /**
45 * Retrieves a controller class for the specified class name
46 * @param className
47 * @return The controller class or null
49 public abstract GrailsControllerClass getControllerClassByName(String className);
51 /**
52 * Retrieves a GrailsControllerClass by URI
54 * @param uri The URI to lookup
55 * @return A GrailsControllerClass
57 public abstract GrailsControllerClass getControllerClassByURI(String uri);
58 /**
59 * Creates a new controller instance for the specified GrailsControllerClass
60 * @param controllerClass The GrailsControllerClass
61 * @return A new controller instance
62 */
63 public abstract GroovyObject getControllerInstance(
64 GrailsControllerClass controllerClass);
66 /**
67 * Handles a Grails URI
68 * @param uri The URI to processs
69 * @param webRequest The GrailsWebRequest
70 * @return A ModelAndView instance
72 public abstract ModelAndView handleURI(String uri,GrailsWebRequest webRequest);
74 /**
75 * Handles a Controller action
77 * @param action An action Closure instance
78 * @param request The request object
79 * @param response The response
81 * @return The action response
83 public abstract Object handleAction(GroovyObject controller,Closure action,HttpServletRequest request, HttpServletResponse response);
85 /**
86 * Handles a Controller action
88 * @param action An action Closure instance
89 * @param request The request object
90 * @param response The response
91 * @param params A Map of controller parameters
93 * @return The action response
95 public abstract Object handleAction(GroovyObject controller,Closure action,HttpServletRequest request, HttpServletResponse response, Map params);
97 /**
98 * Processes an action response for the specified arguments
100 * @param controller The controller instance
101 * @param returnValue The response from the closure
102 * @param closurePropertyName The property name of the closure
103 * @param viewName The name of the view
105 * @return A ModelAndView object
107 public abstract ModelAndView handleActionResponse(
108 GroovyObject controller, Object returnValue,
109 String closurePropertyName, String viewName);
112 * Handles a Grails URI
113 * @param uri The URI to processs
114 * @param webRequest the GrailsWebRequest instance
115 * @param params A map of controller parameters
116 * @return A ModelAndView instance
118 public abstract ModelAndView handleURI(String uri,
119 GrailsWebRequest webRequest, Map params);
124 * @return Returns the grails request attributes instance
126 GrailsApplicationAttributes getGrailsAttributes();