Commit f7b1aa57 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

allowing script syntax is configurable - one of the parts of BOSH 1.6. JM-1033

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9443 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3261fe1c
......@@ -2133,4 +2133,8 @@ stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
\ No newline at end of file
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -2116,4 +2116,8 @@ timezone.choose=Choose Time Zone
setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group profile settings
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
\ No newline at end of file
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -240,6 +240,10 @@
## Added key: 'user.roster.filter.noshared'
## Added key: 'user.roster.filter.onlyshared'
## Added key: 'setup.ldap.user.vcard.photo'
## Added key: 'httpbind.settings.script.label_enable'
## Added key: 'httpbind.settings.script.label_enable_info'
## Added key: 'httpbind.settings.script.label_disable'
## Added key: 'httpbind.settings.script.label_disable_info'
# Openfire
......@@ -2328,6 +2332,10 @@ httpbind.settings.label_same_info=The HTTP bind service will use distinct ports
httpbind.settings.secure_port=SSL Port:
httpbind.settings.error.general=An error has occured, check the log file for details.
httpbind.settings.error.port=An error has occured configuring the HTTP binding ports, check the error log for more details.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH clients with limited access to connect to the server
httpbind.settings.script.label_disable=Disabled
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
# Profile Settings
......
......@@ -2195,7 +2195,7 @@ muc.room.occupants.role=Rol
muc.room.occupants.title=Ocupantes en el cuarto
muc.room.occupants.user=Usuario
index.cs_blog=Novedades de Ignite Realtime
index.cs_blog.unavailable=No se ha podido leer novedades de Ignite Realtime
index.cs_blog.unavilable=No se ha podido leer novedades de Ignite Realtime
system.clustering.disabled=Clustering fue deshabilitado exitosamente.
system.clustering.enabled=Clustering fue habilitado exitosamente.
system.clustering.enabled.legend=Clustering Habilitado
......@@ -2222,10 +2222,14 @@ system.clustering.overview.node=Nodos
system.clustering.overview.outgoing_servers=Servidores Salientes
system.clustering.title=Clustering
system.clustering.not-available=Clustering no esta disponible
system.clustering.using-embedded-db=Clustering no esta disponible cuando se utiliza la base de datos embebida. Necesita pasar a una base de datos externa para utilizar clustering.
system.clustering.using-embedded-db=Clustering no esta disponible cuando se utiliza la base de datos embebida. Necesita pasar a una base de datos externa para utilizar clustering.
system.clustering.not-installed=No se ha encontrado soporte para clustering en el sistema. Instale Openfire Corporativo para habilitarlo.
system.clustering.not-valid-license=La licencia de Openfire Corporativo no incluye clustering. Necesita actualizar su licencia para habilitar clustering.
system.clustering.starting=Clustering esta arrancando. Puede tardar hasta 30 segundos para completar. Haga clic {0}aqui{1} para refrescar.
setup.ldap.user.vcard.photo=Foto/Avatar
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
ports.flash_cross_domain=Flash Cross Domain
ports.flash_cross_domain.desc=Servicio que permite a clientes Flash connectarse a otros dominios y puertos.
\ No newline at end of file
......@@ -1738,4 +1738,8 @@ sidebar.muc-server-props.descr=
sidebar.muc-sysadmin.descr=
sidebar.muc-tasks.descr=
sidebar.muc-history.descr=
sidebar.muc-perms.descr=
\ No newline at end of file
sidebar.muc-perms.descr=
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -2325,3 +2325,7 @@ muc.room.occupants.user=\u30e6\u30fc\u30b6\u30fc
muc.room.occupants.nickname=\u30cb\u30c3\u30af\u30cd\u30fc\u30e0
muc.room.occupants.role=\u5f79\u5272
muc.room.occupants.affiliation=\u95a2\u4fc2
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -2127,4 +2127,8 @@ timezone.choose=Choose Time Zone
setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group profile settings
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
\ No newline at end of file
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -2096,4 +2096,8 @@ user.read_only=Not allowed: the user account system is read-only.
setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group profile settings
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
\ No newline at end of file
index.certificate-warning=Found RSA certificate that is not valid for the server domain.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -2130,4 +2130,8 @@ stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
setup.admin.settings.username-error=Nenhum usu\u00e1rio informado, ou o usu\u00e1rio informado n\u00e3o foi encontrado.
\ No newline at end of file
setup.admin.settings.username-error=Nenhum usu\u00e1rio informado, ou o usu\u00e1rio informado n\u00e3o foi encontrado.
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -1911,3 +1911,7 @@ stun.external.port = Port
stun.external.error = You must inform Server and Port.
stun.external.add = Add
stun.external.delete = Delete
httpbind.settings.script.label_enable=Enabled
httpbind.settings.script.label_enable_info=Allows BOSH Clients With Limited Access to Connect to the Server
httpbind.settings.script.label_disable=Disable
httpbind.settings.script.label_disable_info=Does not allow clients with limited access to connect to the server
\ No newline at end of file
......@@ -338,6 +338,37 @@ public final class HttpBindManager {
return JiveGlobals.getIntProperty(HTTP_BIND_SECURE_PORT, HTTP_BIND_SECURE_PORT_DEFAULT);
}
/**
* Returns true if script syntax is enabled. Script syntax allows BOSH to be used in
* environments where clients may be restricted to using a particular server. Instead of using
* standard HTTP Post requests to transmit data, HTTP Get requests are used.
*
* @return true if script syntax is enabled.
* @see <a href="http://www.xmpp.org/extensions/xep-0124.html#script">BOSH: Alternative Script
* Syntax</a>
*/
public boolean isScriptSyntaxEnabled() {
return JiveGlobals.getBooleanProperty("xmpp.httpbind.scriptSyntax.enabled", false);
}
/**
* Enables or disables script syntax.
*
* @param isEnabled true to enable script syntax and false to disable it.
* @see #isScriptSyntaxEnabled()
* @see <a href="http://www.xmpp.org/extensions/xep-0124.html#script">BOSH: Alternative Script
* Syntax</a>
*/
public void setScriptSyntaxEnabled(boolean isEnabled) {
final String property = "xmpp.httpbind.scriptSyntax.enabled";
if(!isEnabled) {
JiveGlobals.deleteProperty(property);
}
else {
JiveGlobals.setProperty(property, String.valueOf(isEnabled));
}
}
private void setUnsecureHttpBindPort(int value) {
if (value == bindPort) {
return;
......
......@@ -13,7 +13,6 @@ package org.jivesoftware.openfire.http;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlPullParserException;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.openfire.net.MXParser;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.dom4j.io.XMPPPacketReader;
......@@ -45,6 +44,7 @@ import java.net.URLDecoder;
*/
public class HttpBindServlet extends HttpServlet {
private HttpSessionManager sessionManager;
private HttpBindManager boshManager;
private static XmlPullParserFactory factory;
......@@ -66,7 +66,8 @@ public class HttpBindServlet extends HttpServlet {
@Override
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
sessionManager = HttpBindManager.getInstance().getSessionManager();
boshManager = HttpBindManager.getInstance();
sessionManager = boshManager.getSessionManager();
sessionManager.start();
}
......@@ -81,8 +82,8 @@ public class HttpBindServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
boolean isScriptSyntaxEnabled =
JiveGlobals.getBooleanProperty("xmpp.httpbind.scriptSyntax.enabled", false);
boolean isScriptSyntaxEnabled = boshManager.isScriptSyntaxEnabled();
if(!isScriptSyntaxEnabled) {
sendLegacyError(response, BoshBindingError.itemNotFound);
return;
......@@ -302,6 +303,7 @@ public class HttpBindServlet extends HttpServlet {
byte[] byteContent = content.getBytes("utf-8");
response.setContentLength(byteContent.length);
response.getOutputStream().write(byteContent);
response.getOutputStream().close();
}
private static String createEmptyBody() {
......
......@@ -20,10 +20,13 @@
Map<String, String> handleUpdate(HttpServletRequest request) {
Map<String, String> errorMap = new HashMap<String, String>();
boolean isEnabled = ParamUtils.getBooleanParameter(request, "httpBindEnabled");
boolean isEnabled = ParamUtils.getBooleanParameter(request, "httpBindEnabled",
serverManager.isHttpBindEnabled());
if (isEnabled) {
int requestedPort = ParamUtils.getIntParameter(request, "port", -1);
int requestedSecurePort = ParamUtils.getIntParameter(request, "securePort", -1);
int requestedPort = ParamUtils.getIntParameter(request, "port",
serverManager.getHttpBindUnsecurePort());
int requestedSecurePort = ParamUtils.getIntParameter(request, "securePort",
serverManager.getHttpBindSecurePort());
try {
serverManager.setHttpBindPorts(requestedPort, requestedSecurePort);
}
......@@ -31,6 +34,9 @@
Log.error("An error has occured configuring the HTTP binding ports", e);
errorMap.put("port", e.getMessage());
}
boolean isScriptSyntaxEnabled = ParamUtils.getBooleanParameter(request,
"scriptSyntaxEnabled", serverManager.isScriptSyntaxEnabled());
serverManager.setScriptSyntaxEnabled(isScriptSyntaxEnabled);
}
if (errorMap.size() <= 0) {
serverManager.setHttpBindEnabled(isEnabled);
......@@ -48,6 +54,7 @@
boolean isHttpBindEnabled = serverManager.isHttpBindEnabled();
int port = serverManager.getHttpBindUnsecurePort();
int securePort = serverManager.getHttpBindSecurePort();
boolean isScriptSyntaxEnabled = serverManager.isScriptSyntaxEnabled();
%>
<html>
<head>
......@@ -60,6 +67,8 @@
var setEnabled = function() {
$("port").disabled = !enabled
$("securePort").disabled = !enabled;
$("rb03").disabled = !enabled
$("rb04").disabled = !enabled
}
window.onload = setTimeout("setEnabled()", 500);
</script>
......@@ -142,6 +151,35 @@
</tbody>
</table>
</div>
<div class="jive-contentBoxHeader">Script Syntax</div>
<div class="jive-contentbox">
<table cellpadding="3" cellspacing="0" border="0">
<tbody>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="scriptSyntaxEnabled" value="true" id="rb03"
<%= (isScriptSyntaxEnabled ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb03">
<b><fmt:message key="httpbind.settings.script.label_enable" /></b> - <fmt:message key="httpbind.settings.script.label_enable_info" />
</label>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="scriptSyntaxEnabled" value="false" id="rb04"
<%= (!isScriptSyntaxEnabled ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb04">
<b><fmt:message key="httpbind.settings.script.label_disable" /></b> - <fmt:message key="httpbind.settings.script.label_disable_info" />
</label>
</td>
</tr>
</tbody>
</table>
</div>
<input type="submit" id="settingsUpdate" name="update"
value="<fmt:message key="global.save_settings" />">
</form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment