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.filters;
12  
13  import java.util.List;
14  
15  import javax.servlet.http.HttpServletRequest;
16  import javax.servlet.http.HttpServletResponse;
17  
18  import org.apache.catalina.Context;
19  import org.springframework.beans.factory.annotation.Value;
20  import org.springframework.stereotype.Controller;
21  import org.springframework.web.bind.annotation.RequestMapping;
22  import org.springframework.web.servlet.ModelAndView;
23  
24  import psiprobe.controllers.AbstractContextHandlerController;
25  import psiprobe.model.FilterInfo;
26  import psiprobe.tools.ApplicationUtils;
27  
28  /**
29   * Retrieves a list of filter mappings or filter definitions of a web application.
30   */
31  @Controller
32  public class ListAppFiltersController extends AbstractContextHandlerController {
33  
34    @RequestMapping(path = "/appfilters.htm")
35    @Override
36    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
37        throws Exception {
38      return super.handleRequest(request, response);
39    }
40  
41    @Override
42    protected ModelAndView handleContext(String contextName, Context context,
43        HttpServletRequest request, HttpServletResponse response) throws Exception {
44  
45      List<FilterInfo> appFilters =
46          ApplicationUtils.getApplicationFilters(context, getContainerWrapper());
47  
48      return new ModelAndView(getViewName(), "appFilters", appFilters);
49    }
50  
51    @Value("appfilters")
52    @Override
53    public void setViewName(String viewName) {
54      super.setViewName(viewName);
55    }
56  
57  }