com.signalfx.shaded.jetty.websocket.common.extensions.identity.IdentityExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signalfx-codahale Show documentation
Show all versions of signalfx-codahale Show documentation
Dropwizard Codahale metrics plugin for signalfx
The newest version!
//
// ========================================================================
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package com.signalfx.shaded.jetty.websocket.common.extensions.identity;
import com.signalfx.shaded.jetty.util.QuotedStringTokenizer;
import com.signalfx.shaded.jetty.util.annotation.ManagedObject;
import com.signalfx.shaded.jetty.websocket.api.BatchMode;
import com.signalfx.shaded.jetty.websocket.api.WriteCallback;
import com.signalfx.shaded.jetty.websocket.api.extensions.ExtensionConfig;
import com.signalfx.shaded.jetty.websocket.api.extensions.Frame;
import com.signalfx.shaded.jetty.websocket.common.extensions.AbstractExtension;
@ManagedObject("Identity Extension")
public class IdentityExtension extends AbstractExtension
{
private String id;
public String getParam(String key)
{
return getConfig().getParameter(key, "?");
}
@Override
public String getName()
{
return "identity";
}
@Override
public void incomingFrame(Frame frame)
{
// pass through
nextIncomingFrame(frame);
}
@Override
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
{
// pass through
nextOutgoingFrame(frame, callback, batchMode);
}
@Override
public void setConfig(ExtensionConfig config)
{
super.setConfig(config);
StringBuilder s = new StringBuilder();
s.append(config.getName());
s.append("@").append(Integer.toHexString(hashCode()));
s.append("[");
boolean delim = false;
for (String param : config.getParameterKeys())
{
if (delim)
{
s.append(';');
}
s.append(param).append('=').append(QuotedStringTokenizer.quoteIfNeeded(config.getParameter(param, ""), ";="));
delim = true;
}
s.append("]");
id = s.toString();
}
@Override
public String toString()
{
return id;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy