package de.ugoe.cs.quest.web.data; import java.util.List; import de.ugoe.cs.quest.data.ReplayableEvent; /** *

* This class defines web events (of PHP-based web applications). *

* * @author Steffen Herbold * @version 1.0 * */ public class WebEvent extends ReplayableEvent { private static final long serialVersionUID = 1L; /** *

* Timestamp of the event. *

*/ private final long timestamp; /** *

* Helper method that generates the type of the event based on the of the * URI, the POST variables, and the GET variables. *

* * @param path * path of the URI of the event * @param postVars * POST variables send with the event * @param getVars * GET variables send with the event * @return type of the event */ private final static String makeType(String path, List postVars, List getVars) { String type = path; if (getVars != null && !getVars.isEmpty()) { type += "+GET" + getVars.toString().replace(" ", ""); } if (postVars != null && !postVars.isEmpty()) { type += "+POST" + postVars.toString().replace(" ", ""); } return type; } /** *

* Constructor. Creates a new WebEvent. *

* * @param url * URL of the server that received the event * @param path * path of the URI * @param timestamp * timestamp of when the event took place * @param postVars * POST variables send with the event * @param getVars * GET variables send with the event */ public WebEvent(String url, String path, long timestamp, List postVars, List getVars) { super(makeType(path, postVars, getVars)); this.timestamp = timestamp; super.setTarget(path); addReplayEvent(new WebRequest(url, path, postVars, getVars)); } /** *

* Returns the timestamp of the event. *

* * @return timestamp of th event */ public long getTimestamp() { return timestamp; } /* * (non-Javadoc) * * @see de.ugoe.cs.quest.data.ReplayableEvent#equals(java.lang.Object) */ @Override public boolean equals(Object other) { return super.equals(other); } /* * (non-Javadoc) * * @see de.ugoe.cs.quest.data.ReplayableEvent#hashCode() */ @Override public int hashCode() { return super.hashCode(); } }