Index: core/src/main/java/org/icefaces/impl/event/BridgeSetup.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/src/main/java/org/icefaces/impl/event/BridgeSetup.java (revision 40796) +++ core/src/main/java/org/icefaces/impl/event/BridgeSetup.java (revision ) @@ -218,6 +218,7 @@ writer.write("ice.push.configuration.notifyURI=\"" + notifyResource.getRequestPath() + "\";"); writer.write("ice.push.configuration.addGroupMemberURI=\"" + addGroupMemberResource.getRequestPath() + "\";"); writer.write("ice.push.configuration.removeGroupMemberURI=\"" + removeGroupMemberResource.getRequestPath() + "\";"); + writer.write("ice.push.configuration.parameterPrefix=\"" + context.getViewRoot().getContainerClientId(context) + "\";"); boolean isAuxUpload = EnvUtils.isAuxUploadBrowser(context); if (isAuxUpload) { Index: icepush/core/src/main/java/org/icepush/servlet/MainServlet.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- icepush/core/src/main/java/org/icepush/servlet/MainServlet.java (revision 40796) +++ icepush/core/src/main/java/org/icepush/servlet/MainServlet.java (revision ) @@ -31,17 +31,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.icepush.CheckBrowserIDServlet; -import org.icepush.CodeServer; -import org.icepush.Configuration; -import org.icepush.NotificationProvider; -import org.icepush.OutOfBandNotifier; -import org.icepush.ProductInfo; -import org.icepush.PushContext; -import org.icepush.PushGroupManager; -import org.icepush.PushGroupManagerFactory; -import org.icepush.PushInternalContext; -import org.icepush.PushNotification; +import org.icepush.*; import org.icepush.http.standard.CacheControlledServer; import org.icepush.http.standard.CompressingServer; import org.icepush.util.ExtensionRegistry; @@ -129,13 +119,13 @@ } protected PseudoServlet createBrowserDispatcher() { - return + return new RemoveParameterPrefix( - new CheckBrowserIDServlet( + new CheckBrowserIDServlet( new BrowserDispatcher(configuration) { protected PseudoServlet newServer(final String browserID) { return createBrowserBoundServlet(browserID); } - }); + })); } protected void createOutOfBandNotifier(final ServletContext servletContext) { Index: icepush/core/src/main/java/org/icepush/RemoveParameterPrefix.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- icepush/core/src/main/java/org/icepush/RemoveParameterPrefix.java (revision ) +++ icepush/core/src/main/java/org/icepush/RemoveParameterPrefix.java (revision ) @@ -0,0 +1,94 @@ +/* + * Copyright 2004-2014 ICEsoft Technologies Canada Corp. + * + * 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. + */ + +package org.icepush; + +import org.icepush.http.Server; +import org.icepush.servlet.PseudoServlet; + +import javax.servlet.*; +import javax.servlet.http.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.*; + +public class RemoveParameterPrefix implements PseudoServlet { + public static final String ORG_ICEPUSH_PARAMETER_PREFIX = "org.icepush.parameterPrefix"; + private PseudoServlet servlet; + + public RemoveParameterPrefix(PseudoServlet servlet) { + this.servlet = servlet; + } + + public void service(HttpServletRequest request, HttpServletResponse response) throws Exception { + final String parameterPrefix = extractParameterPrefix(request); + + servlet.service(new HttpServletRequestWrapper(request) { + public String getParameter(String name) { + return super.getParameter(parameterPrefix + name); + } + + public Map getParameterMap() { + Map result = new HashMap(); + int length = parameterPrefix.length(); + Iterator entries = super.getParameterMap().entrySet().iterator(); + while (entries.hasNext()) { + Map.Entry next = (Map.Entry) entries.next(); + String name = next.getKey(); + String originalParameterName = name.substring(0, length); + result.put(originalParameterName, next.getValue()); + } + return result; + } + + public Enumeration getParameterNames() { + ArrayList result = new ArrayList(); + int length = parameterPrefix.length(); + Enumeration entries = super.getParameterNames(); + while (entries.hasMoreElements()) { + String name = (String) entries.nextElement(); + String originalParameterName = name.substring(0, length); + result.add(originalParameterName); + } + return Collections.enumeration(result); + } + + public String[] getParameterValues(String name) { + return super.getParameterValues(parameterPrefix + name); + } + }, response); + } + + public void shutdown() { + servlet.shutdown(); + } + + private String extractParameterPrefix(HttpServletRequest request) { + Enumeration e = request.getParameterNames(); + String parameterPrefix = ""; + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + if (name.contains("ice.push.browser")) { + parameterPrefix = name.substring(0, name.indexOf("ice.push.browser")); + break; + } + } + + return parameterPrefix; + } +} Index: icepush/core/src/main/javascript/connection.async.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- icepush/core/src/main/javascript/connection.async.js (revision 40796) +++ icepush/core/src/main/javascript/connection.async.js (revision ) @@ -106,7 +106,7 @@ function askForConfiguration(query) { //request configuration once, but only after ice.push.browser cookie is set if (getValue(browserID)) { - addNameValue(query, 'ice.sendConfiguration', ''); + parameter(query, 'ice.sendConfiguration', ''); askForConfiguration = noop; } } @@ -125,12 +125,12 @@ debug(logger, 'connect...'); var uri = resolveURI(namespace.push.configuration.blockingConnectionURI); listener = postAsynchronously(channel, uri, function(q) { - addNameValue(q, BrowserIDName, getValue(browserID)); - addNameValue(q, APIKey, ice.push.configuration.apikey); - addNameValue(q, AccessToken, ice.push.configuration.access_token); - addNameValue(q, Realm, ice.push.configuration.realm); - addNameValue(q, HeartbeatInterval, heartbeatTimeout - NetworkDelay); - each(lastSentPushIds, curry(addNameValue, q, 'ice.pushid')); + parameter(q, BrowserIDName, getValue(browserID)); + parameter(q, APIKey, ice.push.configuration.apikey); + parameter(q, AccessToken, ice.push.configuration.access_token); + parameter(q, Realm, ice.push.configuration.realm); + parameter(q, HeartbeatInterval, heartbeatTimeout - NetworkDelay); + each(lastSentPushIds, curry(parameter, q, 'ice.pushid')); askForConfiguration(q); }, function(request) { FormPost(request); @@ -455,8 +455,8 @@ if (paused) { var uri = resolveURI(namespace.push.configuration.blockingConnectionURI); postAsynchronously(channel, uri, function(q) { - each(lastSentPushIds, curry(addNameValue, q, 'ice.pushid')); - parameterCallback(curry(addNameValue, q)); + each(lastSentPushIds, curry(parameter, q, 'ice.pushid')); + parameterCallback(curry(parameter, q)); }, function(request) { FormPost(request); setHeader(request, 'ice.push.window', namespace.windowID); Index: core/src/main/java/org/icefaces/impl/context/DOMResponseWriter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/src/main/java/org/icefaces/impl/context/DOMResponseWriter.java (revision 40796) +++ core/src/main/java/org/icefaces/impl/context/DOMResponseWriter.java (revision ) @@ -655,7 +655,7 @@ public void write(String str) throws IOException { if (EnvUtils.getStateMarker().equals(str) ) { FacesContext fc = FacesContext.getCurrentInstance(); - out.write(""); } else { Index: icepush/core/src/main/javascript/application.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- icepush/core/src/main/javascript/application.js (revision 40796) +++ icepush/core/src/main/javascript/application.js (revision ) @@ -177,6 +177,14 @@ setValue(browserID, message.getAttribute('id')); }); + function parameter(query, name, value) { + var prefix = namespace.push.configuration.parameterPrefix; + if (prefix) { + name = prefix + name; + } + addNameValue(query, name, value); + } + var currentNotifications = []; var apiChannel = Client(true); //public API @@ -210,10 +218,10 @@ var id; var uri = resolveURI(namespace.push.configuration.createPushIdURI || 'create-push-id.icepush'); postSynchronously(apiChannel, uri, function (query) { - addNameValue(query, BrowserIDName, getValue(browserID)); - addNameValue(query, APIKey, ice.push.configuration.apikey); - addNameValue(query, AccessToken, ice.push.configuration.access_token); - addNameValue(query, Realm, ice.push.configuration.realm); + parameter(query, BrowserIDName, getValue(browserID)); + parameter(query, APIKey, ice.push.configuration.apikey); + parameter(query, AccessToken, ice.push.configuration.access_token); + parameter(query, Realm, ice.push.configuration.realm); }, FormPost, $witch(function (condition) { condition(OK, function(response) { if (isXMLResponse(response)) { @@ -236,11 +244,11 @@ notify: function(group, options) { var uri = resolveURI(namespace.push.configuration.notifyURI || 'notify.icepush'); postAsynchronously(apiChannel, uri, function(q) { - addNameValue(q, BrowserIDName, getValue(browserID)); - addNameValue(q, APIKey, ice.push.configuration.apikey); - addNameValue(q, AccessToken, ice.push.configuration.access_token); - addNameValue(q, Realm, ice.push.configuration.realm); - addNameValue(q, 'group', group); + parameter(q, BrowserIDName, getValue(browserID)); + parameter(q, APIKey, ice.push.configuration.apikey); + parameter(q, AccessToken, ice.push.configuration.access_token); + parameter(q, Realm, ice.push.configuration.realm); + parameter(q, 'group', group); if (options) { //provide default values if missing if (!options.duration) { @@ -253,13 +261,13 @@ if (options.hasOwnProperty(name)) { var value = options[name]; if (name == 'delay') { - addNameValue(q, 'delay', value); + parameter(q, 'delay', value); } else if (name == 'at') { - addNameValue(q, 'at', value); + parameter(q, 'at', value); } else if (name == 'duration') { - addNameValue(q, 'duration', value); + parameter(q, 'duration', value); } else { - addNameValue(q, 'option', name + '=' + value); + parameter(q, 'option', name + '=' + value); } } } @@ -272,12 +280,12 @@ addGroupMember: function(group, id) { var uri = resolveURI(namespace.push.configuration.addGroupMemberURI || 'add-group-member.icepush'); postAsynchronously(apiChannel, uri, function(q) { - addNameValue(q, BrowserIDName, getValue(browserID)); - addNameValue(q, APIKey, ice.push.configuration.apikey); - addNameValue(q, AccessToken, ice.push.configuration.access_token); - addNameValue(q, Realm, ice.push.configuration.realm); - addNameValue(q, 'group', group); - addNameValue(q, 'id', id); + parameter(q, BrowserIDName, getValue(browserID)); + parameter(q, APIKey, ice.push.configuration.apikey); + parameter(q, AccessToken, ice.push.configuration.access_token); + parameter(q, Realm, ice.push.configuration.realm); + parameter(q, 'group', group); + parameter(q, 'id', id); }, FormPost, $witch(function(condition) { condition(ServerInternalError, throwServerError); })); @@ -286,12 +294,12 @@ removeGroupMember: function(group, id) { var uri = resolveURI(namespace.push.configuration.removeGroupMemberURI || 'remove-group-member.icepush'); postAsynchronously(apiChannel, uri, function(q) { - addNameValue(q, BrowserIDName, getValue(browserID)); - addNameValue(q, APIKey, ice.push.configuration.apikey); - addNameValue(q, AccessToken, ice.push.configuration.access_token); - addNameValue(q, Realm, ice.push.configuration.realm); - addNameValue(q, 'group', group); - addNameValue(q, 'id', id); + parameter(q, BrowserIDName, getValue(browserID)); + parameter(q, APIKey, ice.push.configuration.apikey); + parameter(q, AccessToken, ice.push.configuration.access_token); + parameter(q, Realm, ice.push.configuration.realm); + parameter(q, 'group', group); + parameter(q, 'id', id); }, FormPost, $witch(function(condition) { condition(ServerInternalError, throwServerError); })); @@ -299,11 +307,11 @@ get: function(uri, parameters, responseCallback) { getAsynchronously(apiChannel, uri, function(query) { - addNameValue(query, BrowserIDName, getValue(browserID)); - addNameValue(query, APIKey, ice.push.configuration.apikey); - addNameValue(query, AccessToken, ice.push.configuration.access_token); - addNameValue(query, Realm, ice.push.configuration.realm); - parameters(curry(addNameValue, query)); + parameter(query, BrowserIDName, getValue(browserID)); + parameter(query, APIKey, ice.push.configuration.apikey); + parameter(query, AccessToken, ice.push.configuration.access_token); + parameter(query, Realm, ice.push.configuration.realm); + parameters(curry(parameter, query)); }, noop, $witch(function(condition) { condition(OK, function(response) { responseCallback(statusCode(response), contentAsText(response), contentAsDOM(response)); @@ -314,11 +322,11 @@ post: function(uri, parameters, responseCallback) { postAsynchronously(apiChannel, uri, function(query) { - addNameValue(query, BrowserIDName, getValue(browserID)); - addNameValue(query, APIKey, ice.push.configuration.apikey); - addNameValue(query, AccessToken, ice.push.configuration.access_token); - addNameValue(query, Realm, ice.push.configuration.realm); - parameters(curry(addNameValue, query)); + parameter(query, BrowserIDName, getValue(browserID)); + parameter(query, APIKey, ice.push.configuration.apikey); + parameter(query, AccessToken, ice.push.configuration.access_token); + parameter(query, Realm, ice.push.configuration.realm); + parameters(curry(parameter, query)); }, FormPost, $witch(function(condition) { condition(OK, function(response) { responseCallback(statusCode(response), contentAsText(response), contentAsDOM(response));