Added a request-restart-wrapper and some convenient redirections.
[jsvc.git] / src / dolda / jsvc / util / Misc.java
CommitLineData
78f5d120
FT
1package dolda.jsvc.util;
2
3import java.util.*;
4
5public class Misc {
6 private static Map<Integer, String> stext = new HashMap<Integer, String>();
7
8 static {
9 stext.put(200, "OK");
c25c3aad
FT
10 stext.put(300, "Multiple Choices");
11 stext.put(301, "Permanently Moved");
12 stext.put(302, "Temporarily Moved");
13 stext.put(303, "See Other");
14 stext.put(400, "Bad Request");
15 stext.put(401, "Authentication Required");
16 stext.put(403, "Access Forbidden");
17 stext.put(404, "Resource Not Found");
18 stext.put(500, "Server Error");
78f5d120
FT
19 }
20
21 public static String statustext(int status) {
22 String text;
23 if((text = stext.get(status)) != null)
24 return(text);
c25c3aad
FT
25 return("Server Flimsiness");
26 }
27
28 public static String stripslashes(String p, boolean beg, boolean end) {
29 while(end && (p.length() > 0) && (p.charAt(p.length() - 1) == '/'))
30 p = p.substring(0, p.length() - 1);
31 while(beg && (p.length() > 0) && (p.charAt(0) == '/'))
32 p = p.substring(1);
33 return(p);
78f5d120
FT
34 }
35}