source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebRequest.java @ 171

Last change on this file since 171 was 171, checked in by sherbold, 13 years ago
  • code documentation and formatting
  • Property svn:mime-type set to text/plain
File size: 2.5 KB
Line 
1package de.ugoe.cs.eventbench.web.data;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import de.ugoe.cs.eventbench.data.IReplayable;
7
8/**
9 * <p>
10 * Contains all information related to a web request, i.e., the path, the POST
11 * variables and the GET variables.
12 * </p>
13 *
14 * @author Steffen Herbold
15 * @version 1.0
16 */
17public class WebRequest implements IReplayable {
18
19        /**
20         * <p>
21         * Id for object serialization.
22         * </p>
23         */
24        private static final long serialVersionUID = 1L;
25
26        /**
27         * <p>
28         * POST variables of the web request.
29         * </p>
30         */
31        List<String> postVars;
32
33        /**
34         * <p>
35         * GET variables of the web request.
36         * </p>
37         */
38        List<String> getVars;
39
40        /**
41         * <p>
42         * URI of the web request.
43         * </p>
44         */
45        String targetUri;
46
47        /**
48         * <p>
49         * Constructor. Creates a new WebRequest.
50         * </p>
51         *
52         * @param uri
53         *            URI of the request
54         * @param postVars
55         *            POST variables of the request
56         * @param getVars
57         *            GET variables of the request
58         */
59        public WebRequest(String uri, List<String> postVars, List<String> getVars) {
60                targetUri = uri;
61                this.postVars = new ArrayList<String>(postVars); // defensive copy
62                this.getVars = new ArrayList<String>(getVars);
63        }
64
65        /*
66         * (non-Javadoc)
67         *
68         * @see de.ugoe.cs.eventbench.data.IReplayable#getReplay()
69         */
70        @Override
71        public String getReplay() {
72                // TODO implement method
73                return null;
74        }
75
76        /*
77         * (non-Javadoc)
78         *
79         * @see de.ugoe.cs.eventbench.data.IReplayable#getTarget()
80         */
81        @Override
82        public String getTarget() {
83                // TODO implement method
84                return null;
85        }
86
87        /**
88         * <p>
89         * Two {@link WebRequest}s are equal, if their {@link #targetUri},
90         * {@link #postVars}, and {@link #getVars} are equal.
91         * </p>
92         *
93         * @see java.lang.Object#equals(java.lang.Object)
94         */
95        @Override
96        public boolean equals(Object other) {
97                if (this == other) {
98                        return true;
99                }
100                if (other instanceof WebRequest) {
101                        return targetUri.equals(((WebRequest) other).targetUri)
102                                        && postVars.equals(((WebRequest) other).postVars)
103                                        && getVars.equals(((WebRequest) other).getVars);
104                }
105                return false;
106        }
107
108        /*
109         * (non-Javadoc)
110         *
111         * @see java.lang.Object#hashCode()
112         */
113        @Override
114        public int hashCode() {
115                int multiplier = 17;
116                int hash = 42;
117
118                hash = multiplier * hash + targetUri.hashCode();
119                hash = multiplier * hash + postVars.hashCode();
120                hash = multiplier * hash + getVars.hashCode();
121
122                return hash;
123        }
124
125}
Note: See TracBrowser for help on using the repository browser.