%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004-2010 Jive Software. All rights reserved.
-
- 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.
--%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%@ page import="org.jivesoftware.util.JiveGlobals,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.openfire.ConnectionManager,
java.util.Collection"
errorPage="error.jsp"
%>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Map" %>
<% webManager.init(request, response, session, application, out ); %>
<% // Get parameters
int port = ParamUtils.getIntParameter(request, "port", -1);
int sslPort = ParamUtils.getIntParameter(request, "sslPort", -1);
int clientIdle = 1000* ParamUtils.getIntParameter(request, "clientIdle", -1);
boolean idleDisco = ParamUtils.getBooleanParameter(request, "idleDisco");
boolean pingIdleClients = ParamUtils.getBooleanParameter(request, "pingIdleClients");
boolean sslEnabled = ParamUtils.getBooleanParameter(request, "sslEnabled");
boolean save = request.getParameter("update") != null;
boolean defaults = request.getParameter("defaults") != null;
if (defaults) {
port = ConnectionManager.DEFAULT_PORT;
sslPort = ConnectionManager.DEFAULT_SSL_PORT;
clientIdle = 6*60*1000;
pingIdleClients = true;
sslEnabled = true;
save = true;
}
final ConnectionManager connectionManager = XMPPServer.getInstance().getConnectionManager();
final Map errors = new HashMap();
if (save) {
if (port < 1) {
errors.put("port", "");
}
if (sslPort < 1 && sslEnabled) {
errors.put("sslPort", "");
}
if (port > 0 && sslPort > 0) {
if (port == sslPort) {
errors.put("portsEqual", "");
}
}
if (idleDisco && clientIdle <= 0) {
errors.put("clientIdle", "");
}
if (errors.size() == 0) {
connectionManager.setClientListenerPort(port);
connectionManager.enableClientSSLListener(sslEnabled);
connectionManager.setClientSSLListenerPort(sslPort);
// Log the event
webManager.logEvent("edit client connections settings", "port = "+port+"\nsslPort = "+sslPort);
response.sendRedirect("client-connections-settings.jsp?success=true");
if (!idleDisco) {
JiveGlobals.setProperty("xmpp.client.idle", "-1");
} else {
JiveGlobals.setProperty("xmpp.client.idle", String.valueOf(clientIdle));
}
JiveGlobals.setProperty("xmpp.client.idle.ping", String.valueOf(pingIdleClients));
// Log the events
webManager.logEvent("set server property xmpp.client.idle", "xmpp.client.idle = "+clientIdle);
webManager.logEvent("set server property xmpp.client.idle.ping", "xmpp.client.idle.ping = "+pingIdleClients);
return;
}
} else {
sslEnabled = connectionManager.isClientSSLListenerEnabled();
port = connectionManager.getClientListenerPort();
sslPort = connectionManager.getClientSSLListenerPort();
clientIdle = JiveGlobals.getIntProperty("xmpp.client.idle", 6*60*1000);
pingIdleClients = JiveGlobals.getBooleanProperty("xmpp.client.idle.ping", true);
}
%>
" %>" />
" %>" />
<% if ("true".equals(request.getParameter("success"))) { %>
<% } %>