blob: e5544cd913b211d710ba22f5dc3eb9baeb450761 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*******************************************************************************
* Copyright (c) 2009, Cloudsmith Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Cloudsmith Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.testserver.servlets;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This servlet is a "black hole" - it just sleeps for an hour on any request.
*
*/
public class TimeOut extends HttpServlet {
private static final long serialVersionUID = 1L;
private static long MINUTES_MS = 1000 * 60; // minutes in ms
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
doDelay();
}
private void doDelay() {
// Do nothing...
try {
Thread.sleep(10 * MINUTES_MS); // sleep 10 minutes
} catch (InterruptedException e) {
e.printStackTrace();
}
}
protected void doHead(HttpServletRequest request, HttpServletResponse response) {
doDelay();
}
}
|