String cometdURLMapping = (String)getOption(COMETD_URL_MAPPING);
if (cometdURLMapping == null)
throw new IllegalArgumentException("Missing '" + COMETD_URL_MAPPING + "' parameter");
WebSocketUpgradeFilter wsFilter = (WebSocketUpgradeFilter)context.getAttribute(WebSocketUpgradeFilter.class.getName());
if (wsFilter == null)
throw new IllegalArgumentException("Missing WebSocketUpgradeFilter");
WebSocketPolicy policy = wsFilter.getFactory().getPolicy();
int bufferSize = getOption(BUFFER_SIZE_OPTION, policy.getInputBufferSize());
policy.setInputBufferSize(bufferSize);
int maxMessageSize = getOption(MAX_MESSAGE_SIZE_OPTION, policy.getMaxTextMessageSize());
policy.setMaxTextMessageSize(maxMessageSize);
long idleTimeout = getOption(IDLE_TIMEOUT_OPTION, policy.getIdleTimeout());
policy.setIdleTimeout((int)idleTimeout);
for (String mapping : normalizeURLMapping(cometdURLMapping))
{
wsFilter.addMapping(new ServletPathSpec(mapping), new WebSocketCreator()
{
@Override
public Object createWebSocket(ServletUpgradeRequest request, ServletUpgradeResponse response)
{
String origin = request.getHeader("Origin");