View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe.controllers.connectors;
12  
13  import javax.servlet.http.HttpServletRequest;
14  import javax.servlet.http.HttpServletResponse;
15  
16  import org.springframework.beans.factory.annotation.Value;
17  import org.springframework.stereotype.Controller;
18  import org.springframework.web.bind.annotation.RequestMapping;
19  import org.springframework.web.servlet.ModelAndView;
20  import org.springframework.web.servlet.mvc.ParameterizableViewController;
21  
22  import psiprobe.tools.TimeExpression;
23  
24  /**
25   * The Class ZoomChartController.
26   */
27  @Controller
28  public class ZoomChartController extends ParameterizableViewController {
29  
30    /** The collection period. */
31    private long collectionPeriod;
32  
33    /**
34     * Gets the collection period.
35     *
36     * @return the collection period
37     */
38    public long getCollectionPeriod() {
39      return collectionPeriod;
40    }
41  
42    /**
43     * Sets the collection period.
44     *
45     * @param collectionPeriod the new collection period
46     */
47    public void setCollectionPeriod(long collectionPeriod) {
48      this.collectionPeriod = collectionPeriod;
49    }
50  
51    /**
52     * Sets the collection period using expression.
53     *
54     * @param collectionPeriod the new collection period expression
55     */
56    @Value("${psiprobe.beans.stats.collectors.connector.period}")
57    public void setCollectionPeriod(String collectionPeriod) {
58      this.collectionPeriod = TimeExpression.inSeconds(collectionPeriod);
59    }
60  
61    @RequestMapping(path = "/zoomchart.htm")
62    @Override
63    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
64        throws Exception {
65      return super.handleRequest(request, response);
66    }
67  
68    @Override
69    protected ModelAndView handleRequestInternal(HttpServletRequest request,
70        HttpServletResponse response) throws Exception {
71      return super.handleRequestInternal(request, response).addObject("collectionPeriod",
72          getCollectionPeriod());
73    }
74  
75    @Value("zoomreq")
76    @Override
77    public void setViewName(String viewName) {
78      super.setViewName(viewName);
79    }
80  
81  }