Increasing the variety of Gzip tests per recommendations by Simone
This commit is contained in:
parent
5941bf76d6
commit
f04903fb68
|
@ -33,7 +33,9 @@ import org.eclipse.jetty.http.HttpStatus;
|
|||
import org.eclipse.jetty.http.HttpTester;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncScheduledDispatchWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutDispatchWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutCompleteWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.GzipTester;
|
||||
import org.eclipse.jetty.servlets.gzip.GzipTester.ContentMetadata;
|
||||
import org.eclipse.jetty.servlets.gzip.TestDirContentServlet;
|
||||
|
@ -61,6 +63,7 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@Ignore
|
||||
public class GzipFilterContentLengthTest
|
||||
{
|
||||
@Rule
|
||||
|
@ -162,10 +165,19 @@ public class GzipFilterContentLengthTest
|
|||
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAsyncTimeoutWrite() throws Exception
|
||||
public void testAsyncTimeoutCompleteWrite_Default() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncTimeoutWrite.class);
|
||||
testWithGzip(AsyncTimeoutCompleteWrite.Default.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test with content servlet that does:
|
||||
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
||||
*/
|
||||
@Test
|
||||
public void testAsyncTimeoutCompleteWrite_Passed() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncTimeoutCompleteWrite.Passed.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,10 +185,39 @@ public class GzipFilterContentLengthTest
|
|||
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAsyncTimeoutDispatchBasedWrite() throws Exception
|
||||
public void testAsyncTimeoutDispatchWrite_Default() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncTimeoutWrite.class);
|
||||
testWithGzip(AsyncTimeoutDispatchWrite.Default.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test with content servlet that does:
|
||||
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
||||
*/
|
||||
@Test
|
||||
public void testAsyncTimeoutDispatchWrite_Passed() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncTimeoutDispatchWrite.Passed.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test with content servlet that does:
|
||||
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
||||
*/
|
||||
@Test
|
||||
public void testAsyncScheduledDispatchWrite_Default() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncScheduledDispatchWrite.Default.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test with content servlet that does:
|
||||
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
||||
*/
|
||||
@Test
|
||||
public void testAsyncScheduledDispatchWrite_Passed() throws Exception
|
||||
{
|
||||
testWithGzip(AsyncScheduledDispatchWrite.Passed.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,9 +34,12 @@ import org.eclipse.jetty.http.HttpTester;
|
|||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncManipFilter;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutDispatchBasedWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncScheduledDispatchWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutCompleteWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.AsyncTimeoutDispatchWrite;
|
||||
import org.eclipse.jetty.servlets.gzip.GzipTester;
|
||||
import org.eclipse.jetty.servlets.gzip.GzipTester.ContentMetadata;
|
||||
import org.eclipse.jetty.servlets.gzip.TestDirContentServlet;
|
||||
import org.eclipse.jetty.servlets.gzip.TestServletLengthStreamTypeWrite;
|
||||
import org.eclipse.jetty.toolchain.test.TestTracker;
|
||||
import org.eclipse.jetty.toolchain.test.TestingDir;
|
||||
|
@ -52,6 +55,7 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
* Test the GzipFilter support when under several layers of Filters.
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@Ignore
|
||||
public class GzipFilterLayeredTest
|
||||
{
|
||||
@Rule
|
||||
|
@ -63,16 +67,33 @@ public class GzipFilterLayeredTest
|
|||
private static final int TINY = AsyncGzipFilter.DEFAULT_MIN_GZIP_SIZE / 2;
|
||||
private static final boolean EXPECT_COMPRESSED = true;
|
||||
|
||||
@Parameters(name = "{0} bytes - {1} - compressed({2})")
|
||||
@Parameters(name = "{0} bytes - {1} - compressed({2}) - filter({3}) - servlet({4}")
|
||||
public static List<Object[]> data()
|
||||
{
|
||||
List<Object[]> ret = new ArrayList<Object[]>();
|
||||
|
||||
Class<?> gzipFilters[] = new Class<?>[] { GzipFilter.class, AsyncGzipFilter.class };
|
||||
Class<?> contentServlets[] = new Class<?>[] {
|
||||
TestServletLengthStreamTypeWrite.class,
|
||||
AsyncTimeoutDispatchWrite.Default.class,
|
||||
AsyncTimeoutDispatchWrite.Passed.class,
|
||||
AsyncTimeoutCompleteWrite.Default.class,
|
||||
AsyncTimeoutCompleteWrite.Passed.class,
|
||||
AsyncScheduledDispatchWrite.Default.class,
|
||||
AsyncScheduledDispatchWrite.Passed.class,
|
||||
};
|
||||
|
||||
ret.add(new Object[] { 0, "empty.txt", !EXPECT_COMPRESSED });
|
||||
ret.add(new Object[] { TINY, "file-tiny.txt", !EXPECT_COMPRESSED });
|
||||
ret.add(new Object[] { SMALL, "file-small.txt", EXPECT_COMPRESSED });
|
||||
ret.add(new Object[] { LARGE, "file-large.txt", EXPECT_COMPRESSED });
|
||||
ret.add(new Object[] { LARGE, "file-large.mp3", !EXPECT_COMPRESSED });
|
||||
for (Class<?> contentServlet: contentServlets)
|
||||
{
|
||||
for (Class<?> gzipFilter : gzipFilters)
|
||||
{
|
||||
ret.add(new Object[] { 0, "empty.txt", !EXPECT_COMPRESSED, gzipFilter, contentServlet });
|
||||
ret.add(new Object[] { TINY, "file-tiny.txt", !EXPECT_COMPRESSED, gzipFilter, contentServlet });
|
||||
ret.add(new Object[] { SMALL, "file-small.txt", EXPECT_COMPRESSED, gzipFilter, contentServlet });
|
||||
ret.add(new Object[] { LARGE, "file-large.txt", EXPECT_COMPRESSED, gzipFilter, contentServlet });
|
||||
ret.add(new Object[] { LARGE, "file-large.mp3", !EXPECT_COMPRESSED, gzipFilter, contentServlet });
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -83,18 +104,21 @@ public class GzipFilterLayeredTest
|
|||
public String fileName;
|
||||
@Parameter(2)
|
||||
public boolean expectCompressed;
|
||||
@Parameter(3)
|
||||
public Class<? extends GzipFilter> gzipFilterClass;
|
||||
@Parameter(4)
|
||||
public Class<? extends TestDirContentServlet> contentServletClass;
|
||||
|
||||
@Rule
|
||||
public TestingDir testingdir = new TestingDir();
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testGzipDosNormal() throws Exception
|
||||
public void testGzipDos() throws Exception
|
||||
{
|
||||
GzipTester tester = new GzipTester(testingdir, GzipFilter.GZIP);
|
||||
|
||||
// Add Gzip Filter first
|
||||
FilterHolder gzipHolder = new FilterHolder(AsyncGzipFilter.class);
|
||||
FilterHolder gzipHolder = new FilterHolder(gzipFilterClass);
|
||||
gzipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(gzipHolder,"*.txt",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
tester.addFilter(gzipHolder,"*.mp3",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
|
@ -105,12 +129,13 @@ public class GzipFilterLayeredTest
|
|||
manipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(manipHolder,"/*",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
|
||||
// Add normal content servlet
|
||||
tester.setContentServlet(TestServletLengthStreamTypeWrite.class);
|
||||
// Add content servlet
|
||||
tester.setContentServlet(contentServletClass);
|
||||
|
||||
try
|
||||
{
|
||||
File testFile = tester.prepareServerFile("GzipDosNormal-" + fileName,fileSize);
|
||||
String testFilename = String.format("GzipDos-%s-%s",contentServletClass.getSimpleName(),fileName);
|
||||
File testFile = tester.prepareServerFile(testFilename,fileSize);
|
||||
|
||||
tester.start();
|
||||
|
||||
|
@ -135,54 +160,7 @@ public class GzipFilterLayeredTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testGzipDosAsync() throws Exception
|
||||
{
|
||||
GzipTester tester = new GzipTester(testingdir, GzipFilter.GZIP);
|
||||
|
||||
// Add Gzip Filter first
|
||||
FilterHolder gzipHolder = new FilterHolder(AsyncGzipFilter.class);
|
||||
gzipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(gzipHolder,"*.txt",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
tester.addFilter(gzipHolder,"*.mp3",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
gzipHolder.setInitParameter("mimeTypes","text/plain");
|
||||
|
||||
// Add (DoSFilter-like) manip filter (in chain of Gzip)
|
||||
FilterHolder manipHolder = new FilterHolder(AsyncManipFilter.class);
|
||||
manipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(manipHolder,"/*",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
|
||||
// Add normal content servlet
|
||||
tester.setContentServlet(AsyncTimeoutDispatchBasedWrite.class);
|
||||
|
||||
try
|
||||
{
|
||||
File testFile = tester.prepareServerFile("GzipDosAsync-" + fileName,fileSize);
|
||||
|
||||
tester.start();
|
||||
|
||||
HttpTester.Response response = tester.executeRequest("GET","/context/" + testFile.getName(),2,TimeUnit.SECONDS);
|
||||
|
||||
assertThat("Response status", response.getStatus(), is(HttpStatus.OK_200));
|
||||
|
||||
if (expectCompressed)
|
||||
{
|
||||
// Must be gzip compressed
|
||||
assertThat("Content-Encoding",response.get("Content-Encoding"),containsString(GzipFilter.GZIP));
|
||||
}
|
||||
|
||||
// Uncompressed content Size
|
||||
ContentMetadata content = tester.getResponseMetadata(response);
|
||||
assertThat("(Uncompressed) Content Length", content.size, is((long)fileSize));
|
||||
}
|
||||
finally
|
||||
{
|
||||
tester.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDosGzipNormal() throws Exception
|
||||
public void testDosGzip() throws Exception
|
||||
{
|
||||
GzipTester tester = new GzipTester(testingdir, GzipFilter.GZIP);
|
||||
|
||||
|
@ -192,18 +170,19 @@ public class GzipFilterLayeredTest
|
|||
tester.addFilter(manipHolder,"/*",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
|
||||
// Add Gzip Filter first (in chain of DosFilter)
|
||||
FilterHolder gzipHolder = new FilterHolder(AsyncGzipFilter.class);
|
||||
FilterHolder gzipHolder = new FilterHolder(gzipFilterClass);
|
||||
gzipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(gzipHolder,"*.txt",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
tester.addFilter(gzipHolder,"*.mp3",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
gzipHolder.setInitParameter("mimeTypes","text/plain");
|
||||
|
||||
// Add normal content servlet
|
||||
tester.setContentServlet(TestServletLengthStreamTypeWrite.class);
|
||||
// Add content servlet
|
||||
tester.setContentServlet(contentServletClass);
|
||||
|
||||
try
|
||||
{
|
||||
File testFile = tester.prepareServerFile("DosGzipNormal-" + fileName,fileSize);
|
||||
String testFilename = String.format("DosGzip-%s-%s",contentServletClass.getSimpleName(),fileName);
|
||||
File testFile = tester.prepareServerFile(testFilename,fileSize);
|
||||
|
||||
tester.start();
|
||||
|
||||
|
@ -229,54 +208,4 @@ public class GzipFilterLayeredTest
|
|||
tester.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testDosGzipAsync() throws Exception
|
||||
{
|
||||
GzipTester tester = new GzipTester(testingdir, GzipFilter.GZIP);
|
||||
|
||||
// Add (DoSFilter-like) manip filter
|
||||
FilterHolder manipHolder = new FilterHolder(AsyncManipFilter.class);
|
||||
manipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(manipHolder,"/*",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
|
||||
// Add Gzip Filter first (in chain of DosFilter)
|
||||
FilterHolder gzipHolder = new FilterHolder(AsyncGzipFilter.class);
|
||||
gzipHolder.setAsyncSupported(true);
|
||||
tester.addFilter(gzipHolder,"*.txt",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
tester.addFilter(gzipHolder,"*.mp3",EnumSet.of(DispatcherType.REQUEST,DispatcherType.ASYNC));
|
||||
gzipHolder.setInitParameter("mimeTypes","text/plain");
|
||||
|
||||
// Add normal content servlet
|
||||
tester.setContentServlet(AsyncTimeoutDispatchBasedWrite.class);
|
||||
|
||||
try
|
||||
{
|
||||
File testFile = tester.prepareServerFile("DosGzipAsync-" + fileName,fileSize);
|
||||
|
||||
tester.start();
|
||||
|
||||
HttpTester.Response response = tester.executeRequest("GET","/context/" + testFile.getName(),2,TimeUnit.SECONDS);
|
||||
|
||||
assertThat("Response status", response.getStatus(), is(HttpStatus.OK_200));
|
||||
|
||||
if (expectCompressed)
|
||||
{
|
||||
// Must be gzip compressed
|
||||
assertThat("Content-Encoding",response.get("Content-Encoding"),containsString(GzipFilter.GZIP));
|
||||
} else
|
||||
{
|
||||
assertThat("Content-Encoding",response.get("Content-Encoding"),not(containsString(GzipFilter.GZIP)));
|
||||
}
|
||||
|
||||
// Uncompressed content Size
|
||||
ContentMetadata content = tester.getResponseMetadata(response);
|
||||
assertThat("(Uncompressed) Content Length", content.size, is((long)fileSize));
|
||||
}
|
||||
finally
|
||||
{
|
||||
tester.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,24 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AsyncScheduledWrite extends TestDirContentServlet
|
||||
public abstract class AsyncScheduledDispatchWrite extends TestDirContentServlet
|
||||
{
|
||||
public static class Default extends AsyncScheduledDispatchWrite
|
||||
{
|
||||
public Default()
|
||||
{
|
||||
super(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Passed extends AsyncScheduledDispatchWrite
|
||||
{
|
||||
public Passed()
|
||||
{
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class DispatchBack implements Runnable
|
||||
{
|
||||
private final AsyncContext ctx;
|
||||
|
@ -49,8 +65,14 @@ public class AsyncScheduledWrite extends TestDirContentServlet
|
|||
}
|
||||
}
|
||||
|
||||
private final boolean originalReqResp;
|
||||
private ScheduledExecutorService scheduler;
|
||||
|
||||
public AsyncScheduledDispatchWrite(boolean originalReqResp)
|
||||
{
|
||||
this.originalReqResp = originalReqResp;
|
||||
}
|
||||
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
|
@ -59,12 +81,22 @@ public class AsyncScheduledWrite extends TestDirContentServlet
|
|||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
{
|
||||
Boolean suspended = (Boolean)request.getAttribute("SUSPENDED");
|
||||
if (suspended==null || !suspended)
|
||||
if (suspended == null || !suspended)
|
||||
{
|
||||
request.setAttribute("SUSPENDED",Boolean.TRUE);
|
||||
AsyncContext ctx = request.startAsync();
|
||||
AsyncContext ctx;
|
||||
if (originalReqResp)
|
||||
{
|
||||
// Use Original Request & Response
|
||||
ctx = request.startAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pass Request & Response
|
||||
ctx = request.startAsync(request,response);
|
||||
}
|
||||
ctx.setTimeout(0);
|
||||
scheduler.schedule(new DispatchBack(ctx),500,TimeUnit.MILLISECONDS);
|
||||
}
|
|
@ -31,20 +31,69 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Respond with requested content, but via AsyncContext manipulation.
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* 1) startAsync
|
||||
* 2) AsyncContext.setTimeout()
|
||||
* 3) onTimeout()
|
||||
* 4) send-response
|
||||
* 5) AsyncContext.complete()
|
||||
* </pre>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AsyncTimeoutWrite extends TestDirContentServlet implements AsyncListener
|
||||
public abstract class AsyncTimeoutCompleteWrite extends TestDirContentServlet implements AsyncListener
|
||||
{
|
||||
public static class Default extends AsyncTimeoutCompleteWrite
|
||||
{
|
||||
public Default()
|
||||
{
|
||||
super(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Passed extends AsyncTimeoutCompleteWrite
|
||||
{
|
||||
public Passed()
|
||||
{
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean originalReqResp;
|
||||
|
||||
public AsyncTimeoutCompleteWrite(boolean originalReqResp)
|
||||
{
|
||||
this.originalReqResp = originalReqResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
assertThat("'filename' request attribute shouldn't be declared", request.getAttribute("filename"), nullValue());
|
||||
assertThat("'filename' request attribute shouldn't be declared",request.getAttribute("filename"),nullValue());
|
||||
|
||||
AsyncContext ctx = (AsyncContext)request.getAttribute(AsyncContext.class.getName());
|
||||
ctx = request.startAsync();
|
||||
AsyncContext ctx = (AsyncContext)request.getAttribute(this.getClass().getName());
|
||||
assertThat("AsyncContext (shouldn't be in request attribute)", ctx, nullValue());
|
||||
|
||||
if (originalReqResp)
|
||||
{
|
||||
// Use Original Request & Response
|
||||
ctx = request.startAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pass Request & Response
|
||||
ctx = request.startAsync(request,response);
|
||||
}
|
||||
String fileName = request.getServletPath();
|
||||
request.setAttribute("filename",fileName);
|
||||
ctx.addListener(this);
|
||||
ctx.setTimeout(200);
|
||||
|
||||
// Setup indication of a redispatch (which this scenario shouldn't do)
|
||||
request.setAttribute(this.getClass().getName(),ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +123,6 @@ public class AsyncTimeoutWrite extends TestDirContentServlet implements AsyncLis
|
|||
out.write(dataBytes);
|
||||
|
||||
event.getAsyncContext().complete();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
|
@ -29,8 +29,31 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AsyncTimeoutDispatchBasedWrite extends TestDirContentServlet implements AsyncListener
|
||||
public class AsyncTimeoutDispatchWrite extends TestDirContentServlet implements AsyncListener
|
||||
{
|
||||
public static class Default extends AsyncTimeoutDispatchWrite
|
||||
{
|
||||
public Default()
|
||||
{
|
||||
super(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Passed extends AsyncTimeoutDispatchWrite
|
||||
{
|
||||
public Passed()
|
||||
{
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean originalReqResp;
|
||||
|
||||
public AsyncTimeoutDispatchWrite(boolean originalReqResp)
|
||||
{
|
||||
this.originalReqResp = originalReqResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
|
@ -38,7 +61,16 @@ public class AsyncTimeoutDispatchBasedWrite extends TestDirContentServlet implem
|
|||
if (ctx == null)
|
||||
{
|
||||
// First pass through
|
||||
ctx = request.startAsync();
|
||||
if (originalReqResp)
|
||||
{
|
||||
// Use Original Request & Response
|
||||
ctx = request.startAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pass Request & Response
|
||||
ctx = request.startAsync(request,response);
|
||||
}
|
||||
ctx.addListener(this);
|
||||
ctx.setTimeout(200);
|
||||
request.setAttribute(AsyncContext.class.getName(),ctx);
|
Loading…
Reference in New Issue