1 package org.apache.maven.wagon.providers.http;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import javax.servlet.ServletException;
23 import javax.servlet.http.HttpServlet;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26 import java.io.IOException;
27
28
29
30
31
32
33 public class ErrorWithMessageServlet
34 extends HttpServlet
35 {
36 private static final long serialVersionUID = -1419714266724471393L;
37
38 public static final String MESSAGE = "it sucks!";
39
40 public void service( HttpServletRequest request, HttpServletResponse response )
41 throws ServletException, IOException
42 {
43 if ( request.getPathInfo().endsWith( "/401" ) )
44 {
45 response.sendError( 401, MESSAGE );
46 }
47 else if ( request.getPathInfo().endsWith( "/403" ) )
48 {
49 response.sendError( 403, MESSAGE );
50 }
51 else if ( request.getPathInfo().endsWith( "/404" ) )
52 {
53 response.sendError( 404, MESSAGE );
54 }
55 else if ( request.getPathInfo().endsWith( "/407" ) )
56 {
57 response.sendError( 407, MESSAGE );
58 }
59 else if ( request.getPathInfo().endsWith( "/500" ) )
60 {
61 response.sendError( 500, MESSAGE );
62 }
63
64 }
65 }