restart.jsp 1.26 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<%@ page import="org.jivesoftware.messenger.container.Container,
                 org.jivesoftware.messenger.container.ServiceLookup,
                 org.jivesoftware.messenger.container.ServiceLookupFactory,
                 org.jivesoftware.util.Log,
                 org.jivesoftware.messenger.auth.UnauthorizedException"%>
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head><title>Simple jsp page</title></head>
  <body>Place your content here</body>
  <%  // Getting to this page means everything is setup, so restart the container.
    // flush the page first
    out.flush();

    // Let them have a chance to get other page assets
    try {
        Thread.sleep(3000L);
    }
    catch (Exception ignored) {}

    // then restart the server
    Container container = null;
    try {
        ServiceLookup lookup = ServiceLookupFactory.getLookup();
        container = (Container)lookup.lookup(Container.class);
    }
    catch (Exception e) {
        Log.error(e);
    }
    // do the restart if the container is not null
    if (container != null) {
        try {
            container.restart();
        }
        catch (UnauthorizedException e) {
            Log.error(e);
        }
    }
%>
</html>