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 org.slf4j.Logger;
14  import org.slf4j.LoggerFactory;
15  import org.springframework.security.core.Authentication;
16  import org.springframework.security.core.context.SecurityContextHolder;
17  
18  /**
19   * Stops a web application.
20   */
21  public class BaseStopContextController extends AbstractNoSelfContextHandlerController {
22  
23    /** The Constant logger. */
24    private static final Logger logger = LoggerFactory.getLogger(BaseStopContextController.class);
25  
26    @Override
27    protected void executeAction(String contextName) throws Exception {
28      getContainerWrapper().getTomcatContainer().stop(contextName);
29  
30      // Logging action
31      Authentication auth = SecurityContextHolder.getContext().getAuthentication();
32      // get username logger
33      String name = auth.getName();
34      logger.info(getMessageSourceAccessor().getMessage("probe.src.log.stop"), name, contextName);
35    }
36  
37  }