package de.ugoe.cs.eventbench.web.data; import java.util.ArrayList; import java.util.List; import de.ugoe.cs.eventbench.data.IReplayable; /** *

* Contains all information related to a web request, i.e., the path, the POST * variables and the GET variables. *

* * @author Steffen Herbold * @version 1.0 */ public class WebRequest implements IReplayable { /** *

* Id for object serialization. *

*/ private static final long serialVersionUID = 1L; /** *

* POST variables of the web request. *

*/ List postVars; /** *

* GET variables of the web request. *

*/ List getVars; /** *

* URI of the web request. *

*/ String targetUri; /** *

* Constructor. Creates a new WebRequest. *

* * @param uri * URI of the request * @param postVars * POST variables of the request * @param getVars * GET variables of the request */ public WebRequest(String uri, List postVars, List getVars) { targetUri = uri; this.postVars = new ArrayList(postVars); // defensive copy this.getVars = new ArrayList(getVars); } /* * (non-Javadoc) * * @see de.ugoe.cs.eventbench.data.IReplayable#getReplay() */ @Override public String getReplay() { // TODO implement method return null; } /* * (non-Javadoc) * * @see de.ugoe.cs.eventbench.data.IReplayable#getTarget() */ @Override public String getTarget() { // TODO implement method return null; } /** *

* Two {@link WebRequest}s are equal, if their {@link #targetUri}, * {@link #postVars}, and {@link #getVars} are equal. *

* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object other) { if (this == other) { return true; } if (other instanceof WebRequest) { return targetUri.equals(((WebRequest) other).targetUri) && postVars.equals(((WebRequest) other).postVars) && getVars.equals(((WebRequest) other).getVars); } return false; } /* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { int multiplier = 17; int hash = 42; hash = multiplier * hash + targetUri.hashCode(); hash = multiplier * hash + postVars.hashCode(); hash = multiplier * hash + getVars.hashCode(); return hash; } }