1 /*
2 * Copyright 2008-2019 by Emeric Vernat
3 *
4 * This file is part of Java Melody.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package net.bull.javamelody.internal.common;
19
20 import javax.servlet.http.HttpServletRequest;
21
22 /**
23 * Enumération des paramètres dans les requêtes http.
24 * @author Emeric Vernat
25 */
26 public enum HttpParameter {
27 ACTION("action"),
28 PART("part"),
29 PERIOD("period"),
30 COUNTER("counter"),
31 GRAPH("graph"),
32 SESSION_ID("sessionId"),
33 THREAD_ID("threadId"),
34 JOB_ID("jobId"),
35 CACHE_ID("cacheId"),
36 CACHE_KEY("cacheKey"),
37 REQUEST("request"),
38 PATH("path"),
39 JMX_VALUE("jmxValue"),
40 COLLECTOR("collector"),
41 RESOURCE("resource"),
42 FORMAT("format"),
43 WIDTH("width"),
44 HEIGHT("height"),
45 MAX("max"),
46 PATTERN("pattern"),
47 REPORT("report"),
48 TOKEN("token"),
49 CLASS("class"),
50 APPLICATION("application"),
51 ALGORITHM("algorithm");
52
53 private final String name;
54
55 HttpParameter(String name) {
56 this.name = name;
57 }
58
59 public String getParameterFrom(HttpServletRequest request) {
60 return request.getParameter(name);
61 }
62
63 public String getName() {
64 return name;
65 }
66
67 @Override
68 public String toString() {
69 return name;
70 }
71 }
72