Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-11-03 07:22:09 +0000
committerGreg Wilkins2013-11-03 07:22:09 +0000
commiteb3bb660b52b6eaa146b4fa77afd8fd1f63e6bba (patch)
tree6d501857bbc82c9240ba1cd603f981797349b3d5 /jetty-websocket
parent6f1eb712e9bb3341d257a75511ebc8e73e0faca0 (diff)
parent6b0269a16d7ee923ae70082eb60595d432861707 (diff)
downloadorg.eclipse.jetty.project-eb3bb660b52b6eaa146b4fa77afd8fd1f63e6bba.tar.gz
org.eclipse.jetty.project-eb3bb660b52b6eaa146b4fa77afd8fd1f63e6bba.tar.xz
org.eclipse.jetty.project-eb3bb660b52b6eaa146b4fa77afd8fd1f63e6bba.zip
Merge remote-tracking branch 'origin/master' into jetty-9.1
Conflicts: jetty-client/src/main/java/org/eclipse/jetty/client/util/DigestAuthentication.java jetty-client/src/test/java/org/eclipse/jetty/client/HttpReceiverTest.java jetty-client/src/test/java/org/eclipse/jetty/client/HttpSenderTest.java jetty-http/src/main/java/org/eclipse/jetty/http/HttpField.java jetty-server/src/test/java/org/eclipse/jetty/server/AbstractHttpTest.java jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AbstractDoSFilterTest.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/HeadersBlockParser.java jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateCompressionMethodTest.java jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java
Diffstat (limited to 'jetty-websocket')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/io/WebSocketWriter.java2
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java3
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java3
-rw-r--r--jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java3
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java17
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java1
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java1
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java3
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java13
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java5
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java7
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/IdentityExtensionTest.java5
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java3
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java9
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java7
-rw-r--r--jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java3
-rw-r--r--jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java3
-rw-r--r--jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java3
-rw-r--r--jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/blockhead/BlockheadClient.java3
-rw-r--r--jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java5
20 files changed, 52 insertions, 47 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/io/WebSocketWriter.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/io/WebSocketWriter.java
index abd194d24f..43db5aaee6 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/io/WebSocketWriter.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/io/WebSocketWriter.java
@@ -20,13 +20,11 @@ package org.eclipse.jetty.websocket.api.io;
import java.io.IOException;
import java.io.Writer;
-import java.nio.charset.Charset;
import org.eclipse.jetty.websocket.api.Session;
public class WebSocketWriter extends Writer
{
- private final Charset charset = Charset.forName("UTF-8");
private final Session session;
public WebSocketWriter(Session session)
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java
index 6e5096cfb9..5885586966 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/ClientUpgradeRequest.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.client;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -223,7 +224,7 @@ public class ClientUpgradeRequest extends UpgradeRequest
if (StringUtil.isNotBlank(query))
{
MultiMap<String> params = new MultiMap<String>();
- UrlEncoded.decodeTo(uri.getQuery(),params,"UTF-8",MAX_KEYS);
+ UrlEncoded.decodeTo(uri.getQuery(),params,StandardCharsets.UTF_8,MAX_KEYS);
for (String key : params.keySet())
{
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
index eeea82a4f8..488e58f2c8 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.client.io;
import java.io.IOException;
import java.net.URI;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
@@ -70,7 +71,7 @@ public class UpgradeConnection extends AbstractConnection
String rawRequest = request.generate();
- ByteBuffer buf = BufferUtil.toBuffer(rawRequest,StringUtil.__UTF8_CHARSET);
+ ByteBuffer buf = BufferUtil.toBuffer(rawRequest, StandardCharsets.UTF_8);
getEndPoint().write(this,buf);
}
diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java
index f797421041..2ab48983db 100644
--- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java
+++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java
@@ -20,6 +20,7 @@ package org.eclipse.jetty.websocket.client.examples;
import java.net.InetSocketAddress;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
@@ -208,7 +209,7 @@ public class TestClient
{
b.append('A' + __random.nextInt(26));
}
- data = b.toString().getBytes(StringUtil.__UTF8_CHARSET);
+ data = b.toString().getBytes(StandardCharsets.UTF_8);
break;
}
case OpCode.BINARY:
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
index c4d5ba285d..83027c0660 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.websocket.common;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import org.eclipse.jetty.util.B64Code;
@@ -36,19 +37,7 @@ public class AcceptHash
* <p>
* See <a href="https://tools.ietf.org/html/rfc6455#section-1.3">Opening Handshake (Section 1.3)</a>
*/
- private final static byte[] MAGIC;
-
- static
- {
- try
- {
- MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes(StringUtil.__ISO_8859_1);
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
+ private final static byte[] MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes(StandardCharsets.ISO_8859_1);
/**
* Concatenate the provided key with the Magic GUID and return the Base64 encoded form.
@@ -62,7 +51,7 @@ public class AcceptHash
try
{
MessageDigest md = MessageDigest.getInstance("SHA1");
- md.update(key.getBytes("UTF-8"));
+ md.update(key.getBytes(StandardCharsets.UTF_8));
md.update(MAGIC);
return new String(B64Code.encode(md.digest()));
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java
index ddbe0b0e8d..6bc30efae5 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.websocket.common;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.eclipse.jetty.util.BufferUtil;
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
index 6b9c4de0de..47c91eb852 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java
index 4fe7cf28fe..defae5b633 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.common;
import static org.hamcrest.Matchers.*;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.websocket.api.StatusCode;
@@ -36,7 +37,7 @@ public class ClosePayloadParserTest
{
String expectedReason = "Game Over";
- byte utf[] = expectedReason.getBytes(StringUtil.__UTF8_CHARSET);
+ byte utf[] = expectedReason.getBytes(StandardCharsets.UTF_8);
ByteBuffer payload = ByteBuffer.allocate(utf.length + 2);
payload.putChar((char)StatusCode.NORMAL);
payload.put(utf,0,utf.length);
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java
index 274f345028..2222b7e4d5 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.common;
import static org.hamcrest.Matchers.*;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.eclipse.jetty.util.StringUtil;
@@ -77,7 +78,7 @@ public class TextPayloadParserTest
sb.append(". The end.");
String expectedText = sb.toString();
- byte utf[] = expectedText.getBytes(StringUtil.__UTF8);
+ byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
Assert.assertThat("Must be a long length payload",utf.length,greaterThan(0xFFFF));
@@ -113,7 +114,7 @@ public class TextPayloadParserTest
sb.append(". The end.");
String expectedText = sb.toString();
- byte utf[] = expectedText.getBytes(StringUtil.__UTF8);
+ byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
Assert.assertThat("Must be a medium length payload",utf.length,allOf(greaterThan(0x7E),lessThan(0xFFFF)));
@@ -143,8 +144,8 @@ public class TextPayloadParserTest
String part1 = "Hello ";
String part2 = "World";
- byte b1[] = part1.getBytes(StringUtil.__UTF8_CHARSET);
- byte b2[] = part2.getBytes(StringUtil.__UTF8_CHARSET);
+ byte b1[] = part1.getBytes(StandardCharsets.UTF_8);
+ byte b2[] = part2.getBytes(StandardCharsets.UTF_8);
ByteBuffer buf = ByteBuffer.allocate(32);
@@ -181,7 +182,7 @@ public class TextPayloadParserTest
public void testShortMaskedText() throws Exception
{
String expectedText = "Hello World";
- byte utf[] = expectedText.getBytes(StringUtil.__UTF8_CHARSET);
+ byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
ByteBuffer buf = ByteBuffer.allocate(24);
buf.put((byte)0x81);
@@ -207,7 +208,7 @@ public class TextPayloadParserTest
{
String expectedText = "Hell\uFF4f W\uFF4Frld";
- byte utf[] = expectedText.getBytes(StringUtil.__UTF8);
+ byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
ByteBuffer buf = ByteBuffer.allocate(24);
buf.put((byte)0x81);
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java
index 2f833eeb9a..b063907242 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.websocket.common.ab;
import static org.hamcrest.Matchers.*;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.eclipse.jetty.util.BufferUtil;
@@ -224,7 +225,7 @@ public class TestABCase7_3
ByteBuffer actual = UnitGenerator.generate(close.asFrame());
ByteBuffer expected = ByteBuffer.allocate(132);
- byte messageBytes[] = message.toString().getBytes(StringUtil.__UTF8_CHARSET);
+ byte messageBytes[] = message.toString().getBytes(StandardCharsets.UTF_8);
expected.put(new byte[]
{ (byte)0x88 });
@@ -250,7 +251,7 @@ public class TestABCase7_3
message.append("*");
}
- byte[] messageBytes = message.toString().getBytes(StringUtil.__UTF8_CHARSET);
+ byte[] messageBytes = message.toString().getBytes(StandardCharsets.UTF_8);
ByteBuffer expected = ByteBuffer.allocate(132);
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java
index 6e35645703..0984e71e99 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.*;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -92,7 +93,7 @@ public class FragmentExtensionTest
Assert.assertThat(prefix + ".rsv2",actual.isRsv2(),is(false));
Assert.assertThat(prefix + ".rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(quote.get(i),StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(quote.get(i),StandardCharsets.UTF_8);
Assert.assertThat(prefix + ".payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals(prefix + ".payload",expected,actual.getPayload().slice());
}
@@ -128,7 +129,7 @@ public class FragmentExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(payload,StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(payload,StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
@@ -301,7 +302,7 @@ public class FragmentExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(payload,StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(payload,StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/IdentityExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/IdentityExtensionTest.java
index f6569f2140..ac34762024 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/IdentityExtensionTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/IdentityExtensionTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.*;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
@@ -63,7 +64,7 @@ public class IdentityExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer("hello",StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer("hello",StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
@@ -93,7 +94,7 @@ public class IdentityExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer("hello",StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer("hello",StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java
index 9d8a293582..d7e30c95bb 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.*;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.zip.Deflater;
@@ -92,7 +93,7 @@ public class DeflateFrameExtensionTest
Assert.assertThat(prefix + ".rsv2",actual.isRsv2(),is(false));
Assert.assertThat(prefix + ".rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(expectedTextDatas[i],StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(expectedTextDatas[i],StandardCharsets.UTF_8);
Assert.assertThat(prefix + ".payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals(prefix + ".payload",expected,actual.getPayload().slice());
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java
index 1e0b33cf14..7944a7fdf5 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageDeflateExtensionTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.*;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -136,7 +137,7 @@ public class PerMessageDeflateExtensionTest
Assert.assertThat(prefix + ".rsv2",actual.isRsv2(),is(false));
Assert.assertThat(prefix + ".rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(expectedStr,StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(expectedStr, StandardCharsets.UTF_8);
Assert.assertThat(prefix + ".payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals(prefix + ".payload",expected,actual.getPayload().slice());
}
@@ -382,7 +383,7 @@ public class PerMessageDeflateExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(payload,StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(payload,StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
@@ -436,7 +437,7 @@ public class PerMessageDeflateExtensionTest
Assert.assertThat(prefix + ".rsv2",actual.isRsv2(),is(false));
Assert.assertThat(prefix + ".rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(quote.get(i),StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(quote.get(i),StandardCharsets.UTF_8);
Assert.assertThat(prefix + ".payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals(prefix + ".payload",expected,actual.getPayload().slice());
}
@@ -476,7 +477,7 @@ public class PerMessageDeflateExtensionTest
Assert.assertThat("Frame.rsv2",actual.isRsv2(),is(false));
Assert.assertThat("Frame.rsv3",actual.isRsv3(),is(false));
- ByteBuffer expected = BufferUtil.toBuffer(payload,StringUtil.__UTF8_CHARSET);
+ ByteBuffer expected = BufferUtil.toBuffer(payload,StandardCharsets.UTF_8);
Assert.assertThat("Frame.payloadLength",actual.getPayloadLength(),is(expected.remaining()));
ByteBufferAssert.assertEquals("Frame.payload",expected,actual.getPayload().slice());
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java
index 837cf10bcb..7532b0da41 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/http/HttpResponseHeaderParserTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -39,7 +40,7 @@ public class HttpResponseHeaderParserTest
private void appendUtf8(ByteBuffer buf, String line)
{
- buf.put(ByteBuffer.wrap(StringUtil.getBytes(line,StringUtil.__UTF8)));
+ buf.put(ByteBuffer.wrap(StringUtil.getUtf8Bytes(line)));
}
@Test
@@ -56,7 +57,7 @@ public class HttpResponseHeaderParserTest
// and some body content
resp.append("What you are looking for is not here\r\n");
- ByteBuffer buf = BufferUtil.toBuffer(resp.toString(),StringUtil.__UTF8_CHARSET);
+ ByteBuffer buf = BufferUtil.toBuffer(resp.toString(),StandardCharsets.UTF_8);
HttpResponseParseCapture capture = new HttpResponseParseCapture();
HttpResponseHeaderParser parser = new HttpResponseHeaderParser(capture);
@@ -178,7 +179,7 @@ public class HttpResponseHeaderParserTest
resp.append("Sec-WebSocket-Protocol: chat\r\n");
resp.append("\r\n");
- ByteBuffer buf = BufferUtil.toBuffer(resp.toString(),StringUtil.__UTF8_CHARSET);
+ ByteBuffer buf = BufferUtil.toBuffer(resp.toString(),StandardCharsets.UTF_8);
HttpResponseParseCapture capture = new HttpResponseParseCapture();
HttpResponseHeaderParser parser = new HttpResponseHeaderParser(capture);
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java
index 4647c5b967..05065c6b78 100644
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java
+++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.websocket.mux.op;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
@@ -104,7 +105,7 @@ public class MuxAddChannelRequest implements MuxControlBlock
public void setHandshake(String rawstring)
{
- setHandshake(BufferUtil.toBuffer(rawstring,StringUtil.__UTF8_CHARSET));
+ setHandshake(BufferUtil.toBuffer(rawstring, StandardCharsets.UTF_8));
}
public void setRsv(byte rsv)
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java
index b2a2dd64f7..13c6493b41 100644
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java
+++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.websocket.mux.op;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
@@ -115,7 +116,7 @@ public class MuxAddChannelResponse implements MuxControlBlock
public void setHandshake(String responseHandshake)
{
- setHandshake(BufferUtil.toBuffer(responseHandshake,StringUtil.__UTF8_CHARSET));
+ setHandshake(BufferUtil.toBuffer(responseHandshake, StandardCharsets.UTF_8));
}
public void setRsv(byte rsv)
diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java
index e32a457c5d..40b1583240 100644
--- a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java
+++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java
@@ -23,6 +23,7 @@ import static org.hamcrest.Matchers.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -236,7 +237,7 @@ public class MuxParserRFCTest
}
else
{
- out.write(part.getBytes(StringUtil.__UTF8_CHARSET));
+ out.write(part.getBytes(StandardCharsets.UTF_8));
}
}
return out.toByteArray();
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/blockhead/BlockheadClient.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/blockhead/BlockheadClient.java
index 098e16c5de..4a8308a1dd 100644
--- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/blockhead/BlockheadClient.java
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/blockhead/BlockheadClient.java
@@ -33,6 +33,7 @@ import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@@ -728,7 +729,7 @@ public class BlockheadClient implements IncomingFrames, OutgoingFrames, Connecti
public void writeRaw(String str) throws IOException
{
LOG.debug("write((String)[{}]){}{})",str.length(),'\n',str);
- out.write(StringUtil.getBytes(str,StringUtil.__ISO_8859_1));
+ out.write(str.getBytes(StandardCharsets.ISO_8859_1));
}
public void writeRawSlowly(ByteBuffer buf, int segmentSize) throws IOException
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java
index 3ad6594ec3..ca1071fddf 100644
--- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java
@@ -30,6 +30,7 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.net.URI;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.TypeUtil;
@@ -90,7 +91,7 @@ public class SafariD00
// System.out.printf("--- Request ---%n%s",req);
- byte reqBytes[] = req.toString().getBytes("UTF-8");
+ byte reqBytes[] = req.toString().getBytes(StandardCharsets.UTF_8);
byte hixieBytes[] = TypeUtil.fromHexString("e739617916c9daf3");
byte buf[] = new byte[reqBytes.length + hixieBytes.length];
System.arraycopy(reqBytes,0,buf,0,reqBytes.length);
@@ -140,7 +141,7 @@ public class SafariD00
for (String msg : msgs)
{
buf.put((byte)0x00);
- buf.put(msg.getBytes("UTF-8"));
+ buf.put(msg.getBytes(StandardCharsets.UTF_8));
buf.put((byte)0xFF);
}

Back to the top