https://issues.apache.org/jira/browse/AMQ-3980 - websockets increase max size of text message

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1374226 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-08-17 12:44:42 +00:00
parent faa8d79b82
commit c6f9db8bfc
1 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import org.apache.activemq.transport.SocketConnectorFactory;
import org.apache.activemq.transport.TransportServerSupport; import org.apache.activemq.transport.TransportServerSupport;
import org.apache.activemq.transport.WebTransportServerSupport; import org.apache.activemq.transport.WebTransportServerSupport;
import org.apache.activemq.util.InetAddressUtil; import org.apache.activemq.util.InetAddressUtil;
import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.ServiceStopper; import org.apache.activemq.util.ServiceStopper;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
@ -40,6 +41,8 @@ import java.util.Map;
*/ */
public class WSTransportServer extends WebTransportServerSupport { public class WSTransportServer extends WebTransportServerSupport {
int maxTextMessageSize = -1;
public WSTransportServer(URI location) { public WSTransportServer(URI location) {
super(location); super(location);
this.bindAddress = location; this.bindAddress = location;
@ -61,6 +64,9 @@ public class WSTransportServer extends WebTransportServerSupport {
new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY); new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY);
ServletHolder holder = new ServletHolder(); ServletHolder holder = new ServletHolder();
if (maxTextMessageSize != -1) {
holder.setInitParameter("maxTextMessageSize", String.valueOf(maxTextMessageSize));
}
holder.setServlet(new StompServlet()); holder.setServlet(new StompServlet());
contextHandler.addServlet(holder, "/"); contextHandler.addServlet(holder, "/");
@ -91,8 +97,16 @@ public class WSTransportServer extends WebTransportServerSupport {
@Override @Override
public void setTransportOption(Map<String, Object> transportOptions) { public void setTransportOption(Map<String, Object> transportOptions) {
IntrospectionSupport.setProperties(this, transportOptions);
socketConnectorFactory.setTransportOptions(transportOptions); socketConnectorFactory.setTransportOptions(transportOptions);
super.setTransportOption(transportOptions); super.setTransportOption(transportOptions);
} }
public int getMaxTextMessageSize() {
return maxTextMessageSize;
}
public void setMaxTextMessageSize(int maxTextMessageSize) {
this.maxTextMessageSize = maxTextMessageSize;
}
} }