| 1 | package dolda.jsvc.util; |
| 2 | |
| 3 | import java.util.*; |
| 4 | |
| 5 | public class Misc { |
| 6 | private static Map<Integer, String> stext = new HashMap<Integer, String>(); |
| 7 | |
| 8 | static { |
| 9 | stext.put(200, "OK"); |
| 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"); |
| 19 | } |
| 20 | |
| 21 | public static String statustext(int status) { |
| 22 | String text; |
| 23 | if((text = stext.get(status)) != null) |
| 24 | return(text); |
| 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); |
| 34 | } |
| 35 | } |