compression-settings.jsp 5.5 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4 5
<%--
  -	$RCSfile$
  -	$Revision: 3195 $
  -	$Date: $
  -
6
  - Copyright (C) 2005-2008 Jive Software. All rights reserved.
Gaston Dombiak's avatar
Gaston Dombiak committed
7
  -
8 9 10 11 12 13 14 15 16 17 18
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
  - You may obtain a copy of the License at
  -
  -     http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
Gaston Dombiak's avatar
Gaston Dombiak committed
19 20
--%>

21 22 23
<%@ page import="org.jivesoftware.openfire.Connection,
                 org.jivesoftware.openfire.session.LocalClientSession,
                 org.jivesoftware.util.JiveGlobals"
Gaston Dombiak's avatar
Gaston Dombiak committed
24 25
    errorPage="error.jsp"
%>
26
<%@ page import="org.jivesoftware.util.ParamUtils" %>
Gaston Dombiak's avatar
Gaston Dombiak committed
27 28 29 30 31 32 33

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"  />
<% webManager.init(request, response, session, application, out ); %>

<html>
34 35 36 37 38
<head>
<title><fmt:message key="compression.settings.title"/></title>
<meta name="pageID" content="server-compression"/>
</head>
<body>
Gaston Dombiak's avatar
Gaston Dombiak committed
39

40
<% // Get parameters:
Gaston Dombiak's avatar
Gaston Dombiak committed
41
    boolean update = request.getParameter("update") != null;
42 43
    boolean clientEnabled = ParamUtils.getBooleanParameter(request, "clientEnabled");
    boolean serverEnabled = ParamUtils.getBooleanParameter(request, "serverEnabled");
Gaston Dombiak's avatar
Gaston Dombiak committed
44 45 46

    if (update) {
        // Update c2s compression policy
47 48
        LocalClientSession.setCompressionPolicy(
                clientEnabled ? Connection.CompressionPolicy.optional : Connection.CompressionPolicy.disabled);
Gaston Dombiak's avatar
Gaston Dombiak committed
49
        // Update s2s compression policy
50 51
        JiveGlobals.setProperty("xmpp.server.compression.policy", serverEnabled ?
                Connection.CompressionPolicy.optional.toString() : Connection.CompressionPolicy.disabled.toString());
52 53
        // Log the event
        webManager.logEvent("set compression policy", "c2s compression = "+clientEnabled+"\ns2s compression = "+serverEnabled);
54
%>
Gaston Dombiak's avatar
Gaston Dombiak committed
55 56 57
    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
58
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
59 60 61 62 63 64 65 66 67 68 69
        <td class="jive-icon-label">
        <fmt:message key="compression.settings.update" />
        </td></tr>
    </tbody>
    </table>
    </div><br>
    <%

    }

    // Set page vars
70
    clientEnabled = Connection.CompressionPolicy.optional == LocalClientSession.getCompressionPolicy();
Gaston Dombiak's avatar
Gaston Dombiak committed
71 72 73 74 75 76 77
    serverEnabled = Connection.CompressionPolicy.optional.toString().equals(JiveGlobals.getProperty("xmpp.server.compression.policy", Connection.CompressionPolicy.disabled.toString()));
%>

<p>
<fmt:message key="compression.settings.info" />
</p>

78 79

<!-- BEGIN compression settings -->
Gaston Dombiak's avatar
Gaston Dombiak committed
80
<form action="compression-settings.jsp">
81 82

	<div class="jive-contentBox" style="-moz-border-radius: 3px;">
Gaston Dombiak's avatar
Gaston Dombiak committed
83

84 85
	<h4><fmt:message key="compression.settings.client.policy" /></h4>
	<table cellpadding="3" cellspacing="0" border="0">
Gaston Dombiak's avatar
Gaston Dombiak committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
    <tbody>
        <tr valign="top">
            <td width="1%" nowrap>
                <input type="radio" name="clientEnabled" value="true" id="rb01"
                 <%= (clientEnabled ? "checked" : "") %>>
            </td>
            <td width="99%">
                <label for="rb01">
                <b><fmt:message key="compression.settings.client.enable" /></b> -
                <fmt:message key="compression.settings.client.enable_info" />
                </label>
            </td>
        </tr>
        <tr valign="top">
            <td width="1%" nowrap>
                <input type="radio" name="clientEnabled" value="false" id="rb02"
                 <%= (!clientEnabled ? "checked" : "") %>>
            </td>
            <td width="99%">
                <label for="rb02">
                <b><fmt:message key="compression.settings.client.disable" /></b> -
                <fmt:message key="compression.settings.client.disable_info" />
                </label>
            </td>
        </tr>
    </tbody>
    </table>

114 115
	<br>
	<br>
Gaston Dombiak's avatar
Gaston Dombiak committed
116

117 118
	<h4><fmt:message key="compression.settings.server.policy" /></h4>
	<table cellpadding="3" cellspacing="0" border="0">
Gaston Dombiak's avatar
Gaston Dombiak committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    <tbody>
        <tr valign="top">
            <td width="1%" nowrap>
                <input type="radio" name="serverEnabled" value="true" id="rb03"
             <%= (serverEnabled ? "checked" : "") %>>
            </td>
            <td width="99%">
                <label for="rb03">
                <b><fmt:message key="compression.settings.server.enable" /></b> -
                <fmt:message key="compression.settings.server.enable_info" />
                </label>
            </td>
        </tr>
        <tr valign="top">
            <td width="1%" nowrap>
                <input type="radio" name="serverEnabled" value="false" id="rb04"
             <%= (!serverEnabled ? "checked" : "") %>>
            </td>
            <td width="99%">
                <label for="rb04">
                <b><fmt:message key="compression.settings.server.disable" /></b> -
                <fmt:message key="compression.settings.server.disable_info" />
                </label>
            </td>
        </tr>
    </tbody>
    </table>
146
	</div>
Matt Tucker's avatar
Matt Tucker committed
147
    <input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
Gaston Dombiak's avatar
Gaston Dombiak committed
148
</form>
149 150
<!-- END compression settings -->

Gaston Dombiak's avatar
Gaston Dombiak committed
151

152
</body>
Gaston Dombiak's avatar
Gaston Dombiak committed
153
</html>