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.apps;
12  
13  import jakarta.servlet.http.HttpServletRequest;
14  import jakarta.servlet.http.HttpServletResponse;
15  
16  import org.apache.catalina.Context;
17  import org.springframework.beans.factory.annotation.Value;
18  import org.springframework.stereotype.Controller;
19  import org.springframework.web.bind.annotation.RequestMapping;
20  import org.springframework.web.servlet.ModelAndView;
21  
22  import psiprobe.controllers.AbstractContextHandlerController;
23  
24  /**
25   * Creates a list of resources for a particular web application.
26   */
27  @Controller
28  public class ListApplicationResourcesController extends AbstractContextHandlerController {
29  
30    @RequestMapping(path = "/resources.htm")
31    @Override
32    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
33        throws Exception {
34      return super.handleRequest(request, response);
35    }
36  
37    @Override
38    protected ModelAndView handleContext(String contextName, Context context,
39        HttpServletRequest request, HttpServletResponse response) throws Exception {
40  
41      return new ModelAndView(getViewName(), "resources", getContainerWrapper().getResourceResolver()
42          .getApplicationResources(context, getContainerWrapper()));
43    }
44  
45    @Value("resources")
46    @Override
47    public void setViewName(String viewName) {
48      super.setViewName(viewName);
49    }
50  
51  }