Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.
This commit is contained in:
commit
9998069cb8
|
@ -11,7 +11,7 @@ pipeline {
|
|||
agent { node { label 'linux' } }
|
||||
options { timeout(time: 120, unit: 'MINUTES') }
|
||||
steps {
|
||||
mavenBuild("jdk11", "-Pmongodb clean install", "maven3", true) // -Pautobahn
|
||||
mavenBuild("jdk11", "-T3 -Pmongodb clean install", "maven3", true) // -Pautobahn
|
||||
// Collect up the jacoco execution results (only on main build)
|
||||
jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class',
|
||||
exclusionPattern: '' +
|
||||
|
@ -44,7 +44,7 @@ pipeline {
|
|||
agent { node { label 'linux' } }
|
||||
steps {
|
||||
timeout(time: 120, unit: 'MINUTES') {
|
||||
mavenBuild("jdk13", "-Pmongodb clean install", "maven3", true)
|
||||
mavenBuild("jdk13", "-T3 -Pmongodb clean install", "maven3", true)
|
||||
warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']]
|
||||
junit testResults: '**/target/surefire-reports/*.xml,**/target/invoker-reports/TEST*.xml'
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ pipeline {
|
|||
agent { node { label 'linux' } }
|
||||
steps {
|
||||
timeout(time: 30, unit: 'MINUTES') {
|
||||
mavenBuild("jdk11", "install javadoc:javadoc -DskipTests", "maven3", true)
|
||||
mavenBuild("jdk11", "install javadoc:javadoc -DskipTests -Dpmd.skip=true -Dcheckstyle.skip=true", "maven3", true)
|
||||
warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'JavaDoc'], [parserName: 'Java']]
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ def mavenBuild(jdk, cmdline, mvnName, junitPublishDisabled) {
|
|||
mavenOpts: mavenOpts,
|
||||
mavenLocalRepo: localRepo) {
|
||||
// Some common Maven command line + provided command line
|
||||
sh "mvn -Pci -V -B -T3 -e -fae -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME
|
||||
sh "mvn -Pci -V -B -e -fae -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,6 @@
|
|||
|
||||
<property name="fileExtensions" value="java"/>
|
||||
|
||||
<!-- reference to suppressions filter for both eclipse and intellij checkstyle plugins -->
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${checkstyle.suppressions.file}"/>
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- Excludes all 'module-info.java' files -->
|
||||
<!-- See https://checkstyle.org/config_filefilters.html -->
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
|
||||
<suppressions>
|
||||
<!-- all /target/ directories -->
|
||||
<suppress checks=".*" files="[/\\]target[/\\]generated-sources[/\\]" />
|
||||
|
||||
<!-- General JUnit Test Cases -->
|
||||
<suppress checks="AbbreviationAsWordInNameCheck"
|
||||
files="[/\\]src[/\\]test[/\\]java[/\\]" />
|
||||
<suppress checks="AvoidEscapedUnicodeCharactersCheck"
|
||||
files="[/\\]src[/\\]test[/\\]java[/\\]" />
|
||||
<suppress checks="LocalVariableNameCheck"
|
||||
files="[/\\]src[/\\]test[/\\]java[/\\]" />
|
||||
<suppress checks="MethodNameCheck"
|
||||
files="[/\\]src[/\\]test[/\\]java[/\\]" />
|
||||
<suppress checks="TypeNameCheck"
|
||||
files="[/\\]src[/\\]test[/\\]java[/\\]" />
|
||||
|
||||
<!-- jetty-jmh specific -->
|
||||
<suppress checks="AbbreviationAsWordInNameCheck"
|
||||
files="[/\\]jetty-jmh[/\\]src[/\\]main[/\\]java[/\\]" />
|
||||
<suppress checks="AvoidEscapedUnicodeCharactersCheck"
|
||||
files="[/\\]jetty-jmh[/\\]src[/\\]main[/\\]java[/\\]" />
|
||||
<suppress checks="LocalVariableNameCheck"
|
||||
files="[/\\]jetty-jmh[/\\]src[/\\]main[/\\]java[/\\]" />
|
||||
<suppress checks="MethodNameCheck"
|
||||
files="[/\\]jetty-jmh[/\\]src[/\\]main[/\\]java[/\\]" />
|
||||
<suppress checks="TypeNameCheck"
|
||||
files="[/\\]jetty-jmh[/\\]src[/\\]main[/\\]java[/\\]" />
|
||||
|
||||
</suppressions>
|
|
@ -220,7 +220,7 @@ public class TestAnnotationParser
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testJep238MultiReleaseInJar_JDK10() throws Exception
|
||||
public void testJep238MultiReleaseInJarJDK10() throws Exception
|
||||
{
|
||||
File jdk10Jar = MavenTestingUtils.getTestResourceFile("jdk10/multirelease-10.jar");
|
||||
AnnotationParser parser = new AnnotationParser();
|
||||
|
|
|
@ -196,7 +196,7 @@ public abstract class AbstractHttpClientServerTest
|
|||
|
||||
private void configure(SslContextFactory ssl)
|
||||
{
|
||||
Path keystorePath = MavenTestingUtils.getTestResourcePath("keystore.jks");
|
||||
Path keystorePath = MavenTestingUtils.getTestResourcePath("keystore.p12");
|
||||
ssl.setKeyStorePath(keystorePath.toString());
|
||||
ssl.setKeyStorePassword("storepwd");
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerConnectionClose_ClientClosesAfterExchange(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerConnectionCloseClientClosesAfterExchange(Scenario scenario) throws Exception
|
||||
{
|
||||
byte[] data = new byte[128 * 1024];
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -106,7 +106,7 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerDoesNotRespond_ClientIdleTimeout(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerDoesNotRespondClientIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerPartialResponse_ClientIdleTimeout(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerPartialResponseClientIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
long idleTimeout = 1000;
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -214,7 +214,7 @@ public class ClientConnectionCloseTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ClientConnectionClose_ServerNoConnectionClose_ClientCloses(Scenario scenario) throws Exception
|
||||
public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ public class HostnameVerificationTest
|
|||
server = new Server(serverThreads);
|
||||
|
||||
SslContextFactory.Server serverSslContextFactory = new SslContextFactory.Server();
|
||||
serverSslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
serverSslContextFactory.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
serverSslContextFactory.setKeyStorePassword("storepwd");
|
||||
connector = new ServerConnector(server, serverSslContextFactory);
|
||||
server.addConnector(connector);
|
||||
|
@ -78,7 +78,7 @@ public class HostnameVerificationTest
|
|||
server.start();
|
||||
|
||||
// The keystore contains a hostname which doesn't match localhost
|
||||
clientSslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
clientSslContextFactory.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
clientSslContextFactory.setKeyStorePassword("storepwd");
|
||||
|
||||
ClientConnector clientConnector = new ClientConnector();
|
||||
|
|
|
@ -115,51 +115,51 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication(Scenario scenario) throws Exception
|
||||
public void testBasicAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicEmptyRealm(Scenario scenario) throws Exception
|
||||
public void testBasicEmptyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
realm = "";
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAnyRealm(Scenario scenario) throws Exception
|
||||
public void testBasicAnyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic"));
|
||||
testAuthentication(scenario, new BasicAuthentication(uri, ANY_REALM, "basic", "basic"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DigestAuthentication(Scenario scenario) throws Exception
|
||||
public void testDigestAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startDigest(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest"));
|
||||
testAuthentication(scenario, new DigestAuthentication(uri, realm, "digest", "digest"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DigestAnyRealm(Scenario scenario) throws Exception
|
||||
public void testDigestAnyRealm(Scenario scenario) throws Exception
|
||||
{
|
||||
startDigest(scenario, new EmptyServerHandler());
|
||||
URI uri = URI.create(scenario.getScheme() + "://localhost:" + connector.getLocalPort());
|
||||
test_Authentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest"));
|
||||
testAuthentication(scenario, new DigestAuthentication(uri, ANY_REALM, "digest", "digest"));
|
||||
}
|
||||
|
||||
private void test_Authentication(final Scenario scenario, Authentication authentication) throws Exception
|
||||
private void testAuthentication(final Scenario scenario, Authentication authentication) throws Exception
|
||||
{
|
||||
AuthenticationStore authenticationStore = client.getAuthenticationStore();
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_ThenRedirect(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationThenRedirect(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Redirect_ThenBasicAuthentication(Scenario scenario) throws Exception
|
||||
public void testRedirectThenBasicAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_WithAuthenticationRemoved(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationWithAuthenticationRemoved(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -359,7 +359,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BasicAuthentication_WithWrongPassword(Scenario scenario) throws Exception
|
||||
public void testBasicAuthenticationWithWrongPassword(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Authentication_ThrowsException(Scenario scenario) throws Exception
|
||||
public void testAuthenticationThrowsException(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -419,7 +419,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PreemptedAuthentication(Scenario scenario) throws Exception
|
||||
public void testPreemptedAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -449,7 +449,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_NonReproducibleContent(Scenario scenario) throws Exception
|
||||
public void testNonReproducibleContent(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -484,7 +484,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_RequestFailsAfterResponse(Scenario scenario) throws Exception
|
||||
public void testRequestFailsAfterResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
startBasic(scenario, new EmptyServerHandler()
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_InfiniteAuthentication(Scenario scenario) throws Exception
|
||||
public void testInfiniteAuthentication(Scenario scenario) throws Exception
|
||||
{
|
||||
String authType = "Authenticate";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
|
|
|
@ -63,7 +63,7 @@ public class HttpClientChunkedContentTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Server_HeadersPauseTerminal_Client_Response() throws Exception
|
||||
public void testServerHeadersPauseTerminalClientResponse() throws Exception
|
||||
{
|
||||
startClient();
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class HttpClientChunkedContentTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Server_ContentTerminal_Client_ContentDelay() throws Exception
|
||||
public void testServerContentTerminalClientContentDelay() throws Exception
|
||||
{
|
||||
startClient();
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303(Scenario scenario) throws Exception
|
||||
public void test303(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_302(Scenario scenario) throws Exception
|
||||
public void test303302(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_302_OnDifferentDestinations(Scenario scenario) throws Exception
|
||||
public void test303302OnDifferentDestinations(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_301(Scenario scenario) throws Exception
|
||||
public void test301(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_301_WithWrongMethod(Scenario scenario) throws Exception
|
||||
public void test301WithWrongMethod(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_307_WithRequestContent(Scenario scenario) throws Exception
|
||||
public void test307WithRequestContent(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_303_WithConnectionClose_WithBigRequest(Scenario scenario) throws Exception
|
||||
public void test303WithConnectionCloseWithBigRequest(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new RedirectHandler());
|
||||
|
||||
|
@ -314,84 +314,84 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_301(Scenario scenario) throws Exception
|
||||
public void testHEAD301(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_301(Scenario scenario) throws Exception
|
||||
public void testPOST301(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_301(Scenario scenario) throws Exception
|
||||
public void testPUT301(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.MOVED_PERMANENTLY_301);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_302(Scenario scenario) throws Exception
|
||||
public void testHEAD302(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_302(Scenario scenario) throws Exception
|
||||
public void testPOST302(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_302(Scenario scenario) throws Exception
|
||||
public void testPUT302(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.FOUND_302);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_303(Scenario scenario) throws Exception
|
||||
public void testHEAD303(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_303(Scenario scenario) throws Exception
|
||||
public void testPOST303(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.POST, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_303(Scenario scenario) throws Exception
|
||||
public void testPUT303(Scenario scenario) throws Exception
|
||||
{
|
||||
testGETRedirect(scenario, HttpMethod.PUT, HttpStatus.SEE_OTHER_303);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_307(Scenario scenario) throws Exception
|
||||
public void testHEAD307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.HEAD, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_307(Scenario scenario) throws Exception
|
||||
public void testPOST307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.POST, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_307(Scenario scenario) throws Exception
|
||||
public void testPUT307(Scenario scenario) throws Exception
|
||||
{
|
||||
testSameMethodRedirect(scenario, HttpMethod.PUT, HttpStatus.TEMPORARY_REDIRECT_307);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class HttpClientTLSTest
|
|||
|
||||
private void configureSslContextFactory(SslContextFactory sslContextFactory)
|
||||
{
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
@ExtendWith(WorkDirExtension.class)
|
||||
public class HttpClientTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
|
@ -152,7 +153,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_DestinationCount(Scenario scenario) throws Exception
|
||||
public void testDestinationCount(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -172,7 +173,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_ResponseWithoutContent(Scenario scenario) throws Exception
|
||||
public void testGETResponseWithoutContent(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -184,7 +185,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -208,7 +209,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_WithParameters_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETWithParametersResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
String paramName1 = "a";
|
||||
String paramName2 = "b";
|
||||
|
@ -241,7 +242,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_GET_WithParametersMultiValued_ResponseWithContent(Scenario scenario) throws Exception
|
||||
public void testGETWithParametersMultiValuedResponseWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
String paramName1 = "a";
|
||||
String paramName2 = "b";
|
||||
|
@ -280,7 +281,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithParameters(Scenario scenario) throws Exception
|
||||
public void testPOSTWithParameters(Scenario scenario) throws Exception
|
||||
{
|
||||
String paramName = "a";
|
||||
String paramValue = "\u20AC";
|
||||
|
@ -312,7 +313,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PUT_WithParameters(Scenario scenario) throws Exception
|
||||
public void testPUTWithParameters(Scenario scenario) throws Exception
|
||||
{
|
||||
String paramName = "a";
|
||||
String paramValue = "\u20AC";
|
||||
|
@ -346,7 +347,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithParameters_WithContent(Scenario scenario) throws Exception
|
||||
public void testPOSTWithParametersWithContent(Scenario scenario) throws Exception
|
||||
{
|
||||
byte[] content = {0, 1, 2, 3};
|
||||
String paramName = "a";
|
||||
|
@ -381,7 +382,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithContent_NotifiesRequestContentListener(Scenario scenario) throws Exception
|
||||
public void testPOSTWithContentNotifiesRequestContentListener(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -412,7 +413,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_POST_WithContent_TracksProgress(Scenario scenario) throws Exception
|
||||
public void testPOSTWithContentTracksProgress(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -444,7 +445,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_QueuedRequest_IsSent_WhenPreviousRequestSucceeded(Scenario scenario) throws Exception
|
||||
public void testQueuedRequestIsSentWhenPreviousRequestSucceeded(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -493,7 +494,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_QueuedRequest_IsSent_WhenPreviousRequestClosedConnection(Scenario scenario) throws Exception
|
||||
public void testQueuedRequestIsSentWhenPreviousRequestClosedConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -534,7 +535,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_OnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteOnlyWhenBothRequestAndResponseAreComplete(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -613,7 +614,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_WhenRequestFailsMidway_WithResponse(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteWhenRequestFailsMidwayWithResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -676,7 +677,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ExchangeIsComplete_WhenRequestFails_WithNoResponse(Scenario scenario) throws Exception
|
||||
public void testExchangeIsCompleteWhenRequestFailsWithNoResponse(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -706,7 +707,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_Request_IdleTimeout(Scenario scenario) throws Exception
|
||||
public void testRequestIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
long idleTimeout = 1000;
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -821,7 +822,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_HEAD_With_ResponseContentLength(Scenario scenario) throws Exception
|
||||
public void testHEADWithResponseContentLength(Scenario scenario) throws Exception
|
||||
{
|
||||
int length = 1024;
|
||||
start(scenario, new AbstractHandler()
|
||||
|
@ -1622,7 +1623,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_IPv6_Host(Scenario scenario) throws Exception
|
||||
public void testIPv6Host(Scenario scenario) throws Exception
|
||||
{
|
||||
Assumptions.assumeTrue(Net.isIpv6InterfaceAvailable());
|
||||
start(scenario, new AbstractHandler()
|
||||
|
|
|
@ -59,6 +59,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpClientURITest extends AbstractHttpClientServerTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void testIPv6Host(Scenario scenario) throws Exception
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SuccessfulRequest_ReturnsConnection(Scenario scenario) throws Exception
|
||||
public void testSuccessfulRequestReturnsConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_FailedRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testFailedRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BadRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBadRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@Tag("Slow")
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_BadRequest_WithSlowRequest_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBadRequestWithSlowRequestRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ConnectionFailure_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testConnectionFailureRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new AbstractHandler()
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_BigRequestContent_ResponseWithConnectionCloseHeader_RemovesConnection(Scenario scenario) throws Exception
|
||||
public void testBigRequestContentResponseWithConnectionCloseHeaderRemovesConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
try (StacklessLogging ignore = new StacklessLogging(HttpConnection.class))
|
||||
{
|
||||
|
@ -434,7 +434,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
@ArgumentsSource(ScenarioProvider.class)
|
||||
@Tag("Slow")
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_IdleConnection_IsClosed_OnRemoteClose(Scenario scenario) throws Exception
|
||||
public void testIdleConnectionIsClosedOnRemoteClose(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpCookie;
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
@ -27,7 +26,6 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -52,14 +50,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieIsStored(Scenario scenario) throws Exception
|
||||
public void testCookieIsStored(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.addCookie(new Cookie(name, value));
|
||||
}
|
||||
|
@ -82,14 +80,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieIsSent(Scenario scenario) throws Exception
|
||||
public void testCookieIsSent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
Cookie[] cookies = request.getCookies();
|
||||
assertNotNull(cookies);
|
||||
|
@ -113,12 +111,12 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookieWithoutValue(Scenario scenario) throws Exception
|
||||
public void testCookieWithoutValue(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
response.addHeader("Set-Cookie", "");
|
||||
}
|
||||
|
@ -133,14 +131,14 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_PerRequestCookieIsSent(Scenario scenario) throws Exception
|
||||
public void testPerRequestCookieIsSent(Scenario scenario) throws Exception
|
||||
{
|
||||
final String name = "foo";
|
||||
final String value = "bar";
|
||||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
Cookie[] cookies = request.getCookies();
|
||||
assertNotNull(cookies);
|
||||
|
@ -161,7 +159,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithoutPath_RequestURIWithOneSegment(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithoutPathRequestURIWithOneSegment(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -169,7 +167,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -217,7 +215,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithoutPath_RequestURIWithTwoSegments(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithoutPathRequestURIWithTwoSegments(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -225,7 +223,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
@ -278,7 +276,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithLongerPath(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithLongerPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -286,7 +284,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -339,7 +337,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SetCookieWithShorterPath(Scenario scenario) throws Exception
|
||||
public void testSetCookieWithShorterPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -347,7 +345,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
@ -400,7 +398,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNameSamePath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -409,7 +407,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -463,7 +461,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNameDifferentPath(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -472,7 +470,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -533,7 +531,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_TwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception
|
||||
public void testTwoSetCookieWithSameNamePath1PrefixOfPath2(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -542,7 +540,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo".equals(target) && r == 0)
|
||||
|
@ -606,7 +604,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_CookiePathWithTrailingSlash(Scenario scenario) throws Exception
|
||||
public void testCookiePathWithTrailingSlash(Scenario scenario) throws Exception
|
||||
{
|
||||
String headerName = "X-Request";
|
||||
String cookieName = "a";
|
||||
|
@ -614,7 +612,7 @@ public class HttpCookieTest extends AbstractHttpClientServerTest
|
|||
start(scenario, new EmptyServerHandler()
|
||||
{
|
||||
@Override
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
protected void service(String target, Request jettyRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
int r = request.getIntHeader(headerName);
|
||||
if ("/foo/bar".equals(target) && r == 0)
|
||||
|
|
|
@ -204,7 +204,7 @@ public class Socks4ProxyTest
|
|||
{
|
||||
// The client keystore contains the trustedCertEntry for the
|
||||
// self-signed server certificate, so it acts as a truststore.
|
||||
ssl.setTrustStorePath("src/test/resources/client_keystore.jks");
|
||||
ssl.setTrustStorePath("src/test/resources/client_keystore.p12");
|
||||
ssl.setTrustStorePassword("storepwd");
|
||||
// Disable TLS hostname verification, but
|
||||
// enable application hostname verification.
|
||||
|
@ -238,7 +238,7 @@ public class Socks4ProxyTest
|
|||
|
||||
// Wrap the socket with TLS.
|
||||
SslContextFactory.Server serverTLS = new SslContextFactory.Server();
|
||||
serverTLS.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
serverTLS.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
serverTLS.setKeyStorePassword("storepwd");
|
||||
serverTLS.start();
|
||||
SSLContext sslContext = serverTLS.getSslContext();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TLSServerConnectionCloseTest
|
|||
|
||||
SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();
|
||||
sslContextFactory.setEndpointIdentificationAlgorithm(null);
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
clientConnector.setSslContextFactory(sslContextFactory);
|
||||
|
||||
|
|
|
@ -49,10 +49,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@Disabled
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class Usage
|
||||
{
|
||||
@Test
|
||||
public void testGETBlocking_ShortAPI() throws Exception
|
||||
public void testGETBlockingShortAPI() throws Exception
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
client.start();
|
||||
|
@ -120,7 +121,7 @@ public class Usage
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPOSTWithParams_ShortAPI() throws Exception
|
||||
public void testPOSTWithParamsShortAPI() throws Exception
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
client.start();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
{
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_FirstAcquire_WithEmptyQueue(Scenario scenario) throws Exception
|
||||
public void testFirstAcquireWithEmptyQueue(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SecondAcquire_AfterFirstAcquire_WithEmptyQueue_ReturnsSameConnection(Scenario scenario) throws Exception
|
||||
public void testSecondAcquireAfterFirstAcquireWithEmptyQueueReturnsSameConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_SecondAcquire_ConcurrentWithFirstAcquire_WithEmptyQueue_CreatesTwoConnections(Scenario scenario) throws Exception
|
||||
public void testSecondAcquireConcurrentWithFirstAcquireWithEmptyQueueCreatesTwoConnections(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Acquire_Process_Release_Acquire_ReturnsSameConnection(Scenario scenario) throws Exception
|
||||
public void testAcquireProcessReleaseAcquireReturnsSameConnection(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_IdleConnection_IdleTimeout(Scenario scenario) throws Exception
|
||||
public void testIdleConnectionIdleTimeout(Scenario scenario) throws Exception
|
||||
{
|
||||
startServer(scenario, new EmptyServerHandler());
|
||||
long idleTimeout = 1000;
|
||||
|
@ -209,7 +209,7 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
|
||||
@ParameterizedTest
|
||||
@ArgumentsSource(ScenarioProvider.class)
|
||||
public void test_Request_Failed_If_MaxRequestsQueuedPerDestination_Exceeded(Scenario scenario) throws Exception
|
||||
public void testRequestFailedIfMaxRequestsQueuedPerDestinationExceeded(Scenario scenario) throws Exception
|
||||
{
|
||||
start(scenario, new EmptyServerHandler());
|
||||
String scheme = scenario.getScheme();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class HttpReceiverOverHTTPTest
|
|||
private ByteArrayEndPoint endPoint;
|
||||
private HttpConnectionOverHTTP connection;
|
||||
|
||||
public static Stream<Arguments> complianceModes() throws Exception
|
||||
public static Stream<Arguments> complianceModes()
|
||||
{
|
||||
return Stream.of(
|
||||
HttpCompliance.RFC7230,
|
||||
|
@ -106,7 +106,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_NoResponseContent(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveNoResponseContent(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -130,7 +130,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContent(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
String content = "0123456789ABCDEF";
|
||||
|
@ -158,7 +158,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent_EarlyEOF(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContentEarlyEOF(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
String content1 = "0123456789";
|
||||
|
@ -180,7 +180,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_ResponseContent_IdleTimeout(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveResponseContentIdleTimeout(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -201,7 +201,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_Receive_BadResponse(HttpCompliance compliance) throws Exception
|
||||
public void testReceiveBadResponse(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
endPoint.addInput(
|
||||
|
@ -220,7 +220,7 @@ public class HttpReceiverOverHTTPTest
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("complianceModes")
|
||||
public void test_FillInterested_RacingWith_BufferRelease(HttpCompliance compliance) throws Exception
|
||||
public void testFillInterestedRacingWithBufferRelease(HttpCompliance compliance) throws Exception
|
||||
{
|
||||
init(compliance);
|
||||
connection = new HttpConnectionOverHTTP(endPoint, destination, new Promise.Adapter<>())
|
||||
|
|
|
@ -63,7 +63,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent() throws Exception
|
||||
public void testSendNoRequestContent() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -97,7 +97,7 @@ public class HttpSenderOverHTTPTest
|
|||
|
||||
@Test
|
||||
@DisabledIfSystemProperty(named = "env", matches = "ci") // TODO: SLOW, needs review
|
||||
public void test_Send_NoRequestContent_IncompleteFlush() throws Exception
|
||||
public void testSendNoRequestContentIncompleteFlush() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16);
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -125,7 +125,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent_Exception() throws Exception
|
||||
public void testSendNoRequestContentException() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
// Shutdown output to trigger the exception on write
|
||||
|
@ -157,7 +157,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_NoRequestContent_IncompleteFlush_Exception() throws Exception
|
||||
public void testSendNoRequestContentIncompleteFlushException() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint("", 16);
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -193,7 +193,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_InOneBuffer() throws Exception
|
||||
public void testSendSmallRequestContentInOneBuffer() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -228,7 +228,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_InTwoBuffers() throws Exception
|
||||
public void testSendSmallRequestContentInTwoBuffers() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
@ -264,7 +264,7 @@ public class HttpSenderOverHTTPTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Send_SmallRequestContent_Chunked_InTwoChunks() throws Exception
|
||||
public void testSendSmallRequestContentChunkedInTwoChunks() throws Exception
|
||||
{
|
||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||
HttpDestination destination = new DuplexHttpDestination(client, new Origin("http", "localhost", 8080));
|
||||
|
|
|
@ -87,7 +87,7 @@ public class NeedWantClientAuthTest
|
|||
private SslContextFactory.Server createServerSslContextFactory()
|
||||
{
|
||||
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.p12");
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
return sslContextFactory;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class NeedWantClientAuthTest
|
|||
});
|
||||
|
||||
SslContextFactory.Client clientSSL = new SslContextFactory.Client(true);
|
||||
clientSSL.setKeyStorePath("src/test/resources/client_keystore.jks");
|
||||
clientSSL.setKeyStorePath("src/test/resources/client_keystore.p12");
|
||||
clientSSL.setKeyStorePassword("storepwd");
|
||||
startClient(clientSSL);
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class NeedWantClientAuthTest
|
|||
});
|
||||
|
||||
SslContextFactory.Client clientSSL = new SslContextFactory.Client(true);
|
||||
clientSSL.setKeyStorePath("src/test/resources/client_keystore.jks");
|
||||
clientSSL.setKeyStorePath("src/test/resources/client_keystore.p12");
|
||||
clientSSL.setKeyStorePassword("storepwd");
|
||||
startClient(clientSSL);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SslBytesClientTest extends SslBytesTest
|
|||
clientConnector.setSslContextFactory(sslContextFactory);
|
||||
client = new HttpClient(new HttpClientTransportOverHTTP(clientConnector));
|
||||
client.setMaxConnectionsPerDestination(1);
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.jks");
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.p12");
|
||||
sslContextFactory.setKeyStorePath(keyStore.getAbsolutePath());
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
client.start();
|
||||
|
|
|
@ -117,7 +117,7 @@ public class SslBytesServerTest extends SslBytesTest
|
|||
httpParses.set(0);
|
||||
serverEndPoint.set(null);
|
||||
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.jks");
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.p12");
|
||||
sslContextFactory = new SslContextFactory.Server();
|
||||
sslContextFactory.setKeyStorePath(keyStore.getAbsolutePath());
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class SslConnectionTest
|
|||
@Test
|
||||
public void testSslConnectionClosedBeforeFill() throws Exception
|
||||
{
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.jks");
|
||||
File keyStore = MavenTestingUtils.getTestResourceFile("keystore.p12");
|
||||
SslContextFactory sslContextFactory = new SslContextFactory.Server();
|
||||
sslContextFactory.setKeyStorePath(keyStore.getAbsolutePath());
|
||||
sslContextFactory.setKeyStorePassword("storepwd");
|
||||
|
|
|
@ -62,6 +62,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class MultiPartContentProviderTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
@ParameterizedTest
|
||||
|
|
|
@ -51,6 +51,7 @@ public class TypedContentProviderTest extends AbstractHttpClientServerTest
|
|||
final String value1 = "1";
|
||||
final String name2 = "b";
|
||||
final String value2 = "2";
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
final String value3 = "\u20AC";
|
||||
|
||||
start(scenario, new AbstractHandler()
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,27 @@
|
|||
Since OpenJDK 13.0.2/11.0.6 it is required that CA certificates have the extension CA=true.
|
||||
|
||||
The keystores are generated in the following way:
|
||||
|
||||
# Generates the server keystore. Note the BasicConstraint=CA:true extension.
|
||||
$ keytool -v -genkeypair -validity 36500 -keyalg RSA -keysize 2048 -keystore keystore.p12 -storetype pkcs12 -dname "CN=server, OU=Jetty, O=Webtide, L=Omaha, S=NE, C=US" -ext BC=CA:true
|
||||
|
||||
# Export the server certificate.
|
||||
$ keytool -v -export -keystore keystore.p12 -rfc -file server.crt
|
||||
|
||||
# Export the server private key.
|
||||
$ openssl pkcs12 -in keystore.p12 -nodes -nocerts -out server.key
|
||||
|
||||
# Generate the client keystore.
|
||||
$ keytool -v -genkeypair -validity 36500 -keyalg RSA -keysize 2048 -keystore client_keystore.p12 -storetype pkcs12 -dname "CN=client, OU=Jetty, O=Webtide, L=Omaha, S=NE, C=US"
|
||||
|
||||
# Generate the Certificate Signing Request.
|
||||
$ keytool -certreq -file client.csr -keystore client_keystore.p12
|
||||
|
||||
# Sign the CSR.
|
||||
$ openssl x509 -req -days 36500 -in client.csr -CA server.crt -CAkey server.key -CAcreateserial -sha256 -out signed.crt
|
||||
|
||||
# Import the server certificate into the client keystore.
|
||||
$ keytool -v -import -alias ca -file server.crt -keystore client_keystore.p12
|
||||
|
||||
# Import the signed CSR.
|
||||
$ keytool -import -file signed.crt -keystore client_keystore.p12
|
|
@ -86,13 +86,13 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Deployed()
|
||||
public void testFindPathDeployedDeployed()
|
||||
{
|
||||
assertNoPath("deployed", "deployed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Started()
|
||||
public void testFindPathDeployedStarted()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("deployed");
|
||||
|
@ -102,7 +102,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Deployed_Undeployed()
|
||||
public void testFindPathDeployedUndeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("deployed");
|
||||
|
@ -112,7 +112,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Deployed()
|
||||
public void testFindPathStartedDeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("started");
|
||||
|
@ -122,13 +122,13 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Started()
|
||||
public void testFindPathStartedStarted()
|
||||
{
|
||||
assertNoPath("started", "started");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Started_Undeployed()
|
||||
public void testFindPathStartedUndeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("started");
|
||||
|
@ -140,7 +140,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Deployed()
|
||||
public void testFindPathUndeployedDeployed()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("undeployed");
|
||||
|
@ -150,7 +150,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Started()
|
||||
public void testFindPathUndeployedStarted()
|
||||
{
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("undeployed");
|
||||
|
@ -162,7 +162,7 @@ public class AppLifeCycleTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindPath_Undeployed_Uavailable()
|
||||
public void testFindPathUndeployedUnavailable()
|
||||
{
|
||||
assertNoPath("undeployed", "undeployed");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BadAppDeployTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBadApp_ThrowOnUnavailableTrue_XmlOrder() throws Exception
|
||||
public void testBadAppThrowOnUnavailableTrueXmlOrder() throws Exception
|
||||
{
|
||||
/* Non-working Bean Order as reported in Issue #3620
|
||||
It is important that this Order be maintained for an accurate test case.
|
||||
|
@ -116,7 +116,7 @@ public class BadAppDeployTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBadApp_ThrowOnUnavailableTrue_EmbeddedOrder() throws Exception
|
||||
public void testBadAppThrowOnUnavailableTrueEmbeddedOrder() throws Exception
|
||||
{
|
||||
/* Working Bean Order
|
||||
### BEAN: QueuedThreadPool[qtp1530388690]@5b37e0d2{STOPPED,8<=0<=200,i=0,r=-1,q=0}[NO_TRY]
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
|||
public class DeploymentManagerLifeCyclePathTest
|
||||
{
|
||||
@Test
|
||||
public void testStateTransition_NewToDeployed() throws Exception
|
||||
public void testStateTransitionNewToDeployed() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setContexts(new ContextHandlerCollection());
|
||||
|
@ -64,7 +64,7 @@ public class DeploymentManagerLifeCyclePathTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStateTransition_Receive() throws Exception
|
||||
public void testStateTransitionReceive() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setContexts(new ContextHandlerCollection());
|
||||
|
@ -90,7 +90,7 @@ public class DeploymentManagerLifeCyclePathTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStateTransition_DeployedToUndeployed() throws Exception
|
||||
public void testStateTransitionDeployedToUndeployed() throws Exception
|
||||
{
|
||||
DeploymentManager depman = new DeploymentManager();
|
||||
depman.setDefaultLifeCycleGoal(null); // no default
|
||||
|
|
|
@ -64,6 +64,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpClientTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
|
||||
@Test
|
||||
public void testGETResponseWithoutContent() throws Exception
|
||||
{
|
||||
|
|
|
@ -47,11 +47,11 @@ public class DrupalHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP(S) Configuration
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
HttpConfiguration https_config = new HttpConfiguration(config);
|
||||
https_config.addCustomizer(new SecureRequestCustomizer());
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration(config);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class DrupalHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config));
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig));
|
||||
http2Connector.setPort(8443);
|
||||
http2Connector.setIdleTimeout(15000);
|
||||
server.addConnector(http2Connector);
|
||||
|
|
|
@ -52,12 +52,12 @@ public class WordPressHTTP2FastCGIProxyServer
|
|||
Server server = new Server();
|
||||
|
||||
// HTTP(S) Configuration
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
HttpConfiguration https_config = new HttpConfiguration(config);
|
||||
https_config.addCustomizer(new SecureRequestCustomizer());
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class WordPressHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(https_config));
|
||||
new ServerConnector(server, ssl, alpn, h2, new HttpConnectionFactory(httpsConfig));
|
||||
http2Connector.setPort(tlsPort);
|
||||
http2Connector.setIdleTimeout(15000);
|
||||
server.addConnector(http2Connector);
|
||||
|
|
|
@ -45,13 +45,13 @@ public class TestEndpointMultiplePublishProblem
|
|||
private static String default_impl = System.getProperty("com.sun.net.httpserver.HttpServerProvider");
|
||||
|
||||
@BeforeAll
|
||||
public static void change_Impl()
|
||||
public static void changeImpl()
|
||||
{
|
||||
System.setProperty("com.sun.net.httpserver.HttpServerProvider", JettyHttpServerProvider.class.getName());
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void restore_Impl()
|
||||
public static void restoreImpl()
|
||||
{
|
||||
if (default_impl != null)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Single()
|
||||
public void testRFCSingle()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"";
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Double()
|
||||
public void testRFCDouble()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||
|
@ -86,7 +86,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_Triple()
|
||||
public void testRFCTriple()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||
|
@ -105,7 +105,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109 and RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC_PathExample()
|
||||
public void testRFCPathExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
|
||||
|
@ -122,7 +122,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2109
|
||||
*/
|
||||
@Test
|
||||
public void testRFC2109_CookieSpoofingExample()
|
||||
public void testRFC2109CookieSpoofingExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; " +
|
||||
"session_id=\"1234\"; " +
|
||||
|
@ -139,7 +139,7 @@ public class CookieCutterTest
|
|||
* Example from RFC2965
|
||||
*/
|
||||
@Test
|
||||
public void testRFC2965_CookieSpoofingExample()
|
||||
public void testRFC2965CookieSpoofingExample()
|
||||
{
|
||||
String rawCookie = "$Version=\"1\"; session_id=\"1234\", " +
|
||||
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||
|
@ -160,7 +160,7 @@ public class CookieCutterTest
|
|||
* Example from RFC6265
|
||||
*/
|
||||
@Test
|
||||
public void testRFC6265_SidExample()
|
||||
public void testRFC6265SidExample()
|
||||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42";
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class CookieCutterTest
|
|||
* Example from RFC6265
|
||||
*/
|
||||
@Test
|
||||
public void testRFC6265_SidLangExample()
|
||||
public void testRFC6265SidLangExample()
|
||||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42; lang=en-US";
|
||||
|
||||
|
|
|
@ -32,9 +32,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class HttpFieldTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testContainsSimple() throws Exception
|
||||
public void testContainsSimple()
|
||||
{
|
||||
HttpField field = new HttpField("name", "SomeValue");
|
||||
assertTrue(field.contains("somevalue"));
|
||||
|
@ -50,7 +49,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCaseInsensitiveHashcode_KnownField() throws Exception
|
||||
public void testCaseInsensitiveHashcodeKnownField()
|
||||
{
|
||||
HttpField fieldFoo1 = new HttpField("Cookie", "foo");
|
||||
HttpField fieldFoo2 = new HttpField("cookie", "foo");
|
||||
|
@ -59,7 +58,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCaseInsensitiveHashcode_UnknownField() throws Exception
|
||||
public void testCaseInsensitiveHashcodeUnknownField()
|
||||
{
|
||||
HttpField fieldFoo1 = new HttpField("X-Foo", "bar");
|
||||
HttpField fieldFoo2 = new HttpField("x-foo", "bar");
|
||||
|
@ -68,7 +67,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContainsList() throws Exception
|
||||
public void testContainsList()
|
||||
{
|
||||
HttpField field = new HttpField("name", ",aaa,Bbb,CCC, ddd , e e, \"\\\"f,f\\\"\", ");
|
||||
assertTrue(field.contains("aaa"));
|
||||
|
@ -91,7 +90,7 @@ public class HttpFieldTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testQualityContainsList() throws Exception
|
||||
public void testQualityContainsList()
|
||||
{
|
||||
HttpField field;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
public class HttpGeneratorServerTest
|
||||
{
|
||||
@Test
|
||||
public void test_0_9() throws Exception
|
||||
public void test09() throws Exception
|
||||
{
|
||||
ByteBuffer header = BufferUtil.allocate(8096);
|
||||
ByteBuffer content = BufferUtil.toBuffer("0123456789");
|
||||
|
|
|
@ -48,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class HttpParserTest
|
||||
{
|
||||
/**
|
||||
|
@ -69,16 +70,16 @@ public class HttpParserTest
|
|||
int remaining = buffer.remaining();
|
||||
while (!parser.isState(State.END) && remaining > 0)
|
||||
{
|
||||
int was_remaining = remaining;
|
||||
int wasRemaining = remaining;
|
||||
parser.parseNext(buffer);
|
||||
remaining = buffer.remaining();
|
||||
if (remaining == was_remaining)
|
||||
if (remaining == wasRemaining)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HttpMethodTest()
|
||||
public void testHttpMethod()
|
||||
{
|
||||
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("Wibble ")));
|
||||
assertNull(HttpMethod.lookAheadGet(BufferUtil.toBuffer("GET")));
|
||||
|
@ -1488,7 +1489,7 @@ public class HttpParserTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testResponseReasonIso8859_1()
|
||||
public void testResponseReasonIso88591()
|
||||
{
|
||||
ByteBuffer buffer = BufferUtil.toBuffer(
|
||||
"HTTP/1.1 302 déplacé temporairement\r\n" +
|
||||
|
|
|
@ -119,6 +119,7 @@ public class HttpURITest
|
|||
@Test
|
||||
public void testExtB() throws Exception
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
for (String value : new String[]{"a", "abcdABCD", "\u00C0", "\u697C", "\uD869\uDED5", "\uD840\uDC08"})
|
||||
{
|
||||
HttpURI uri = new HttpURI("/path?value=" + URLEncoder.encode(value, "UTF-8"));
|
||||
|
|
|
@ -29,13 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
public class MimeTypesTest
|
||||
{
|
||||
@Test
|
||||
public void testGetMimeByExtension_Gzip()
|
||||
public void testGetMimeByExtensionGzip()
|
||||
{
|
||||
assertMimeTypeByExtension("application/gzip", "test.gz");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png()
|
||||
public void testGetMimeByExtensionPng()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "test.png");
|
||||
assertMimeTypeByExtension("image/png", "TEST.PNG");
|
||||
|
@ -43,26 +43,26 @@ public class MimeTypesTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_MultiDot()
|
||||
public void testGetMimeByExtensionPngMultiDot()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "org.eclipse.jetty.Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_DeepPath()
|
||||
public void testGetMimeByExtensionPngDeepPath()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png", "/org/eclipse/jetty/Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Text()
|
||||
public void testGetMimeByExtensionText()
|
||||
{
|
||||
assertMimeTypeByExtension("text/plain", "test.txt");
|
||||
assertMimeTypeByExtension("text/plain", "TEST.TXT");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_NoExtension()
|
||||
public void testGetMimeByExtensionNoExtension()
|
||||
{
|
||||
MimeTypes mimetypes = new MimeTypes();
|
||||
String contentType = mimetypes.getMimeByExtension("README");
|
||||
|
|
|
@ -31,7 +31,7 @@ public class QuotedQualityCSVTest
|
|||
{
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example1()
|
||||
public void test7231Sec532Example1()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue(" audio/*; q=0.2, audio/basic");
|
||||
|
@ -39,7 +39,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example2()
|
||||
public void test7231Sec532Example2()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/plain; q=0.5, text/html,");
|
||||
|
@ -48,7 +48,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example3()
|
||||
public void test7231Sec532Example3()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/*, text/plain, text/plain;format=flowed, */*");
|
||||
|
@ -58,7 +58,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example3_most_specific()
|
||||
public void test7231532Example3MostSpecific()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV(QuotedQualityCSV.MOST_SPECIFIC_MIME_ORDERING);
|
||||
values.addValue("text/*, text/plain, text/plain;format=flowed, */*");
|
||||
|
@ -67,7 +67,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_2_example4()
|
||||
public void test7231Sec532Example4()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("text/*;q=0.3, text/html;q=0.7, text/html;level=1,");
|
||||
|
@ -82,7 +82,7 @@ public class QuotedQualityCSVTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test7231_5_3_4_example1()
|
||||
public void test7231Sec534Example1()
|
||||
{
|
||||
QuotedQualityCSV values = new QuotedQualityCSV();
|
||||
values.addValue("compress, gzip");
|
||||
|
|
|
@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
public class SyntaxTest
|
||||
{
|
||||
@Test
|
||||
public void testRequireValidRFC2616Token_Good()
|
||||
public void testRequireValidRFC2616TokenGood()
|
||||
{
|
||||
String[] tokens = {
|
||||
"name",
|
||||
|
@ -50,7 +50,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC2616Token_Bad()
|
||||
public void testRequireValidRFC2616TokenBad()
|
||||
{
|
||||
String[] tokens = {
|
||||
"\"name\"",
|
||||
|
@ -81,7 +81,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC6265CookieValue_Good()
|
||||
public void testRequireValidRFC6265CookieValueGood()
|
||||
{
|
||||
String[] values = {
|
||||
"value",
|
||||
|
@ -102,7 +102,7 @@ public class SyntaxTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRequireValidRFC6265CookieValue_Bad()
|
||||
public void testRequireValidRFC6265CookieValueBad()
|
||||
{
|
||||
String[] values = {
|
||||
"va\tlue",
|
||||
|
|
|
@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class PathMappingsTest
|
||||
{
|
||||
private void assertMatch(PathMappings<String> pathmap, String path, String expectedValue)
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ServletPathSpecOrderTest
|
|||
data.add(Arguments.of("/downloads/script.gz", "gzipped"));
|
||||
data.add(Arguments.of("/animal/arhive.gz", "animals"));
|
||||
data.add(Arguments.of("/Other/path", "default"));
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
data.add(Arguments.of("/\u20ACuro/path", "money"));
|
||||
data.add(Arguments.of("/", "root"));
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class UriTemplatePathSpecTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testExactPathSpec_TestWebapp()
|
||||
public void testExactPathSpecTestWebapp()
|
||||
{
|
||||
UriTemplatePathSpec spec = new UriTemplatePathSpec("/deep.thought/");
|
||||
assertEquals("/deep.thought/", spec.getDeclaration(), "Spec.pathSpec");
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ProxyProtocolTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_PROXY_GET_v1() throws Exception
|
||||
public void testProxyGetV1() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ public class ProxyProtocolTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_PROXY_GET_v2() throws Exception
|
||||
public void testProxyGetV2() throws Exception
|
||||
{
|
||||
startServer(new AbstractHandler()
|
||||
{
|
||||
|
|
|
@ -213,8 +213,8 @@ public class SmallThreadPoolLoadTest extends AbstractTest
|
|||
}
|
||||
case "POST":
|
||||
{
|
||||
int content_length = request.getContentLength();
|
||||
ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(content_length > 0 ? content_length : 16 * 1024);
|
||||
int contentLength = request.getContentLength();
|
||||
ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(contentLength > 0 ? contentLength : 16 * 1024);
|
||||
IO.copy(request.getInputStream(), bout);
|
||||
response.getOutputStream().write(bout.getBuf(), 0, bout.getCount());
|
||||
break;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class HpackDecoderTest
|
|||
*/
|
||||
|
||||
@Test
|
||||
public void testDecodeD_3() throws Exception
|
||||
public void testDecodeD3() throws Exception
|
||||
{
|
||||
HpackDecoder decoder = new HpackDecoder(4096, 8192);
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeD_4() throws Exception
|
||||
public void testDecodeD4() throws Exception
|
||||
{
|
||||
HpackDecoder decoder = new HpackDecoder(4096, 8192);
|
||||
|
||||
|
@ -277,7 +277,7 @@ public class HpackDecoderTest
|
|||
|
||||
/* 8.1.2.1. Pseudo-Header Fields */
|
||||
@Test
|
||||
public void test8_1_2_1_PsuedoHeaderFields() throws Exception
|
||||
public void test8121PseudoHeaderFields() throws Exception
|
||||
{
|
||||
// 1:Sends a HEADERS frame that contains a unknown pseudo-header field
|
||||
MetaDataBuilder mdb = new MetaDataBuilder(4096);
|
||||
|
@ -329,7 +329,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1_2_2_ConnectionSpecificHeaderFields() throws Exception
|
||||
public void test8122ConnectionSpecificHeaderFields() throws Exception
|
||||
{
|
||||
MetaDataBuilder mdb;
|
||||
|
||||
|
@ -366,7 +366,7 @@ public class HpackDecoderTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1_2_3_RequestPseudoHeaderFields() throws Exception
|
||||
public void test8123RequestPseudoHeaderFields() throws Exception
|
||||
{
|
||||
{
|
||||
MetaDataBuilder mdb = new MetaDataBuilder(4096);
|
||||
|
|
|
@ -145,6 +145,7 @@ public class HpackTest
|
|||
ByteBuffer buffer = BufferUtil.allocate(16 * 1024);
|
||||
|
||||
HttpFields fields0 = new HttpFields();
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
fields0.add("Cookie", "[\uD842\uDF9F]");
|
||||
fields0.add("custom-key", "[\uD842\uDF9F]");
|
||||
Response original0 = new MetaData.Response(HttpVersion.HTTP_2, 200, fields0);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_1()
|
||||
public void testEncodeExampleD11()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -146,7 +146,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_1()
|
||||
public void testDecodeExampleD11()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("77EaFF"));
|
||||
buf.position(2);
|
||||
|
@ -155,7 +155,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_2()
|
||||
public void testEncodeExampleD12()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -170,7 +170,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_2()
|
||||
public void testDecodeExampleD12()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("881f9a0aff"));
|
||||
buf.position(2);
|
||||
|
@ -179,7 +179,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExampleD_1_3()
|
||||
public void testEncodeExampleD13()
|
||||
{
|
||||
ByteBuffer buf = BufferUtil.allocate(16);
|
||||
int p = BufferUtil.flipToFill(buf);
|
||||
|
@ -194,7 +194,7 @@ public class NBitIntegerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeExampleD_1_3()
|
||||
public void testDecodeExampleD13()
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(TypeUtil.fromHexString("882aFf"));
|
||||
buf.position(1);
|
||||
|
|
|
@ -34,11 +34,11 @@ public class H2SpecServer
|
|||
|
||||
Server server = new Server();
|
||||
|
||||
HttpConfiguration http_config = new HttpConfiguration();
|
||||
http_config.setRequestHeaderSize(16 * 1024);
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
httpConfig.setRequestHeaderSize(16 * 1024);
|
||||
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(http_config);
|
||||
HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(http_config);
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(httpConfig);
|
||||
HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(httpConfig);
|
||||
ServerConnector connector = new ServerConnector(server, http, h2c);
|
||||
connector.setPort(port);
|
||||
server.addConnector(connector);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_0_Simple() throws Exception
|
||||
public void testHTTP10Simple() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_1_Simple() throws Exception
|
||||
public void testHTTP11Simple() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_1_1_Upgrade() throws Exception
|
||||
public void testHTTP11Upgrade() throws Exception
|
||||
{
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_2_0_Direct() throws Exception
|
||||
public void testHTTP20Direct() throws Exception
|
||||
{
|
||||
final CountDownLatch latch = new CountDownLatch(3);
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHTTP_2_0_DirectWithoutH2C() throws Exception
|
||||
public void testHTTP20DirectWithoutH2C() throws Exception
|
||||
{
|
||||
AtomicLong fills = new AtomicLong();
|
||||
// Remove "h2c", leaving only "http/1.1".
|
||||
|
|
|
@ -383,13 +383,14 @@ public class HTTP2ServerTest extends AbstractServerTest
|
|||
@Test
|
||||
public void testNonISOHeader() throws Exception
|
||||
{
|
||||
try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class))
|
||||
try (StacklessLogging ignored = new StacklessLogging(HttpChannel.class))
|
||||
{
|
||||
startServer(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
// Invalid header name, the connection must be closed.
|
||||
response.setHeader("Euro_(\u20AC)", "42");
|
||||
}
|
||||
|
|
|
@ -47,13 +47,10 @@ public class EmbeddedQueryManagerTest
|
|||
public static final String DEFAULT_CACHE_NAME = "session_test_cache";
|
||||
|
||||
@Test
|
||||
public void test() throws Exception
|
||||
public void test()
|
||||
{
|
||||
|
||||
String _name = DEFAULT_CACHE_NAME + System.currentTimeMillis();
|
||||
EmbeddedCacheManager _manager;
|
||||
|
||||
_manager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build());
|
||||
String name = DEFAULT_CACHE_NAME + System.currentTimeMillis();
|
||||
EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build());
|
||||
|
||||
//TODO verify that this is being indexed properly, if you change expiry to something that is not a valid field it still passes the tests
|
||||
SearchMapping mapping = new SearchMapping();
|
||||
|
@ -62,7 +59,7 @@ public class EmbeddedQueryManagerTest
|
|||
properties.put(Environment.MODEL_MAPPING, mapping);
|
||||
properties.put("hibernate.search.default.indexBase", MavenTestingUtils.getTargetTestingDir().getAbsolutePath());
|
||||
|
||||
Configuration dcc = _manager.getDefaultCacheConfiguration();
|
||||
Configuration dcc = cacheManager.getDefaultCacheConfiguration();
|
||||
ConfigurationBuilder b = new ConfigurationBuilder();
|
||||
if (dcc != null)
|
||||
b = b.read(dcc);
|
||||
|
@ -70,8 +67,8 @@ public class EmbeddedQueryManagerTest
|
|||
b.indexing().index(Index.ALL).addIndexedEntity(SessionData.class).withProperties(properties);
|
||||
Configuration c = b.build();
|
||||
|
||||
_manager.defineConfiguration(_name, c);
|
||||
Cache<String, SessionData> _cache = _manager.getCache(_name);
|
||||
cacheManager.defineConfiguration(name, c);
|
||||
Cache<String, SessionData> cache = cacheManager.getCache(name);
|
||||
|
||||
//put some sessions into the cache
|
||||
int numSessions = 10;
|
||||
|
@ -92,11 +89,11 @@ public class EmbeddedQueryManagerTest
|
|||
expiredSessions.add("sd" + i);
|
||||
|
||||
//add to cache
|
||||
_cache.put("sd" + i, sd);
|
||||
cache.put("sd" + i, sd);
|
||||
}
|
||||
|
||||
//run the query
|
||||
QueryManager qm = new EmbeddedQueryManager(_cache);
|
||||
QueryManager qm = new EmbeddedQueryManager(cache);
|
||||
Set<String> queryResult = qm.queryExpiredSessions(currentTime);
|
||||
|
||||
// Check that the result is correct
|
||||
|
|
|
@ -70,7 +70,7 @@ public class RemoteQueryManagerTest
|
|||
serCtx.registerProtoFiles(fds);
|
||||
serCtx.registerMarshaller(new SessionDataMarshaller());
|
||||
|
||||
RemoteCache<String, SessionData> _cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME);
|
||||
RemoteCache<String, SessionData> cache = remoteCacheManager.getCache(DEFAULT_CACHE_NAME);
|
||||
|
||||
ByteArrayOutputStream baos;
|
||||
try (InputStream is = RemoteQueryManagerTest.class.getClassLoader().getResourceAsStream("session.proto"))
|
||||
|
@ -106,12 +106,12 @@ public class RemoteQueryManagerTest
|
|||
expiredSessions.add(id);
|
||||
|
||||
//add to cache
|
||||
_cache.put(id, sd);
|
||||
assertNotNull(_cache.get(id));
|
||||
cache.put(id, sd);
|
||||
assertNotNull(cache.get(id));
|
||||
}
|
||||
|
||||
//run the query
|
||||
QueryManager qm = new RemoteQueryManager(_cache);
|
||||
QueryManager qm = new RemoteQueryManager(cache);
|
||||
Set<String> queryResult = qm.queryExpiredSessions(currentTime);
|
||||
|
||||
// Check that the result is correct
|
||||
|
|
|
@ -842,6 +842,11 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
{
|
||||
interest = true;
|
||||
_fillState = FillState.INTERESTED;
|
||||
if (_flushState == FlushState.IDLE && BufferUtil.hasContent(_encryptedOutput))
|
||||
{
|
||||
_flushState = FlushState.WRITING;
|
||||
write = _encryptedOutput;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1259,9 +1264,26 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
{
|
||||
// If we still can't flush, but we are not closing the endpoint,
|
||||
// let's just flush the encrypted output in the background.
|
||||
ByteBuffer write = _encryptedOutput;
|
||||
if (BufferUtil.hasContent(write))
|
||||
endPoint.write(Callback.from(Callback.NOOP::succeeded, t -> endPoint.close()), write);
|
||||
ByteBuffer write = null;
|
||||
synchronized (_decryptedEndPoint)
|
||||
{
|
||||
if (BufferUtil.hasContent(_encryptedOutput))
|
||||
{
|
||||
write = _encryptedOutput;
|
||||
_flushState = FlushState.WRITING;
|
||||
}
|
||||
}
|
||||
if (write != null)
|
||||
{
|
||||
endPoint.write(Callback.from(() ->
|
||||
{
|
||||
synchronized (_decryptedEndPoint)
|
||||
{
|
||||
_flushState = FlushState.IDLE;
|
||||
releaseEncryptedOutputBuffer();
|
||||
}
|
||||
}, t -> endPoint.close()), write);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1471,19 +1493,23 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
public void succeeded()
|
||||
{
|
||||
boolean fillable;
|
||||
boolean interested;
|
||||
synchronized (_decryptedEndPoint)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("IncompleteWriteCB succeeded {}", SslConnection.this);
|
||||
|
||||
releaseEncryptedOutputBuffer();
|
||||
_flushState = FlushState.IDLE;
|
||||
|
||||
interested = _fillState == FillState.INTERESTED;
|
||||
fillable = _fillState == FillState.WAIT_FOR_FLUSH;
|
||||
if (fillable)
|
||||
_fillState = FillState.IDLE;
|
||||
}
|
||||
|
||||
if (fillable)
|
||||
if (interested)
|
||||
ensureFillInterested();
|
||||
else if (fillable)
|
||||
_decryptedEndPoint.getFillInterest().fillable();
|
||||
|
||||
_decryptedEndPoint.getWriteFlusher().completeWrite();
|
||||
|
@ -1502,7 +1528,8 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
releaseEncryptedOutputBuffer();
|
||||
|
||||
_flushState = FlushState.IDLE;
|
||||
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH;
|
||||
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH ||
|
||||
_fillState == FillState.INTERESTED;
|
||||
if (failFillInterest)
|
||||
_fillState = FillState.IDLE;
|
||||
}
|
||||
|
|
|
@ -146,10 +146,10 @@ public class CyclicTimeoutTest
|
|||
QueuedThreadPool pool = new QueuedThreadPool(200);
|
||||
pool.start();
|
||||
|
||||
long test_until = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500);
|
||||
long testUntil = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500);
|
||||
|
||||
assertTrue(_timeout.schedule(100, TimeUnit.MILLISECONDS));
|
||||
while (System.nanoTime() < test_until)
|
||||
while (System.nanoTime() < testUntil)
|
||||
{
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
pool.execute(() ->
|
||||
|
|
|
@ -744,7 +744,7 @@ public class SocketChannelEndPointTest
|
|||
return;
|
||||
}
|
||||
|
||||
EndPoint _endp = getEndPoint();
|
||||
EndPoint endp = getEndPoint();
|
||||
try
|
||||
{
|
||||
_last = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
|
||||
|
@ -757,17 +757,17 @@ public class SocketChannelEndPointTest
|
|||
BufferUtil.compact(_in);
|
||||
if (BufferUtil.isFull(_in))
|
||||
throw new IllegalStateException("FULL " + BufferUtil.toDetailString(_in));
|
||||
int filled = _endp.fill(_in);
|
||||
int filled = endp.fill(_in);
|
||||
if (filled > 0)
|
||||
progress = true;
|
||||
|
||||
// If the tests wants to block, then block
|
||||
while (_blockAt.get() > 0 && _endp.isOpen() && _in.remaining() < _blockAt.get())
|
||||
while (_blockAt.get() > 0 && endp.isOpen() && _in.remaining() < _blockAt.get())
|
||||
{
|
||||
FutureCallback future = _blockingRead = new FutureCallback();
|
||||
fillInterested();
|
||||
future.get();
|
||||
filled = _endp.fill(_in);
|
||||
filled = endp.fill(_in);
|
||||
progress |= filled > 0;
|
||||
}
|
||||
|
||||
|
@ -783,18 +783,18 @@ public class SocketChannelEndPointTest
|
|||
for (int i = 0; i < _writeCount.get(); i++)
|
||||
{
|
||||
FutureCallback blockingWrite = new FutureCallback();
|
||||
_endp.write(blockingWrite, out.asReadOnlyBuffer());
|
||||
endp.write(blockingWrite, out.asReadOnlyBuffer());
|
||||
blockingWrite.get();
|
||||
}
|
||||
progress = true;
|
||||
}
|
||||
|
||||
// are we done?
|
||||
if (_endp.isInputShutdown())
|
||||
_endp.shutdownOutput();
|
||||
if (endp.isInputShutdown())
|
||||
endp.shutdownOutput();
|
||||
}
|
||||
|
||||
if (_endp.isOpen())
|
||||
if (endp.isOpen())
|
||||
fillInterested();
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -803,9 +803,9 @@ public class SocketChannelEndPointTest
|
|||
try
|
||||
{
|
||||
FutureCallback blockingWrite = new FutureCallback();
|
||||
_endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
|
||||
endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
|
||||
blockingWrite.get();
|
||||
_endp.shutdownOutput();
|
||||
endp.shutdownOutput();
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
|
|
|
@ -484,9 +484,6 @@ public class SslConnectionTest
|
|||
server.configureBlocking(false);
|
||||
_manager.accept(server);
|
||||
|
||||
//__startBlocking.set(5);
|
||||
//__blockFor.set(3);
|
||||
|
||||
client.getOutputStream().write("Short".getBytes(StandardCharsets.UTF_8));
|
||||
byte[] buffer = new byte[1024];
|
||||
int len = client.getInputStream().read(buffer);
|
||||
|
@ -514,7 +511,7 @@ public class SslConnectionTest
|
|||
assertTrue(__onIncompleteFlush.get());
|
||||
((TestEP)_lastEndp).getWriteFlusher().completeWrite();
|
||||
len = client.getInputStream().read(buffer);
|
||||
assertThat(len, is(len));
|
||||
assertThat(len, is(-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,37 +71,37 @@ public class StringReplaceBenchmark
|
|||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Growth(Blackhole blackhole)
|
||||
public void testJavaStringReplaceGrowth(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", "FOOBAR"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Same(Blackhole blackhole)
|
||||
public void testJavaStringReplaceSame(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", "X"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJavaStringReplace_Reduce(Blackhole blackhole)
|
||||
public void testJavaStringReplaceReduce(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(input.replace("'", ""));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Growth(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceGrowth(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", "FOOBAR"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Same(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceSame(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", "X"));
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void testJettyStringUtilReplace_Reduce(Blackhole blackhole)
|
||||
public void testJettyStringUtilReplaceReduce(Blackhole blackhole)
|
||||
{
|
||||
blackhole.consume(StringUtil.replace(input, "'", ""));
|
||||
}
|
||||
|
|
|
@ -32,13 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class IntegrationTestGetContent
|
||||
{
|
||||
@Test
|
||||
public void get_content_response()
|
||||
public void getContentResponse()
|
||||
throws Exception
|
||||
{
|
||||
int port = getPort();
|
||||
|
|
|
@ -194,10 +194,10 @@ public class TestOSGiUtil
|
|||
|
||||
protected static Bundle getBundle(BundleContext bundleContext, String symbolicName)
|
||||
{
|
||||
Map<String, Bundle> _bundles = new HashMap<>();
|
||||
Map<String, Bundle> bundles = new HashMap<>();
|
||||
for (Bundle b : bundleContext.getBundles())
|
||||
{
|
||||
Bundle prevBundle = _bundles.put(b.getSymbolicName(), b);
|
||||
Bundle prevBundle = bundles.put(b.getSymbolicName(), b);
|
||||
String err = prevBundle != null ? "2 versions of the bundle " + b.getSymbolicName() +
|
||||
" " +
|
||||
b.getHeaders().get("Bundle-Version") +
|
||||
|
@ -205,7 +205,7 @@ public class TestOSGiUtil
|
|||
prevBundle.getHeaders().get("Bundle-Version") : "";
|
||||
assertNull(err, prevBundle);
|
||||
}
|
||||
return _bundles.get(symbolicName);
|
||||
return bundles.get(symbolicName);
|
||||
}
|
||||
|
||||
protected static void assertActiveBundle(BundleContext bundleContext, String symbolicName) throws Exception
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TestConfiguration
|
|||
@Test
|
||||
public void testIt() throws Exception
|
||||
{
|
||||
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ public class TestConfiguration
|
|||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(old_loader);
|
||||
Thread.currentThread().setContextClassLoader(oldLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,14 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration
|
|||
if (defaultContextPath != null)
|
||||
out.tag("default-context-path", defaultContextPath);
|
||||
|
||||
String requestEncoding = (String)context.getAttribute("request-character-encoding");
|
||||
if (!StringUtil.isBlank(requestEncoding))
|
||||
out.tag("request-character-encoding", requestEncoding);
|
||||
|
||||
String responseEncoding = (String)context.getAttribute("response-character-encoding");
|
||||
if (!StringUtil.isBlank(responseEncoding))
|
||||
out.tag("response-character-encoding", responseEncoding);
|
||||
|
||||
//add the name of the origin attribute, if it is being used
|
||||
if (StringUtil.isNotBlank(_originAttribute))
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
|||
import org.eclipse.jetty.toolchain.test.FS;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -43,6 +44,7 @@ public class TestQuickStart
|
|||
{
|
||||
File testDir;
|
||||
File webInf;
|
||||
Server server;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp()
|
||||
|
@ -51,6 +53,13 @@ public class TestQuickStart
|
|||
FS.ensureEmpty(testDir);
|
||||
webInf = new File(testDir, "WEB-INF");
|
||||
FS.ensureDirExists(webInf);
|
||||
server = new Server();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
server.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -59,8 +68,6 @@ public class TestQuickStart
|
|||
File quickstartXml = new File(webInf, "quickstart-web.xml");
|
||||
assertFalse(quickstartXml.exists());
|
||||
|
||||
Server server = new Server();
|
||||
|
||||
//generate a quickstart-web.xml
|
||||
WebAppContext quickstart = new WebAppContext();
|
||||
quickstart.addConfiguration(new QuickStartConfiguration());
|
||||
|
@ -96,8 +103,6 @@ public class TestQuickStart
|
|||
ServletHolder sh = webapp.getServletHandler().getMappedServlet("/").getResource();
|
||||
assertNotNull(sh);
|
||||
assertEquals("foo", sh.getName());
|
||||
|
||||
server.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -106,8 +111,6 @@ public class TestQuickStart
|
|||
File quickstartXml = new File(webInf, "quickstart-web.xml");
|
||||
assertFalse(quickstartXml.exists());
|
||||
|
||||
Server server = new Server();
|
||||
|
||||
// generate a quickstart-web.xml
|
||||
WebAppContext quickstart = new WebAppContext();
|
||||
quickstart.setResourceBase(testDir.getAbsolutePath());
|
||||
|
@ -138,7 +141,40 @@ public class TestQuickStart
|
|||
// verify the context path is the default-context-path
|
||||
assertEquals("/thisIsTheDefault", webapp.getContextPath());
|
||||
assertTrue(webapp.isContextPathDefault());
|
||||
}
|
||||
|
||||
server.stop();
|
||||
@Test
|
||||
public void testDefaultRequestAndResponseEncodings() throws Exception
|
||||
{
|
||||
File quickstartXml = new File(webInf, "quickstart-web.xml");
|
||||
assertFalse(quickstartXml.exists());
|
||||
|
||||
// generate a quickstart-web.xml
|
||||
WebAppContext quickstart = new WebAppContext();
|
||||
quickstart.setResourceBase(testDir.getAbsolutePath());
|
||||
quickstart.addConfiguration(new QuickStartConfiguration());
|
||||
quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.GENERATE);
|
||||
quickstart.setAttribute(QuickStartConfiguration.ORIGIN_ATTRIBUTE, "origin");
|
||||
quickstart.setDescriptor(MavenTestingUtils.getTestResourceFile("web.xml").getAbsolutePath());
|
||||
quickstart.setContextPath("/foo");
|
||||
server.setHandler(quickstart);
|
||||
server.setDryRun(true);
|
||||
server.start();
|
||||
|
||||
assertTrue(quickstartXml.exists());
|
||||
|
||||
// quick start
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.addConfiguration(new QuickStartConfiguration());
|
||||
quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART);
|
||||
webapp.setResourceBase(testDir.getAbsolutePath());
|
||||
webapp.setClassLoader(new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader()));
|
||||
server.setHandler(webapp);
|
||||
|
||||
server.setDryRun(false);
|
||||
server.start();
|
||||
|
||||
assertEquals("ascii", webapp.getDefaultRequestCharacterEncoding());
|
||||
assertEquals("utf-16", webapp.getDefaultResponseCharacterEncoding());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
|
||||
<default-context-path>/thisIsTheDefault</default-context-path>
|
||||
<request-character-encoding>ascii</request-character-encoding>
|
||||
<response-character-encoding>utf-16</response-character-encoding>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
|
@ -99,27 +99,27 @@ public class ConstraintTest
|
|||
_config = _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
|
||||
_server.setConnectors(new Connector[]{_connector});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
SessionHandler _session = new SessionHandler();
|
||||
ContextHandler contextHandler = new ContextHandler();
|
||||
SessionHandler sessionHandler = new SessionHandler();
|
||||
|
||||
TestLoginService _loginService = new TestLoginService(TEST_REALM);
|
||||
TestLoginService loginService = new TestLoginService(TEST_REALM);
|
||||
|
||||
_loginService.putUser("user0", new Password("password"), new String[]{});
|
||||
_loginService.putUser("user", new Password("password"), new String[]{"user"});
|
||||
_loginService.putUser("user2", new Password("password"), new String[]{"user"});
|
||||
_loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"});
|
||||
_loginService.putUser("user3", new Password("password"), new String[]{"foo"});
|
||||
loginService.putUser("user0", new Password("password"), new String[]{});
|
||||
loginService.putUser("user", new Password("password"), new String[]{"user"});
|
||||
loginService.putUser("user2", new Password("password"), new String[]{"user"});
|
||||
loginService.putUser("admin", new Password("password"), new String[]{"user", "administrator"});
|
||||
loginService.putUser("user3", new Password("password"), new String[]{"foo"});
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
contextHandler.setContextPath("/ctx");
|
||||
_server.setHandler(contextHandler);
|
||||
contextHandler.setHandler(sessionHandler);
|
||||
|
||||
_server.addBean(_loginService);
|
||||
_server.addBean(loginService);
|
||||
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
RequestHandler _handler = new RequestHandler();
|
||||
_security.setHandler(_handler);
|
||||
sessionHandler.setHandler(_security);
|
||||
RequestHandler requestHandler = new RequestHandler();
|
||||
_security.setHandler(requestHandler);
|
||||
|
||||
_security.setConstraintMappings(getConstraintMappings(), getKnownRoles());
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class ConstraintTest
|
|||
* @throws Exception if test fails
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_1() throws Exception
|
||||
public void testSecurityElementExample131() throws Exception
|
||||
{
|
||||
ServletSecurityElement element = new ServletSecurityElement();
|
||||
List<ConstraintMapping> mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath("foo", "/foo/*", element);
|
||||
|
@ -256,7 +256,7 @@ public class ConstraintTest
|
|||
* @throws Exception if test fails
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_2() throws Exception
|
||||
public void testSecurityElementExample132() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL);
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -274,7 +274,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(@HttpConstraint(EmptyRoleSemantic.DENY))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_3() throws Exception
|
||||
public void testSecurityElementExample133() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(EmptyRoleSemantic.DENY);
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -292,7 +292,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(@HttpConstraint(rolesAllowed = "R1"))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_4() throws Exception
|
||||
public void testSecurityElementExample134() throws Exception
|
||||
{
|
||||
HttpConstraintElement httpConstraintElement = new HttpConstraintElement(TransportGuarantee.NONE, "R1");
|
||||
ServletSecurityElement element = new ServletSecurityElement(httpConstraintElement);
|
||||
|
@ -317,7 +317,7 @@ public class ConstraintTest
|
|||
* transportGuarantee = TransportGuarantee.CONFIDENTIAL)})
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_5() throws Exception
|
||||
public void testSecurityElementExample135() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("GET", new HttpConstraintElement(TransportGuarantee.NONE, "R1")));
|
||||
|
@ -343,7 +343,7 @@ public class ConstraintTest
|
|||
* @ServletSecurity(value = @HttpConstraint(rolesAllowed = "R1"), httpMethodConstraints = @HttpMethodConstraint("GET"))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_6() throws Exception
|
||||
public void testSecurityElementExample136() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("GET"));
|
||||
|
@ -370,7 +370,7 @@ public class ConstraintTest
|
|||
* emptyRoleSemantic = EmptyRoleSemantic.DENY))
|
||||
*/
|
||||
@Test
|
||||
public void testSecurityElementExample13_7() throws Exception
|
||||
public void testSecurityElementExample137() throws Exception
|
||||
{
|
||||
List<HttpMethodConstraintElement> methodElements = new ArrayList<HttpMethodConstraintElement>();
|
||||
methodElements.add(new HttpMethodConstraintElement("TRACE", new HttpConstraintElement(EmptyRoleSemantic.DENY)));
|
||||
|
|
|
@ -79,12 +79,12 @@ public class DataConstraintsTest
|
|||
_connectorS = new LocalConnector(_server, https);
|
||||
_server.setConnectors(new Connector[]{_connector, _connectorS});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
ContextHandler contextHandler = new ContextHandler();
|
||||
_session = new SessionHandler();
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
contextHandler.setContextPath("/ctx");
|
||||
_server.setHandler(contextHandler);
|
||||
contextHandler.setHandler(_session);
|
||||
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
|
|
|
@ -67,21 +67,21 @@ public class SpecExampleConstraintTest
|
|||
_connector = new LocalConnector(_server);
|
||||
_server.setConnectors(new Connector[]{_connector});
|
||||
|
||||
ContextHandler _context = new ContextHandler();
|
||||
ContextHandler context = new ContextHandler();
|
||||
_session = new SessionHandler();
|
||||
|
||||
TestLoginService _loginService = new TestLoginService(TEST_REALM);
|
||||
TestLoginService loginService = new TestLoginService(TEST_REALM);
|
||||
|
||||
_loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES);
|
||||
_loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"});
|
||||
_loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"});
|
||||
_loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"});
|
||||
loginService.putUser("fred", new Password("password"), IdentityService.NO_ROLES);
|
||||
loginService.putUser("harry", new Password("password"), new String[]{"HOMEOWNER"});
|
||||
loginService.putUser("chris", new Password("password"), new String[]{"CONTRACTOR"});
|
||||
loginService.putUser("steven", new Password("password"), new String[]{"SALESCLERK"});
|
||||
|
||||
_context.setContextPath("/ctx");
|
||||
_server.setHandler(_context);
|
||||
_context.setHandler(_session);
|
||||
context.setContextPath("/ctx");
|
||||
_server.setHandler(context);
|
||||
context.setHandler(_session);
|
||||
|
||||
_server.addBean(_loginService);
|
||||
_server.addBean(loginService);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
@ -89,8 +89,8 @@ public class SpecExampleConstraintTest
|
|||
{
|
||||
_security = new ConstraintSecurityHandler();
|
||||
_session.setHandler(_security);
|
||||
RequestHandler _handler = new RequestHandler();
|
||||
_security.setHandler(_handler);
|
||||
RequestHandler handler = new RequestHandler();
|
||||
_security.setHandler(handler);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -113,10 +113,10 @@ public class SpnegoAuthenticatorTest
|
|||
};
|
||||
Request req = channel.getRequest();
|
||||
Response res = channel.getResponse();
|
||||
HttpFields http_fields = new HttpFields();
|
||||
HttpFields httpFields = new HttpFields();
|
||||
// Create a bogus Authorization header. We don't care about the actual credentials.
|
||||
http_fields.add(HttpHeader.AUTHORIZATION, "Basic asdf");
|
||||
MetaData.Request metadata = new MetaData.Request(http_fields);
|
||||
httpFields.add(HttpHeader.AUTHORIZATION, "Basic asdf");
|
||||
MetaData.Request metadata = new MetaData.Request(httpFields);
|
||||
metadata.setURI(new HttpURI("http://localhost"));
|
||||
req.setMetaData(metadata);
|
||||
|
||||
|
|
|
@ -60,10 +60,10 @@ public class MultiPartFormInputStream
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(MultiPartFormInputStream.class);
|
||||
private static final MultiMap<Part> EMPTY_MAP = new MultiMap<>(Collections.emptyMap());
|
||||
private final MultiMap<Part> _parts;
|
||||
private InputStream _in;
|
||||
private MultipartConfigElement _config;
|
||||
private String _contentType;
|
||||
private MultiMap<Part> _parts;
|
||||
private Throwable _err;
|
||||
private File _tmpDir;
|
||||
private File _contextTmpDir;
|
||||
|
@ -341,16 +341,19 @@ public class MultiPartFormInputStream
|
|||
if (_config == null)
|
||||
_config = new MultipartConfigElement(_contextTmpDir.getAbsolutePath());
|
||||
|
||||
MultiMap parts = new MultiMap();
|
||||
|
||||
if (in instanceof ServletInputStream)
|
||||
{
|
||||
if (((ServletInputStream)in).isFinished())
|
||||
{
|
||||
_parts = EMPTY_MAP;
|
||||
parts = EMPTY_MAP;
|
||||
_parsed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!_parsed)
|
||||
_in = new BufferedInputStream(in);
|
||||
_parts = parts;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -411,6 +414,9 @@ public class MultiPartFormInputStream
|
|||
parse();
|
||||
throwIfError();
|
||||
|
||||
if (_parts.isEmpty())
|
||||
return Collections.emptyList();
|
||||
|
||||
Collection<List<Part>> values = _parts.values();
|
||||
List<Part> parts = new ArrayList<>();
|
||||
for (List<Part> o : values)
|
||||
|
@ -471,9 +477,6 @@ public class MultiPartFormInputStream
|
|||
Handler handler = new Handler();
|
||||
try
|
||||
{
|
||||
// initialize
|
||||
_parts = new MultiMap<>();
|
||||
|
||||
// if its not a multipart request, don't parse it
|
||||
if (_contentType == null || !_contentType.startsWith("multipart/form-data"))
|
||||
return;
|
||||
|
|
|
@ -679,6 +679,11 @@ public class Request implements HttpServletRequest
|
|||
@Override
|
||||
public String getCharacterEncoding()
|
||||
{
|
||||
if (_characterEncoding == null)
|
||||
{
|
||||
if (_context != null)
|
||||
_characterEncoding = _context.getRequestCharacterEncoding();
|
||||
|
||||
if (_characterEncoding == null)
|
||||
{
|
||||
String contentType = getContentType();
|
||||
|
@ -690,6 +695,7 @@ public class Request implements HttpServletRequest
|
|||
_characterEncoding = charset;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _characterEncoding;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.eclipse.jetty.http.MetaData;
|
|||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.http.PreEncodedHttpField;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler.Context;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.util.AtomicBiInteger;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
|
@ -683,9 +684,18 @@ public class Response implements HttpServletResponse
|
|||
String encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType);
|
||||
if (encoding != null)
|
||||
return encoding;
|
||||
|
||||
encoding = MimeTypes.getCharsetInferredFromContentType(_contentType);
|
||||
if (encoding != null)
|
||||
return encoding;
|
||||
|
||||
Context context = _channel.getRequest().getContext();
|
||||
if (context != null)
|
||||
{
|
||||
encoding = context.getResponseCharacterEncoding();
|
||||
if (encoding != null)
|
||||
return encoding;
|
||||
}
|
||||
return StringUtil.__ISO_8859_1;
|
||||
}
|
||||
return _characterEncoding;
|
||||
|
@ -729,23 +739,42 @@ public class Response implements HttpServletResponse
|
|||
|
||||
if (_outputType == OutputType.NONE)
|
||||
{
|
||||
/* get encoding from Content-Type header */
|
||||
//first try explicit char encoding
|
||||
String encoding = _characterEncoding;
|
||||
|
||||
//try char set from mime type
|
||||
if (encoding == null)
|
||||
{
|
||||
if (_mimeType != null && _mimeType.isCharsetAssumed())
|
||||
encoding = _mimeType.getCharsetString();
|
||||
else
|
||||
}
|
||||
|
||||
//try char set assumed from content type
|
||||
if (encoding == null)
|
||||
{
|
||||
encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType);
|
||||
}
|
||||
|
||||
//try char set inferred from content type
|
||||
if (encoding == null)
|
||||
{
|
||||
encoding = MimeTypes.getCharsetInferredFromContentType(_contentType);
|
||||
if (encoding == null)
|
||||
encoding = StringUtil.__ISO_8859_1;
|
||||
setCharacterEncoding(encoding, EncodingFrom.INFERRED);
|
||||
}
|
||||
|
||||
//try any default char encoding for the context
|
||||
if (encoding == null)
|
||||
{
|
||||
Context context = _channel.getRequest().getContext();
|
||||
if (context != null)
|
||||
encoding = context.getResponseCharacterEncoding();
|
||||
}
|
||||
|
||||
//fallback to last resort iso-8859-1
|
||||
if (encoding == null)
|
||||
{
|
||||
encoding = StringUtil.__ISO_8859_1;
|
||||
setCharacterEncoding(encoding, EncodingFrom.INFERRED);
|
||||
}
|
||||
|
||||
Locale locale = getLocale();
|
||||
|
|
|
@ -55,9 +55,6 @@ public abstract class AbstractHandler extends ContainerLifeCycle implements Hand
|
|||
|
||||
private Server _server;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AbstractHandler()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -177,6 +177,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
private final Map<String, String> _initParams;
|
||||
private ClassLoader _classLoader;
|
||||
private boolean _contextPathDefault = true;
|
||||
private String _defaultRequestCharacterEncoding;
|
||||
private String _defaultResponseCharacterEncoding;
|
||||
private String _contextPath = "/";
|
||||
private String _contextPathEncoded = "/";
|
||||
|
||||
|
@ -1483,6 +1485,26 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
_contextPathDefault = true;
|
||||
}
|
||||
|
||||
public void setDefaultRequestCharacterEncoding(String encoding)
|
||||
{
|
||||
_defaultRequestCharacterEncoding = encoding;
|
||||
}
|
||||
|
||||
public String getDefaultRequestCharacterEncoding()
|
||||
{
|
||||
return _defaultRequestCharacterEncoding;
|
||||
}
|
||||
|
||||
public void setDefaultResponseCharacterEncoding(String encoding)
|
||||
{
|
||||
_defaultResponseCharacterEncoding = encoding;
|
||||
}
|
||||
|
||||
public String getDefaultResponseCharacterEncoding()
|
||||
{
|
||||
return _defaultResponseCharacterEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the current contextPath is from default settings
|
||||
*/
|
||||
|
@ -2877,7 +2899,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public String getRequestCharacterEncoding()
|
||||
{
|
||||
// TODO new in 4.0
|
||||
LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "getRequestCharacterEncoding()");
|
||||
return null;
|
||||
}
|
||||
|
@ -2888,7 +2909,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public void setRequestCharacterEncoding(String encoding)
|
||||
{
|
||||
// TODO new in 4.0
|
||||
LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "setRequestCharacterEncoding(String)");
|
||||
}
|
||||
|
||||
|
@ -2898,7 +2918,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public String getResponseCharacterEncoding()
|
||||
{
|
||||
// TODO new in 4.0
|
||||
LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "getResponseCharacterEncoding()");
|
||||
return null;
|
||||
}
|
||||
|
@ -2909,7 +2928,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public void setResponseCharacterEncoding(String encoding)
|
||||
{
|
||||
// TODO new in 4.0
|
||||
LOG.warn(UNIMPLEMENTED_USE_SERVLET_CONTEXT_HANDLER, "setResponseCharacterEncoding(String)");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,33 +188,33 @@ public class AsyncStressTest
|
|||
@Override
|
||||
public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
int read_before = 0;
|
||||
long sleep_for = -1;
|
||||
long suspend_for = -1;
|
||||
long resume_after = -1;
|
||||
long complete_after = -1;
|
||||
int readBefore = 0;
|
||||
long sleepFor = -1;
|
||||
long suspendFor = -1;
|
||||
long resumeAfter = -1;
|
||||
long completeAfter = -1;
|
||||
|
||||
final String uri = baseRequest.getHttpURI().toString();
|
||||
|
||||
if (request.getParameter("read") != null)
|
||||
read_before = Integer.parseInt(request.getParameter("read"));
|
||||
readBefore = Integer.parseInt(request.getParameter("read"));
|
||||
if (request.getParameter("sleep") != null)
|
||||
sleep_for = Integer.parseInt(request.getParameter("sleep"));
|
||||
sleepFor = Integer.parseInt(request.getParameter("sleep"));
|
||||
if (request.getParameter("suspend") != null)
|
||||
suspend_for = Integer.parseInt(request.getParameter("suspend"));
|
||||
suspendFor = Integer.parseInt(request.getParameter("suspend"));
|
||||
if (request.getParameter("resume") != null)
|
||||
resume_after = Integer.parseInt(request.getParameter("resume"));
|
||||
resumeAfter = Integer.parseInt(request.getParameter("resume"));
|
||||
if (request.getParameter("complete") != null)
|
||||
complete_after = Integer.parseInt(request.getParameter("complete"));
|
||||
completeAfter = Integer.parseInt(request.getParameter("complete"));
|
||||
|
||||
if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType()))
|
||||
{
|
||||
if (read_before > 0)
|
||||
if (readBefore > 0)
|
||||
{
|
||||
byte[] buf = new byte[read_before];
|
||||
byte[] buf = new byte[readBefore];
|
||||
request.getInputStream().read(buf);
|
||||
}
|
||||
else if (read_before < 0)
|
||||
else if (readBefore < 0)
|
||||
{
|
||||
InputStream in = request.getInputStream();
|
||||
int b = in.read();
|
||||
|
@ -224,13 +224,13 @@ public class AsyncStressTest
|
|||
}
|
||||
}
|
||||
|
||||
if (suspend_for >= 0)
|
||||
if (suspendFor >= 0)
|
||||
{
|
||||
final AsyncContext asyncContext = baseRequest.startAsync();
|
||||
asyncContext.addListener(__asyncListener);
|
||||
if (suspend_for > 0)
|
||||
asyncContext.setTimeout(suspend_for);
|
||||
if (complete_after > 0)
|
||||
if (suspendFor > 0)
|
||||
asyncContext.setTimeout(suspendFor);
|
||||
if (completeAfter > 0)
|
||||
{
|
||||
TimerTask complete = new TimerTask()
|
||||
{
|
||||
|
@ -259,17 +259,17 @@ public class AsyncStressTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(complete, complete_after);
|
||||
_timer.schedule(complete, completeAfter);
|
||||
}
|
||||
}
|
||||
else if (complete_after == 0)
|
||||
else if (completeAfter == 0)
|
||||
{
|
||||
response.setStatus(200);
|
||||
response.getOutputStream().println("COMPLETED " + request.getHeader("result"));
|
||||
baseRequest.setHandled(true);
|
||||
asyncContext.complete();
|
||||
}
|
||||
else if (resume_after > 0)
|
||||
else if (resumeAfter > 0)
|
||||
{
|
||||
TimerTask resume = new TimerTask()
|
||||
{
|
||||
|
@ -281,19 +281,19 @@ public class AsyncStressTest
|
|||
};
|
||||
synchronized (_timer)
|
||||
{
|
||||
_timer.schedule(resume, resume_after);
|
||||
_timer.schedule(resume, resumeAfter);
|
||||
}
|
||||
}
|
||||
else if (resume_after == 0)
|
||||
else if (resumeAfter == 0)
|
||||
{
|
||||
asyncContext.dispatch();
|
||||
}
|
||||
}
|
||||
else if (sleep_for >= 0)
|
||||
else if (sleepFor >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(sleep_for);
|
||||
Thread.sleep(sleepFor);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
|
||||
/**
|
||||
* ContextHandler for testing that implements some
|
||||
* CharEncoding methods from the servlet spec.
|
||||
*/
|
||||
public class CharEncodingContextHandler extends ContextHandler
|
||||
{
|
||||
class Context extends ContextHandler.Context
|
||||
{
|
||||
@Override
|
||||
public String getRequestCharacterEncoding()
|
||||
{
|
||||
return getDefaultRequestCharacterEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResponseCharacterEncoding()
|
||||
{
|
||||
return getDefaultResponseCharacterEncoding();
|
||||
}
|
||||
}
|
||||
|
||||
public CharEncodingContextHandler()
|
||||
{
|
||||
super();
|
||||
_scontext = new Context();
|
||||
}
|
||||
}
|
|
@ -81,6 +81,7 @@ public class DelayedServerTest extends HttpServerTestBase
|
|||
}
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -100,6 +101,7 @@ public class DelayedServerTest extends HttpServerTestBase
|
|||
}
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -154,17 +154,17 @@ public class DumpHandler extends AbstractHandler
|
|||
}
|
||||
}
|
||||
|
||||
String cookie_name = request.getParameter("CookieName");
|
||||
if (cookie_name != null && cookie_name.trim().length() > 0)
|
||||
String cookieName = request.getParameter("CookieName");
|
||||
if (cookieName != null && cookieName.trim().length() > 0)
|
||||
{
|
||||
String cookie_action = request.getParameter("Button");
|
||||
String cookieAction = request.getParameter("Button");
|
||||
try
|
||||
{
|
||||
String val = request.getParameter("CookieVal");
|
||||
val = val.replaceAll("[ \n\r=<>]", "?");
|
||||
Cookie cookie =
|
||||
new Cookie(cookie_name.trim(), val);
|
||||
if ("Clear Cookie".equals(cookie_action))
|
||||
new Cookie(cookieName.trim(), val);
|
||||
if ("Clear Cookie".equals(cookieAction))
|
||||
cookie.setMaxAge(0);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,9 @@ public class ErrorHandlerTest
|
|||
// produce an exception with a UTF-8 cause message
|
||||
if (target.startsWith("/utf8message/"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
String message = "Euro is € and \u20AC and %E2%82%AC";
|
||||
// @checkstyle-enable-check : AvoidEscapedUnicodeCharacters
|
||||
throw new ServletException(new RuntimeException(message));
|
||||
}
|
||||
}
|
||||
|
@ -455,8 +457,10 @@ public class ErrorHandlerTest
|
|||
|
||||
if (path.startsWith("/utf8"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
// we are Not expecting UTF-8 output, look for mangled ISO-8859-1 version
|
||||
assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC"));
|
||||
// @checkstyle-enabled-check : AvoidEscapedUnicodeCharacters
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,8 +560,10 @@ public class ErrorHandlerTest
|
|||
|
||||
if (path.startsWith("/utf8"))
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharacters
|
||||
// we are expecting UTF-8 output, look for it.
|
||||
assertThat("content", content, containsString("Euro is &euro; and \u20AC and %E2%82%AC"));
|
||||
// @checkstyle-enable-check : AvoidEscapedUnicodeCharacters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -840,7 +840,7 @@ public class GracefulStopTest
|
|||
int c = 0;
|
||||
try
|
||||
{
|
||||
int content_length = request.getContentLength();
|
||||
int contentLength = request.getContentLength();
|
||||
InputStream in = request.getInputStream();
|
||||
|
||||
while (true)
|
||||
|
@ -852,7 +852,7 @@ public class GracefulStopTest
|
|||
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
response.getWriter().printf("read %d/%d%n", c, content_length);
|
||||
response.getWriter().printf("read %d/%d%n", c, contentLength);
|
||||
}
|
||||
catch (Throwable th)
|
||||
{
|
||||
|
|
|
@ -878,6 +878,7 @@ public class HttpOutputTest
|
|||
response.setCharacterEncoding("UTF8");
|
||||
HttpOutput out = (HttpOutput)response.getOutputStream();
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
exp.print("\u20AC\u0939\uD55C");
|
||||
out.print("\u20AC\u0939\uD55C");
|
||||
exp.print("zero");
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
|
||||
public class HttpServerTestFixture
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
|
||||
// Useful constants
|
||||
protected static final long PAUSE = 10L;
|
||||
protected static final int LOOPS = 50;
|
||||
|
|
|
@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
|
||||
public class HttpWriterTest
|
||||
{
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
private HttpOutput _httpOut;
|
||||
private ByteBuffer _bytes;
|
||||
|
||||
|
@ -67,33 +68,33 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testSimpleUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
_writer.write("Now is the time");
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
writer.write("Now is the time");
|
||||
assertArrayEquals("Now is the time".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF16() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new EncodingHttpWriter(_httpOut, StringUtil.__UTF16);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertArrayEquals("How now \uFF22rown cow".getBytes(StandardCharsets.UTF_16), BufferUtil.toArray(_bytes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotCESU8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
String data = "xxx\uD801\uDC00xxx";
|
||||
_writer.write(data);
|
||||
writer.write(data);
|
||||
assertEquals("787878F0909080787878", TypeUtil.toHexString(BufferUtil.toArray(_bytes)));
|
||||
assertArrayEquals(data.getBytes(StandardCharsets.UTF_8), BufferUtil.toArray(_bytes));
|
||||
assertEquals(3 + 4 + 3, _bytes.remaining());
|
||||
|
@ -106,7 +107,7 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testMultiByteOverflowUTF8() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
final String singleByteStr = "a";
|
||||
final String multiByteDuplicateStr = "\uFF22";
|
||||
int remainSize = 1;
|
||||
|
@ -127,7 +128,7 @@ public class HttpWriterTest
|
|||
int length = HttpWriter.MAX_OUTPUT_CHARS - multiByteStrByteLength + remainSize + 1;
|
||||
sb.toString().getChars(0, length, buf, 0);
|
||||
|
||||
_writer.write(buf, 0, length);
|
||||
writer.write(buf, 0, length);
|
||||
|
||||
assertEquals(sb.toString(), new String(BufferUtil.toArray(_bytes), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
@ -135,20 +136,20 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testISO8859() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Iso88591HttpWriter(_httpOut);
|
||||
_writer.write("How now \uFF22rown cow");
|
||||
HttpWriter writer = new Iso88591HttpWriter(_httpOut);
|
||||
writer.write("How now \uFF22rown cow");
|
||||
assertEquals(new String(BufferUtil.toArray(_bytes), StandardCharsets.ISO_8859_1), "How now ?rown cow");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTF16x2() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
String source = "\uD842\uDF9F";
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
@ -166,7 +167,7 @@ public class HttpWriterTest
|
|||
@Test
|
||||
public void testMultiByteOverflowUTF16x2() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
final String singleByteStr = "a";
|
||||
int remainSize = 1;
|
||||
|
@ -186,7 +187,7 @@ public class HttpWriterTest
|
|||
String source = sb.toString();
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
@ -202,9 +203,9 @@ public class HttpWriterTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMultiByteOverflowUTF16x2_2() throws Exception
|
||||
public void testMultiByteOverflowUTF16X22() throws Exception
|
||||
{
|
||||
HttpWriter _writer = new Utf8HttpWriter(_httpOut);
|
||||
HttpWriter writer = new Utf8HttpWriter(_httpOut);
|
||||
|
||||
final String singleByteStr = "a";
|
||||
int remainSize = 1;
|
||||
|
@ -224,7 +225,7 @@ public class HttpWriterTest
|
|||
String source = sb.toString();
|
||||
|
||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
||||
_writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
writer.write(source.toCharArray(), 0, source.toCharArray().length);
|
||||
|
||||
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
|
||||
java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(baos, StandardCharsets.UTF_8);
|
||||
|
|
|
@ -252,7 +252,7 @@ public class InclusiveByteRangeTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRange_OpenEnded()
|
||||
public void testRangeOpenEnded()
|
||||
{
|
||||
assertSimpleRange(50, 499, "bytes=50-", 500);
|
||||
}
|
||||
|
@ -281,75 +281,75 @@ public class InclusiveByteRangeTest
|
|||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_SetPartiallyBad()
|
||||
public void testBadRangeSetPartiallyBad()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50,1-b,a-50");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_NoNumbers()
|
||||
public void testBadRangeNoNumbers()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=a-b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_Empty()
|
||||
public void testBadRangeEmpty()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_ZeroPrefixed()
|
||||
public void testBadRangeZeroPrefixed()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=01-050");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_Hex()
|
||||
public void testBadRangeHex()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=0F-FF");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testBadRange_TabWhitespace()
|
||||
public void testBadRangeTabWhitespace()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=\t1\t-\t50");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_TabDelim()
|
||||
public void testBadRangeTabDelim()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50\t90-101\t200-250");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_SemiColonDelim()
|
||||
public void testBadRangeSemiColonDelim()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1-50;90-101;200-250");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_NegativeSize()
|
||||
public void testBadRangeNegativeSize()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=50-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_DoubleDash()
|
||||
public void testBadRangeDoubleDash()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1--20");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_TrippleDash()
|
||||
public void testBadRangeTrippleDash()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=1---");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadRange_ZeroedNegativeSize()
|
||||
public void testBadRangeZeroedNegativeSize()
|
||||
{
|
||||
assertBadRangeList(500, "bytes=050-001");
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10() throws Exception
|
||||
public void testOneResponse10() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse("GET /R1 HTTP/1.0\r\n\r\n");
|
||||
assertThat(response, containsString("HTTP/1.1 200 OK"));
|
||||
|
@ -106,7 +106,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10_keep_alive() throws Exception
|
||||
public void testOneResponse10KeepAlive() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.0\r\n" +
|
||||
|
@ -117,7 +117,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_10_keep_alive_empty() throws Exception
|
||||
public void testOneResponse10KeepAliveEmpty() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?empty=true HTTP/1.0\r\n" +
|
||||
|
@ -128,7 +128,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11() throws Exception
|
||||
public void testOneResponse11() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.1\r\n" +
|
||||
|
@ -139,7 +139,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_close() throws Exception
|
||||
public void testOneResponse11close() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1 HTTP/1.1\r\n" +
|
||||
|
@ -151,7 +151,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_empty() throws Exception
|
||||
public void testOneResponse11empty() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?empty=true HTTP/1.1\r\n" +
|
||||
|
@ -163,7 +163,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOneResponse_11_chunked() throws Exception
|
||||
public void testOneResponse11chunked() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse(
|
||||
"GET /R1?flush=true HTTP/1.1\r\n" +
|
||||
|
@ -175,7 +175,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponsePipeline_11() throws Exception
|
||||
public void testThreeResponsePipeline11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
@ -201,7 +201,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponse_11() throws Exception
|
||||
public void testThreeResponse11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
@ -234,7 +234,7 @@ public class LocalConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreeResponseClosed_11() throws Exception
|
||||
public void testThreeResponseClosed11() throws Exception
|
||||
{
|
||||
LocalEndPoint endp = _connector.connect();
|
||||
endp.addInput(
|
||||
|
|
|
@ -509,6 +509,16 @@ public class MultiPartFormInputStreamTest
|
|||
assertThat(stuff.exists(), is(false)); //tmp file was removed after cleanup
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteNPE()
|
||||
{
|
||||
final InputStream input = new ByteArrayInputStream(createMultipartRequestString("myFile").getBytes());
|
||||
MultipartConfigElement config = new MultipartConfigElement(_dirname, 1024, 1024, 50);
|
||||
MultiPartFormInputStream mpis = new MultiPartFormInputStream(input, _contentType, config, _tmpDir);
|
||||
|
||||
mpis.deleteParts(); // this should not be an NPE
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLFOnlyRequest()
|
||||
throws Exception
|
||||
|
|
|
@ -491,6 +491,7 @@ public class MultiPartParserTest
|
|||
"Foo/Bar: value\r\n",
|
||||
"Foo]Bar: value\r\n",
|
||||
"Foo[Bar: value\r\n",
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
"\u0192\u00f8\u00f8\u00df\u00e5\u00ae: value\r\n"
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_3()
|
||||
public void test33()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_3_2()
|
||||
public void test332()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_a() throws Exception
|
||||
public void test36a() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
// Chunk last
|
||||
|
@ -150,7 +150,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_b() throws Exception
|
||||
public void test36b() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -196,7 +196,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_c() throws Exception
|
||||
public void test36c() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -244,7 +244,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_6_d() throws Exception
|
||||
public void test36d() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -276,7 +276,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test3_9() throws Exception
|
||||
public void test39() throws Exception
|
||||
{
|
||||
HttpFields fields = new HttpFields();
|
||||
|
||||
|
@ -291,7 +291,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_1() throws Exception
|
||||
public void test41() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
|
@ -330,7 +330,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_2() throws Exception
|
||||
public void test442() throws Exception
|
||||
{
|
||||
String response;
|
||||
int offset = 0;
|
||||
|
@ -357,7 +357,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_3() throws Exception
|
||||
public void test443() throws Exception
|
||||
{
|
||||
// Due to smuggling concerns, handling has been changed to
|
||||
// treat content length and chunking as a bad request.
|
||||
|
@ -390,7 +390,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test4_4_4() throws Exception
|
||||
public void test444() throws Exception
|
||||
{
|
||||
// No _content length
|
||||
assertTrue(true, "Skip 411 checks as IE breaks this rule");
|
||||
|
@ -414,7 +414,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2_1() throws Exception
|
||||
public void test521() throws Exception
|
||||
{
|
||||
// Default Host
|
||||
int offset = 0;
|
||||
|
@ -426,7 +426,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2_2() throws Exception
|
||||
public void test522() throws Exception
|
||||
{
|
||||
// Default Host
|
||||
int offset = 0;
|
||||
|
@ -444,7 +444,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test5_2() throws Exception
|
||||
public void test52() throws Exception
|
||||
{
|
||||
// Virtual Host
|
||||
int offset = 0;
|
||||
|
@ -467,7 +467,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_1() throws Exception
|
||||
public void test81() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
String response = connector.getResponse("GET /R1 HTTP/1.1\n" + "Host: localhost\n" + "\n", 250, TimeUnit.MILLISECONDS);
|
||||
|
@ -494,7 +494,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test10_4_18() throws Exception
|
||||
public void test10418() throws Exception
|
||||
{
|
||||
// Expect Failure
|
||||
int offset = 0;
|
||||
|
@ -509,7 +509,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_3_dash5() throws Exception
|
||||
public void test823dash5() throws Exception
|
||||
{
|
||||
// Expect with body: client sends the content right away, we should not send 100-Continue
|
||||
int offset = 0;
|
||||
|
@ -527,7 +527,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_3() throws Exception
|
||||
public void test823() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
// Expect 100
|
||||
|
@ -549,7 +549,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test8_2_4() throws Exception
|
||||
public void test824() throws Exception
|
||||
{
|
||||
// Expect 100 not sent
|
||||
int offset = 0;
|
||||
|
@ -565,7 +565,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test9_2() throws Exception
|
||||
public void test92() throws Exception
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
|
@ -584,7 +584,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test9_4()
|
||||
public void test94()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test14_23() throws Exception
|
||||
public void test1423() throws Exception
|
||||
{
|
||||
try (StacklessLogging stackless = new StacklessLogging(HttpParser.class))
|
||||
{
|
||||
|
@ -630,7 +630,7 @@ public class PartialRFC2616Test
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test19_6()
|
||||
public void test196()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -35,6 +35,8 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -81,6 +83,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class RequestTest
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(RequestTest.class);
|
||||
|
@ -118,6 +121,66 @@ public class RequestTest
|
|||
_server.join();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestCharacterEncoding() throws Exception
|
||||
{
|
||||
AtomicReference<String> result = new AtomicReference<>(null);
|
||||
AtomicReference<String> overrideCharEncoding = new AtomicReference<>(null);
|
||||
|
||||
_server.stop();
|
||||
ContextHandler handler = new CharEncodingContextHandler();
|
||||
_server.setHandler(handler);
|
||||
handler.setHandler(_handler);
|
||||
_handler._checker = new RequestTester()
|
||||
{
|
||||
@Override
|
||||
public boolean check(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
try
|
||||
{
|
||||
String s = overrideCharEncoding.get();
|
||||
if (s != null)
|
||||
request.setCharacterEncoding(s);
|
||||
|
||||
result.set(request.getCharacterEncoding());
|
||||
return true;
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
_server.start();
|
||||
|
||||
String request = "GET / HTTP/1.1\n" +
|
||||
"Host: whatever\r\n" +
|
||||
"Content-Type: text/html;charset=utf8\n" +
|
||||
"Connection: close\n" +
|
||||
"\n";
|
||||
|
||||
//test setting the default char encoding
|
||||
handler.setDefaultRequestCharacterEncoding("ascii");
|
||||
String response = _connector.getResponse(request);
|
||||
assertTrue(response.startsWith("HTTP/1.1 200"));
|
||||
assertEquals("ascii", result.get());
|
||||
|
||||
//test overriding the default char encoding with explicit encoding
|
||||
result.set(null);
|
||||
overrideCharEncoding.set("utf-16");
|
||||
response = _connector.getResponse(request);
|
||||
assertTrue(response.startsWith("HTTP/1.1 200"));
|
||||
assertEquals("utf-16", result.get());
|
||||
|
||||
//test fallback to content-type encoding
|
||||
result.set(null);
|
||||
overrideCharEncoding.set(null);
|
||||
handler.setDefaultRequestCharacterEncoding(null);
|
||||
response = _connector.getResponse(request);
|
||||
assertTrue(response.startsWith("HTTP/1.1 200"));
|
||||
assertEquals("utf-8", result.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParamExtraction() throws Exception
|
||||
{
|
||||
|
@ -154,7 +217,7 @@ public class RequestTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamExtraction_BadSequence() throws Exception
|
||||
public void testParamExtractionBadSequence() throws Exception
|
||||
{
|
||||
_handler._checker = new RequestTester()
|
||||
{
|
||||
|
@ -180,7 +243,7 @@ public class RequestTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamExtraction_Timeout() throws Exception
|
||||
public void testParamExtractionTimeout() throws Exception
|
||||
{
|
||||
_handler._checker = new RequestTester()
|
||||
{
|
||||
|
|
|
@ -89,6 +89,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
// @checkstyle-disable-check : AvoidEscapedUnicodeCharactersCheck
|
||||
public class ResponseTest
|
||||
{
|
||||
|
||||
|
@ -121,14 +122,14 @@ public class ResponseTest
|
|||
BufferUtil.clear(_content);
|
||||
|
||||
_server = new Server();
|
||||
Scheduler _scheduler = new TimerScheduler();
|
||||
Scheduler scheduler = new TimerScheduler();
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
LocalConnector connector = new LocalConnector(_server, null, _scheduler, null, 1, new HttpConnectionFactory(config));
|
||||
LocalConnector connector = new LocalConnector(_server, null, scheduler, null, 1, new HttpConnectionFactory(config));
|
||||
_server.addConnector(connector);
|
||||
_server.setHandler(new DumpHandler());
|
||||
_server.start();
|
||||
|
||||
AbstractEndPoint endp = new ByteArrayEndPoint(_scheduler, 5000)
|
||||
AbstractEndPoint endp = new ByteArrayEndPoint(scheduler, 5000)
|
||||
{
|
||||
@Override
|
||||
public InetSocketAddress getLocalAddress()
|
||||
|
@ -409,6 +410,68 @@ public class ResponseTest
|
|||
assertThat(BufferUtil.toString(_content), Matchers.containsString("TestD2 1.234.567,89"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResponseCharacterEncoding() throws Exception
|
||||
{
|
||||
_server.stop();
|
||||
ContextHandler handler = new CharEncodingContextHandler();
|
||||
_server.setHandler(handler);
|
||||
handler.setDefaultResponseCharacterEncoding("utf-16");
|
||||
handler.setHandler(new DumpHandler());
|
||||
_server.start();
|
||||
|
||||
//test setting the default response character encoding
|
||||
Response response = getResponse();
|
||||
_channel.getRequest().setContext(handler.getServletContext());
|
||||
assertThat("utf-16", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
|
||||
_channel.getRequest().setContext(null);
|
||||
response.recycle();
|
||||
|
||||
//test that explicit overrides default
|
||||
response = getResponse();
|
||||
_channel.getRequest().setContext(handler.getServletContext());
|
||||
response.setCharacterEncoding("ascii");
|
||||
assertThat("ascii", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
//getWriter should not change explicit character encoding
|
||||
response.getWriter();
|
||||
assertThat("ascii", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
|
||||
_channel.getRequest().setContext(null);
|
||||
response.recycle();
|
||||
|
||||
//test that assumed overrides default
|
||||
response = getResponse();
|
||||
_channel.getRequest().setContext(handler.getServletContext());
|
||||
response.setContentType("application/json");
|
||||
assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
response.getWriter();
|
||||
//getWriter should not have modified character encoding
|
||||
assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
|
||||
_channel.getRequest().setContext(null);
|
||||
response.recycle();
|
||||
|
||||
//test that inferred overrides default
|
||||
response = getResponse();
|
||||
_channel.getRequest().setContext(handler.getServletContext());
|
||||
response.setContentType("application/xhtml+xml");
|
||||
assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
//getWriter should not have modified character encoding
|
||||
response.getWriter();
|
||||
assertThat("utf-8", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
|
||||
_channel.getRequest().setContext(null);
|
||||
response.recycle();
|
||||
|
||||
//test that without a default or any content type, use iso-8859-1
|
||||
response = getResponse();
|
||||
assertThat("iso-8859-1", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
//getWriter should not have modified character encoding
|
||||
response.getWriter();
|
||||
assertThat("iso-8859-1", Matchers.equalTo(response.getCharacterEncoding()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentTypeCharacterEncoding() throws Exception
|
||||
{
|
||||
|
@ -509,20 +572,20 @@ public class ResponseTest
|
|||
Response response = getResponse();
|
||||
Request request = response.getHttpChannel().getRequest();
|
||||
|
||||
SessionHandler session_handler = new SessionHandler();
|
||||
session_handler.setServer(_server);
|
||||
session_handler.setUsingCookies(true);
|
||||
session_handler.start();
|
||||
request.setSessionHandler(session_handler);
|
||||
SessionHandler sessionHandler = new SessionHandler();
|
||||
sessionHandler.setServer(_server);
|
||||
sessionHandler.setUsingCookies(true);
|
||||
sessionHandler.start();
|
||||
request.setSessionHandler(sessionHandler);
|
||||
HttpSession session = request.getSession(true);
|
||||
|
||||
assertThat(session, not(nullValue()));
|
||||
assertTrue(session.isNew());
|
||||
|
||||
HttpField set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(set_cookie, not(nullValue()));
|
||||
assertThat(set_cookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(set_cookie.getValue(), containsString(session.getId()));
|
||||
HttpField setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(setCookie, not(nullValue()));
|
||||
assertThat(setCookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(setCookie.getValue(), containsString(session.getId()));
|
||||
response.setHeader("Some", "Header");
|
||||
response.addCookie(new Cookie("Some", "Cookie"));
|
||||
response.getOutputStream().print("X");
|
||||
|
@ -530,10 +593,10 @@ public class ResponseTest
|
|||
|
||||
response.reset();
|
||||
|
||||
set_cookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(set_cookie, not(nullValue()));
|
||||
assertThat(set_cookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(set_cookie.getValue(), containsString(session.getId()));
|
||||
setCookie = response.getHttpFields().getField(HttpHeader.SET_COOKIE);
|
||||
assertThat(setCookie, not(nullValue()));
|
||||
assertThat(setCookie.getValue(), startsWith("JSESSIONID"));
|
||||
assertThat(setCookie.getValue(), containsString(session.getId()));
|
||||
assertThat(response.getHttpFields().size(), is(2));
|
||||
response.getWriter();
|
||||
}
|
||||
|
@ -567,7 +630,7 @@ public class ResponseTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPrint_Empty() throws Exception
|
||||
public void testPrintEmpty() throws Exception
|
||||
{
|
||||
Response response = getResponse();
|
||||
response.setCharacterEncoding(UTF_8.name());
|
||||
|
@ -977,7 +1040,7 @@ public class ResponseTest
|
|||
* https://bugs.chromium.org/p/chromium/issues/detail?id=700618
|
||||
*/
|
||||
@Test
|
||||
public void testAddCookie_JavaxServletHttp() throws Exception
|
||||
public void testAddCookieJavaxServletHttp() throws Exception
|
||||
{
|
||||
Response response = getResponse();
|
||||
|
||||
|
@ -996,7 +1059,7 @@ public class ResponseTest
|
|||
* https://bugs.chromium.org/p/chromium/issues/detail?id=700618
|
||||
*/
|
||||
@Test
|
||||
public void testAddCookie_JavaNet() throws Exception
|
||||
public void testAddCookieJavaNet() throws Exception
|
||||
{
|
||||
java.net.HttpCookie cookie = new java.net.HttpCookie("foo", URLEncoder.encode("bar;baz", UTF_8.toString()));
|
||||
cookie.setPath("/secure");
|
||||
|
|
|
@ -119,7 +119,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_Default() throws Exception
|
||||
public void testReuseAddressDefault() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
@ -154,7 +154,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_True() throws Exception
|
||||
public void testReuseAddressTrue() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
@ -190,7 +190,7 @@ public class ServerConnectorTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReuseAddress_False() throws Exception
|
||||
public void testReuseAddressFalse() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
|
|
|
@ -70,14 +70,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
public void testIdleTimeoutAfterSuspend() throws Exception
|
||||
{
|
||||
_server.stop();
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(100);
|
||||
_handler.setResumeAfter(25);
|
||||
handler.setSuspendFor(100);
|
||||
handler.setResumeAfter(25);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
@ -88,14 +88,14 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
@Test
|
||||
public void testIdleTimeoutAfterTimeout() throws Exception
|
||||
{
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
_server.stop();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(50);
|
||||
handler.setSuspendFor(50);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
@ -106,15 +106,15 @@ public class ServerConnectorTimeoutTest extends ConnectorTimeoutTest
|
|||
@Test
|
||||
public void testIdleTimeoutAfterComplete() throws Exception
|
||||
{
|
||||
SuspendHandler _handler = new SuspendHandler();
|
||||
SuspendHandler handler = new SuspendHandler();
|
||||
_server.stop();
|
||||
SessionHandler session = new SessionHandler();
|
||||
session.setHandler(_handler);
|
||||
session.setHandler(handler);
|
||||
_server.setHandler(session);
|
||||
_server.start();
|
||||
|
||||
_handler.setSuspendFor(100);
|
||||
_handler.setCompleteAfter(25);
|
||||
handler.setSuspendFor(100);
|
||||
handler.setCompleteAfter(25);
|
||||
assertTimeoutPreemptively(ofSeconds(10), () ->
|
||||
{
|
||||
String process = process(null).toUpperCase(Locale.ENGLISH);
|
||||
|
|
|
@ -104,8 +104,8 @@ public class StressTest
|
|||
_connector.setIdleTimeout(30000);
|
||||
_server.addConnector(_connector);
|
||||
|
||||
TestHandler _handler = new TestHandler();
|
||||
_server.setHandler(_handler);
|
||||
TestHandler handler = new TestHandler();
|
||||
_server.setHandler(handler);
|
||||
|
||||
_server.start();
|
||||
}
|
||||
|
@ -256,9 +256,9 @@ public class StressTest
|
|||
throw throwable;
|
||||
}
|
||||
|
||||
for (ConcurrentLinkedQueue _latency : _latencies)
|
||||
for (ConcurrentLinkedQueue latency : _latencies)
|
||||
{
|
||||
assertEquals(_handled.get(), _latency.size());
|
||||
assertEquals(_handled.get(), latency.size());
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.nio.file.Path;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -545,7 +544,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testVirtualHostManagement() throws Exception
|
||||
public void testVirtualHostManagement()
|
||||
{
|
||||
ContextHandler context = new ContextHandler("/");
|
||||
|
||||
|
@ -659,7 +658,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Deep() throws Exception
|
||||
public void testLogNameFromContextPathDeep() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -676,7 +675,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Root() throws Exception
|
||||
public void testLogNameFromContextPathRoot() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -693,7 +692,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Undefined() throws Exception
|
||||
public void testLogNameFromContextPathUndefined() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -709,7 +708,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLogNameFromContextPath_Empty() throws Exception
|
||||
public void testLogNameFromContextPathEmpty() throws Exception
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -726,7 +725,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClassPath_WithSpaces() throws IOException
|
||||
public void testClassPathWithSpaces() throws IOException
|
||||
{
|
||||
ContextHandler handler = new ContextHandler();
|
||||
handler.setServer(new Server());
|
||||
|
@ -815,7 +814,7 @@ public class ContextHandlerTest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
this.handled = true;
|
||||
|
@ -830,7 +829,7 @@ public class ContextHandlerTest
|
|||
private static final class ContextPathHandler extends AbstractHandler
|
||||
{
|
||||
@Override
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
public void handle(String s, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue