Extension interface now uses CoreSession and not Configuration
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
bc88224f19
commit
64d72abde6
|
@ -168,9 +168,9 @@ public class AbstractExtension implements Extension
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration(Configuration configuration)
|
||||
public void setCoreSession(CoreSession coreSession)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.configuration = coreSession;
|
||||
}
|
||||
|
||||
protected Configuration getConfiguration()
|
||||
|
|
|
@ -86,7 +86,8 @@ public interface Extension extends IncomingFrames, OutgoingFrames
|
|||
void setNextOutgoingFrames(OutgoingFrames nextOutgoing);
|
||||
|
||||
/**
|
||||
* Set the {@link Configuration} for this Extension.
|
||||
* Set the {@link CoreSession} for this Extension.
|
||||
* @param coreSession
|
||||
*/
|
||||
void setConfiguration(Configuration configuration);
|
||||
void setCoreSession(CoreSession coreSession);
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable
|
|||
|
||||
for (Extension extension : extensions)
|
||||
{
|
||||
extension.setConfiguration(coreSession);
|
||||
extension.setCoreSession(coreSession);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.eclipse.jetty.util.Callback;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.websocket.core.AbstractExtension;
|
||||
import org.eclipse.jetty.websocket.core.Configuration;
|
||||
import org.eclipse.jetty.websocket.core.CoreSession;
|
||||
import org.eclipse.jetty.websocket.core.ExtensionConfig;
|
||||
import org.eclipse.jetty.websocket.core.Frame;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
|
@ -55,13 +55,14 @@ public class ValidationExtension extends AbstractExtension
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration(Configuration configuration)
|
||||
public void setCoreSession(CoreSession coreSession)
|
||||
{
|
||||
super.setConfiguration(configuration);
|
||||
super.setCoreSession(coreSession);
|
||||
|
||||
if (!(configuration instanceof WebSocketCoreSession))
|
||||
// TODO: change validation to use static methods instead of down casting CoreSession.
|
||||
if (!(coreSession instanceof WebSocketCoreSession))
|
||||
throw new IllegalArgumentException("ValidationExtension needs a CoreSession Configuration");
|
||||
coreSession = (WebSocketCoreSession)configuration;
|
||||
this.coreSession = (WebSocketCoreSession)coreSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ExtensionTool
|
|||
{
|
||||
this.ext = components.getExtensionRegistry().newInstance(extConfig, components);
|
||||
this.ext.setNextIncomingFrames(capture);
|
||||
this.ext.setConfiguration(newWebSocketCoreSession());
|
||||
this.ext.setCoreSession(newWebSocketCoreSession());
|
||||
}
|
||||
|
||||
public void parseIncomingHex(String... rawhex)
|
||||
|
|
|
@ -376,7 +376,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
|
|||
PerMessageDeflateExtension ext = new PerMessageDeflateExtension();
|
||||
ExtensionConfig config = ExtensionConfig.parse("permessage-deflate");
|
||||
ext.init(config, components);
|
||||
ext.setConfiguration(newSession());
|
||||
ext.setCoreSession(newSession());
|
||||
|
||||
// Setup capture of incoming frames
|
||||
IncomingFramesCapture capture = new IncomingFramesCapture();
|
||||
|
@ -450,7 +450,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
|
|||
{
|
||||
PerMessageDeflateExtension ext = new PerMessageDeflateExtension();
|
||||
ext.init(ExtensionConfig.parse("permessage-deflate"), components);
|
||||
ext.setConfiguration(newSession());
|
||||
ext.setCoreSession(newSession());
|
||||
|
||||
// Setup capture of outgoing frames
|
||||
OutgoingFramesCapture capture = new OutgoingFramesCapture();
|
||||
|
@ -497,7 +497,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest
|
|||
PerMessageDeflateExtension ext = new PerMessageDeflateExtension();
|
||||
ExtensionConfig config = ExtensionConfig.parse("permessage-deflate");
|
||||
ext.init(config, components);
|
||||
ext.setConfiguration(newSession());
|
||||
ext.setCoreSession(newSession());
|
||||
|
||||
// Setup capture of incoming frames
|
||||
OutgoingFramesCapture capture = new OutgoingFramesCapture();
|
||||
|
|
Loading…
Reference in New Issue