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
...@@ -2134,3 +2134,7 @@ stun.external.add = Add ...@@ -2134,3 +2134,7 @@ stun.external.add = Add
stun.external.delete = Delete stun.external.delete = Delete
index.certificate-warning=Found RSA certificate that is not valid for the server domain. 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
...@@ -2117,3 +2117,7 @@ setup.sidebar.profile=Profile Settings ...@@ -2117,3 +2117,7 @@ setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group 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. 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 @@ ...@@ -240,6 +240,10 @@
## Added key: 'user.roster.filter.noshared' ## Added key: 'user.roster.filter.noshared'
## Added key: 'user.roster.filter.onlyshared' ## Added key: 'user.roster.filter.onlyshared'
## Added key: 'setup.ldap.user.vcard.photo' ## 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 # Openfire
...@@ -2328,6 +2332,10 @@ httpbind.settings.label_same_info=The HTTP bind service will use distinct ports ...@@ -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.secure_port=SSL Port:
httpbind.settings.error.general=An error has occured, check the log file for details. 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.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 # Profile Settings
......
...@@ -2195,7 +2195,7 @@ muc.room.occupants.role=Rol ...@@ -2195,7 +2195,7 @@ muc.room.occupants.role=Rol
muc.room.occupants.title=Ocupantes en el cuarto muc.room.occupants.title=Ocupantes en el cuarto
muc.room.occupants.user=Usuario muc.room.occupants.user=Usuario
index.cs_blog=Novedades de Ignite Realtime 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.disabled=Clustering fue deshabilitado exitosamente.
system.clustering.enabled=Clustering fue habilitado exitosamente. system.clustering.enabled=Clustering fue habilitado exitosamente.
system.clustering.enabled.legend=Clustering Habilitado system.clustering.enabled.legend=Clustering Habilitado
...@@ -2227,5 +2227,9 @@ system.clustering.not-installed=No se ha encontrado soporte para clustering en e ...@@ -2227,5 +2227,9 @@ system.clustering.not-installed=No se ha encontrado soporte para clustering en e
system.clustering.not-valid-license=La licencia de Openfire Corporativo no incluye clustering. Necesita actualizar su licencia para habilitar clustering. 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. 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 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=Flash Cross Domain
ports.flash_cross_domain.desc=Servicio que permite a clientes Flash connectarse a otros dominios y puertos. ports.flash_cross_domain.desc=Servicio que permite a clientes Flash connectarse a otros dominios y puertos.
\ No newline at end of file
...@@ -1739,3 +1739,7 @@ sidebar.muc-sysadmin.descr= ...@@ -1739,3 +1739,7 @@ sidebar.muc-sysadmin.descr=
sidebar.muc-tasks.descr= sidebar.muc-tasks.descr=
sidebar.muc-history.descr= sidebar.muc-history.descr=
sidebar.muc-perms.descr= 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 ...@@ -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.nickname=\u30cb\u30c3\u30af\u30cd\u30fc\u30e0
muc.room.occupants.role=\u5f79\u5272 muc.room.occupants.role=\u5f79\u5272
muc.room.occupants.affiliation=\u95a2\u4fc2 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
...@@ -2128,3 +2128,7 @@ setup.sidebar.profile=Profile Settings ...@@ -2128,3 +2128,7 @@ setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group 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. 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
...@@ -2097,3 +2097,7 @@ setup.sidebar.profile=Profile Settings ...@@ -2097,3 +2097,7 @@ setup.sidebar.profile=Profile Settings
sidebar.profile-settings=Profile Settings sidebar.profile-settings=Profile Settings
sidebar.profile-settings.descr=Click to configure user and group 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. 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
...@@ -2131,3 +2131,7 @@ stun.external.add = Add ...@@ -2131,3 +2131,7 @@ stun.external.add = Add
stun.external.delete = Delete stun.external.delete = Delete
setup.admin.settings.username-error=Nenhum usu\u00e1rio informado, ou o usu\u00e1rio informado n\u00e3o foi encontrado. 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 ...@@ -1911,3 +1911,7 @@ stun.external.port = Port
stun.external.error = You must inform Server and Port. stun.external.error = You must inform Server and Port.
stun.external.add = Add stun.external.add = Add
stun.external.delete = Delete 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 { ...@@ -338,6 +338,37 @@ public final class HttpBindManager {
return JiveGlobals.getIntProperty(HTTP_BIND_SECURE_PORT, HTTP_BIND_SECURE_PORT_DEFAULT); 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) { private void setUnsecureHttpBindPort(int value) {
if (value == bindPort) { if (value == bindPort) {
return; return;
......
...@@ -13,7 +13,6 @@ package org.jivesoftware.openfire.http; ...@@ -13,7 +13,6 @@ package org.jivesoftware.openfire.http;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.openfire.net.MXParser; import org.jivesoftware.openfire.net.MXParser;
import org.jivesoftware.openfire.auth.UnauthorizedException; import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.dom4j.io.XMPPPacketReader; import org.dom4j.io.XMPPPacketReader;
...@@ -45,6 +44,7 @@ import java.net.URLDecoder; ...@@ -45,6 +44,7 @@ import java.net.URLDecoder;
*/ */
public class HttpBindServlet extends HttpServlet { public class HttpBindServlet extends HttpServlet {
private HttpSessionManager sessionManager; private HttpSessionManager sessionManager;
private HttpBindManager boshManager;
private static XmlPullParserFactory factory; private static XmlPullParserFactory factory;
...@@ -66,7 +66,8 @@ public class HttpBindServlet extends HttpServlet { ...@@ -66,7 +66,8 @@ public class HttpBindServlet extends HttpServlet {
@Override @Override
public void init(ServletConfig servletConfig) throws ServletException { public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig); super.init(servletConfig);
sessionManager = HttpBindManager.getInstance().getSessionManager(); boshManager = HttpBindManager.getInstance();
sessionManager = boshManager.getSessionManager();
sessionManager.start(); sessionManager.start();
} }
...@@ -81,8 +82,8 @@ public class HttpBindServlet extends HttpServlet { ...@@ -81,8 +82,8 @@ public class HttpBindServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException throws ServletException, IOException
{ {
boolean isScriptSyntaxEnabled = boolean isScriptSyntaxEnabled = boshManager.isScriptSyntaxEnabled();
JiveGlobals.getBooleanProperty("xmpp.httpbind.scriptSyntax.enabled", false);
if(!isScriptSyntaxEnabled) { if(!isScriptSyntaxEnabled) {
sendLegacyError(response, BoshBindingError.itemNotFound); sendLegacyError(response, BoshBindingError.itemNotFound);
return; return;
...@@ -302,6 +303,7 @@ public class HttpBindServlet extends HttpServlet { ...@@ -302,6 +303,7 @@ public class HttpBindServlet extends HttpServlet {
byte[] byteContent = content.getBytes("utf-8"); byte[] byteContent = content.getBytes("utf-8");
response.setContentLength(byteContent.length); response.setContentLength(byteContent.length);
response.getOutputStream().write(byteContent); response.getOutputStream().write(byteContent);
response.getOutputStream().close();
} }
private static String createEmptyBody() { private static String createEmptyBody() {
......
...@@ -20,10 +20,13 @@ ...@@ -20,10 +20,13 @@
Map<String, String> handleUpdate(HttpServletRequest request) { Map<String, String> handleUpdate(HttpServletRequest request) {
Map<String, String> errorMap = new HashMap<String, String>(); Map<String, String> errorMap = new HashMap<String, String>();
boolean isEnabled = ParamUtils.getBooleanParameter(request, "httpBindEnabled"); boolean isEnabled = ParamUtils.getBooleanParameter(request, "httpBindEnabled",
serverManager.isHttpBindEnabled());
if (isEnabled) { if (isEnabled) {
int requestedPort = ParamUtils.getIntParameter(request, "port", -1); int requestedPort = ParamUtils.getIntParameter(request, "port",
int requestedSecurePort = ParamUtils.getIntParameter(request, "securePort", -1); serverManager.getHttpBindUnsecurePort());
int requestedSecurePort = ParamUtils.getIntParameter(request, "securePort",
serverManager.getHttpBindSecurePort());
try { try {
serverManager.setHttpBindPorts(requestedPort, requestedSecurePort); serverManager.setHttpBindPorts(requestedPort, requestedSecurePort);
} }
...@@ -31,6 +34,9 @@ ...@@ -31,6 +34,9 @@
Log.error("An error has occured configuring the HTTP binding ports", e); Log.error("An error has occured configuring the HTTP binding ports", e);
errorMap.put("port", e.getMessage()); errorMap.put("port", e.getMessage());
} }
boolean isScriptSyntaxEnabled = ParamUtils.getBooleanParameter(request,
"scriptSyntaxEnabled", serverManager.isScriptSyntaxEnabled());
serverManager.setScriptSyntaxEnabled(isScriptSyntaxEnabled);
} }
if (errorMap.size() <= 0) { if (errorMap.size() <= 0) {
serverManager.setHttpBindEnabled(isEnabled); serverManager.setHttpBindEnabled(isEnabled);
...@@ -48,6 +54,7 @@ ...@@ -48,6 +54,7 @@
boolean isHttpBindEnabled = serverManager.isHttpBindEnabled(); boolean isHttpBindEnabled = serverManager.isHttpBindEnabled();
int port = serverManager.getHttpBindUnsecurePort(); int port = serverManager.getHttpBindUnsecurePort();
int securePort = serverManager.getHttpBindSecurePort(); int securePort = serverManager.getHttpBindSecurePort();
boolean isScriptSyntaxEnabled = serverManager.isScriptSyntaxEnabled();
%> %>
<html> <html>
<head> <head>
...@@ -60,6 +67,8 @@ ...@@ -60,6 +67,8 @@
var setEnabled = function() { var setEnabled = function() {
$("port").disabled = !enabled $("port").disabled = !enabled
$("securePort").disabled = !enabled; $("securePort").disabled = !enabled;
$("rb03").disabled = !enabled
$("rb04").disabled = !enabled
} }
window.onload = setTimeout("setEnabled()", 500); window.onload = setTimeout("setEnabled()", 500);
</script> </script>
...@@ -142,6 +151,35 @@ ...@@ -142,6 +151,35 @@
</tbody> </tbody>
</table> </table>
</div> </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" <input type="submit" id="settingsUpdate" name="update"
value="<fmt:message key="global.save_settings" />"> value="<fmt:message key="global.save_settings" />">
</form> </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