1
18 package net.bull.javamelody.internal.common;
19
20 import javax.servlet.http.HttpServletRequest;
21
22
26 public enum HttpPart {
27 HEAP_HISTO("heaphisto"),
28 PROCESSES("processes"),
29 CURRENT_REQUESTS("currentRequests"),
30 DEFAULT_WITH_CURRENT_REQUESTS("defaultWithCurrentRequests"),
31 WEB_XML("web.xml"),
32 POM_XML("pom.xml"),
33 JNLP("jnlp"),
34 JVM("jvm"),
35 SESSIONS("sessions"),
36 HOTSPOTS("hotspots"),
37 DATABASE("database"),
38 CONNECTIONS("connections"),
39 GRAPH("graph"),
40 LAST_VALUE("lastValue"),
41 USAGES("usages"),
42 JNDI("jndi"),
43 MBEANS("mbeans"),
44 CRASHES("crashes"),
45 THREADS("threads"),
46 THREADS_DUMP("threadsDump"),
47 COUNTER_SUMMARY_PER_CLASS("counterSummaryPerClass"),
48 RUNTIME_DEPENDENCIES("runtimeDependencies"),
49 JROBINS("jrobins"),
50 OTHER_JROBINS("otherJRobins"),
51 EXPLAIN_PLAN("explainPlan"),
52 APPLICATIONS("applications"),
53 SOURCE("source"),
54 DEPENDENCIES("dependencies"),
55 SPRING_BEANS("springBeans"),
56 RUM("rum"),
57 WEBAPP_VERSIONS("webappVersions"),
58 CACHE_KEYS("cacheKeys"),
59 JCACHE_KEYS("jcacheKeys"),
60 HASH_PASSWORD("hashPassword");
61
62 private final String name;
63
64 HttpPart(String name) {
65 this.name = name;
66 }
67
68 public boolean isPart(HttpServletRequest request) {
69 return name.equals(HttpParameter.PART.getParameterFrom(request));
70 }
71
72 public String getName() {
73 return name;
74 }
75
76 @Override
77 public String toString() {
78 return name;
79 }
80
81 public static HttpPart getByName(String name) {
82 for (final HttpPart httpPart : values()) {
83 if (httpPart.name.equals(name)) {
84 return httpPart;
85 }
86 }
87 throw new IllegalArgumentException("Unknown part: " + name);
88 }
89 }
90