01: /*
02: * Copyright 2007 Gerd Ziegler (www.gerdziegler.de)
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: * http://www.apache.org/licenses/LICENSE-2.0
07: * Unless required by applicable law or agreed to in writing,
08: * software distributed under the License is distributed on an
09: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10: * either express or implied. See the License for the specific
11: * language governing permissions and limitations under the License.
12: * @author www.gerdziegler.de
13: */
14:
15: package org.ztemplates.web;
16:
17: import java.io.IOException;
18:
19: import javax.servlet.ServletContext;
20: import javax.servlet.http.HttpServletRequest;
21: import javax.servlet.http.HttpServletResponse;
22:
23: /**
24: * interface to servlet
25: *
26: * @author www.gerdziegler.de
27: */
28: public interface ZIServletService extends ZIService {
29: /**
30: * @return the HttpServletRequest object associated with this servlet request
31: */
32: public HttpServletRequest getRequest();
33:
34: /**
35: * @return the HttpServletResponse
36: */
37: public HttpServletResponse getResponse();
38:
39: /**
40: * @return the ServletContext
41: */
42: public ServletContext getServletContext();
43:
44: /**
45: * renders the object to the response, with default mime type "text/html"
46: *
47: * @param obj
48: */
49: public void render(Object obj) throws Exception;
50:
51: /**
52: * renders the object to the response, with specified mime type
53: *
54: * @param obj
55: * object to render
56: * @param mimeType
57: * mime type to use
58: */
59: public void render(Object obj, String mimeType) throws Exception;
60:
61: /**
62: * creates a url that calls the referenced action
63: *
64: * @param action
65: * @return
66: */
67: public String createUrl(Object action) throws Exception;
68:
69: /**
70: * sends a redirect to the action
71: *
72: * @param action
73: * @throws IOException
74: */
75: public void sendRedirect(Object action) throws Exception;
76: }
|