Quellcode-Bibliothek TestAsyncFlush.java
Interaktion und PortierbarkeitJAVA
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/ package org.apache.coyote.http2;
/* * Based on * https://bz.apache.org/bugzilla/show_bug.cgi?id=62635 * * Note: Calling blocking I/O methods (such as flushBuffer()) during * non-blocking I/O is explicitly called out as illegal in the Servlet * specification but also goes on to say the behaviour if such a call is * made is undefined. Which means it is OK if the call works as expected * (a non-blocking flush is triggered) :). * If any of these tests fail, that should not block a release since - * while the specification allows this to work - it doesn't require that * it does work.
*/ publicclass TestAsyncFlush extends Http2TestBase {
privatestaticfinalint BLOCK_SIZE = 1024;
@Test publicvoid testFlush() throws Exception { int blockCount = 2048;
int targetSize = BLOCK_SIZE * blockCount;
int totalWindow = ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE;
enableHttp2();
Tomcat tomcat = getTomcatInstance();
Context ctxt = tomcat.addContext("", null);
Tomcat.addServlet(ctxt, "simple", new SimpleServlet());
ctxt.addServletMappingDecoded("/simple", "simple");
Wrapper w = Tomcat.addServlet(ctxt, "async", new AsyncFlushServlet(blockCount));
w.setAsyncSupported(true);
ctxt.addServletMappingDecoded("/async", "async");
tomcat.start();
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.