Package com.browserup.harreader.model
Class HarLog
- java.lang.Object
-
- com.browserup.harreader.model.HarLog
-
public class HarLog extends java.lang.ObjectRoot object of exported data.- See Also:
- specification
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_VERSION
-
Constructor Summary
Constructors Constructor Description HarLog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.util.List<HarEntry>findEntries(java.util.regex.Pattern url)Search the entire log for entries whose request URL matches the givenurl.java.util.Optional<HarEntry>findMostRecentEntry(java.util.regex.Pattern url)Search the entire log for the most recent entry whose request URL matches the givenurl.HarCreatorBrowsergetBrowser()java.lang.StringgetComment()HarCreatorBrowsergetCreator()java.util.List<HarEntry>getEntries()java.util.List<HarPage>getPages()java.lang.StringgetVersion()inthashCode()voidsetBrowser(HarCreatorBrowser browser)voidsetComment(java.lang.String comment)voidsetCreator(HarCreatorBrowser creator)voidsetEntries(java.util.List<HarEntry> entries)voidsetPages(java.util.List<HarPage> pages)voidsetVersion(java.lang.String version)
-
-
-
Field Detail
-
DEFAULT_VERSION
protected static final java.lang.String DEFAULT_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVersion
public java.lang.String getVersion()
- Returns:
- Version number of the format.
Defaults to
DEFAULT_VERSION
-
setVersion
public void setVersion(java.lang.String version)
-
getCreator
public HarCreatorBrowser getCreator()
- Returns:
- Information about the application used to generate HAR.
-
setCreator
public void setCreator(HarCreatorBrowser creator)
-
getBrowser
public HarCreatorBrowser getBrowser()
- Returns:
- Information about the browser used.
-
setBrowser
public void setBrowser(HarCreatorBrowser browser)
-
getPages
public java.util.List<HarPage> getPages()
- Returns:
- List of all exported pages, may be empty.
-
setPages
public void setPages(java.util.List<HarPage> pages)
-
getEntries
public java.util.List<HarEntry> getEntries()
- Returns:
- List of all exported requests, may be empty.
-
setEntries
public void setEntries(java.util.List<HarEntry> entries)
-
getComment
public java.lang.String getComment()
- Returns:
- Comment provided by the user or application, null if not present.
-
setComment
public void setComment(java.lang.String comment)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
findMostRecentEntry
public java.util.Optional<HarEntry> findMostRecentEntry(java.util.regex.Pattern url)
Search the entire log for the most recent entry whose request URL matches the givenurl.- Parameters:
url- Regular expression match of URL to find. URLs are formatted as: scheme://host:port/path?querystring. Port is not included in the URL if it is the standard port for the scheme. Fragments (example.com/#fragment) should not be included in the URL. If more than one URL found, return the most recently requested URL. Pattern examples: - Match a URL with "http" or "https" protocol, "example.com" domain, and "/index.html" exact file path, with no query parameters: "^(http|https)://example\\.com/index\\.html$" - Match a URL with "http" protocol, "example.com" domain, "/customer" exact path, followed by any query string: "^http://example\\.com/customer\\?.*" - Match a URL with "http" protocol, "example.com" domain, "/products" path, and exactly 1 UUID query parameter named "id": "^http://example\\.com/products\\?id=[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$"- Returns:
HarEntryfor the most recently requested URL matching the givenurlpattern.
-
findEntries
public java.util.List<HarEntry> findEntries(java.util.regex.Pattern url)
Search the entire log for entries whose request URL matches the givenurl.- Parameters:
url- Regular expression match of URL to find. URLs are formatted as: scheme://host:port/path?querystring. Port is not included in the URL if it is the standard port for the scheme. Fragments (example.com/#fragment) should not be included in the URL. If more than one URL found, use the most recently requested URL. Pattern examples: - Match a URL with "http" or "https" protocol, "example.com" domain, and "/index.html" exact file path, with no query parameters: "^(http|https)://example\\.com/index\\.html$" - Match a URL with "http" protocol, "example.com" domain, "/customer" exact path, followed by any query string: "^http://example\\.com/customer\\?.*" - Match a URL with "http" protocol, "example.com" domain, "/products" path, and exactly 1 UUID query parameter named "id": "^http://example\\.com/products\\?id=[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$"- Returns:
- A list of
HarEntryfor any requests whose URL matches the givenurlpattern, or an empty list if none match.
-
-