View Javadoc

1   /*
2    * Copyright 2010-2013 Capgemini Licensed under the Apache License, Version 2.0 (the
3    * "License"); you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    * 
6    * http://www.apache.org/licenses/LICENSE-2.0
7    * 
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11   * License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  package net.sf.appstatus.web;
15  
16  import java.io.IOException;
17  import java.io.UnsupportedEncodingException;
18  
19  import javax.servlet.http.HttpServletRequest;
20  import javax.servlet.http.HttpServletResponse;
21  
22  /**
23   * This interface is implemented by every page of the web interface.
24   * 
25   * @author Nicolas Richeton
26   * 
27   */
28  public interface IPage {
29  
30  	/**
31  	 * Process GET requests. Usually display current status.
32  	 * 
33  	 * @param webHandler
34  	 * @param req
35  	 * @param resp
36  	 * @throws UnsupportedEncodingException
37  	 * @throws IOException
38  	 */
39  	void doGet(StatusWebHandler webHandler, HttpServletRequest req, HttpServletResponse resp)
40  			throws UnsupportedEncodingException, IOException;
41  
42  	/**
43  	 * Process POST requests. Usually for admin actions.
44  	 * 
45  	 * @param webHandler
46  	 * @param req
47  	 * @param resp
48  	 */
49  	void doPost(StatusWebHandler webHandler, HttpServletRequest req, HttpServletResponse resp);
50  
51  	/**
52  	 * Id of this page.
53  	 * 
54  	 * @return
55  	 */
56  	String getId();
57  
58  	/**
59  	 * Returns page name, used in url to trigger page rendering.
60  	 * 
61  	 * @return
62  	 */
63  	String getName();
64  }