public class HarContent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TABLE_NAME
Database table name where the data is stored
|
Constructor and Description |
---|
HarContent(HarDatabaseConfig config,
long responseId)
Creates a new
HarContent object from a database. |
HarContent(org.codehaus.jackson.JsonParser jp,
java.util.List<HarWarning> warnings)
Creates a new
HarContent object from a JsonParser already
positioned at the beginning of the element content |
HarContent(long size,
long compression,
java.lang.String mimeType,
java.lang.String text,
java.lang.String encoding,
java.lang.String comment)
Creates a new
HarContent object |
HarContent(long size,
java.lang.String mimeType)
Creates a new
HarContent object using mandatory fields |
Modifier and Type | Method and Description |
---|---|
void |
deleteFromJDBC(HarDatabaseConfig config,
long logId)
Delete objects in the database referencing the specified logId.
|
java.lang.String |
getComment()
Returns the comment value.
|
long |
getCompression()
Returns the compression value.
|
HarCustomFields |
getCustomFields()
Returns the customFields value.
|
java.lang.String |
getEncoding()
Returns the encoding value.
|
java.lang.String |
getMimeType()
Returns the mimeType value.
|
long |
getSize()
Returns the size value.
|
java.lang.String |
getText()
Returns the text value.
|
void |
setComment(java.lang.String comment)
Sets the comment value.
|
void |
setCompression(long compression)
Sets the compression value.
|
void |
setCustomFields(HarCustomFields customFields)
Sets the customFields value.
|
void |
setEncoding(java.lang.String encoding)
Sets the encoding value.
|
void |
setMimeType(java.lang.String mimeType)
Sets the mimeType value.
|
void |
setSize(long size)
Sets the size value.
|
void |
setText(java.lang.String text)
Sets the text value.
|
java.lang.String |
toString() |
void |
writeHar(org.codehaus.jackson.JsonGenerator g)
Write this object on a JsonGenerator stream
|
void |
writeJDBC(long responseId,
HarDatabaseConfig config,
long logId)
Write this object to a database according to the given configuration
|
public static java.lang.String TABLE_NAME
public HarContent(long size, long compression, java.lang.String mimeType, java.lang.String text, java.lang.String encoding, java.lang.String comment)
HarContent
objectsize
- size [number] - Length of the returned content in bytes. Should
be equal to response.bodySize if there is no compression and
bigger when the content has been compressed.compression
- compression [number, optional] - Number of bytes saved.
Leave out this field if the information is not available.mimeType
- mimeType [string] - MIME type of the response text (value
of the Content-Type response header). The charset attribute of the
MIME type is included (if available).text
- text [string, optional] - Response body sent from the server or
loaded from the browser cache. This field is populated with
textual content only. The text field is either HTTP decoded text
or a encoded (e.g. "base64") representation of the response body.
Leave out this field if the information is not available.encoding
- encoding [string, optional] (new in 1.2) - Encoding used
for response text field e.g "base64". Leave out this field if the
text field is HTTP decoded (decompressed & unchunked), than
trans-coded from its original character set into UTF-8.comment
- comment [string, optional] (new in 1.2) - A comment provided
by the user or the application.public HarContent(long size, java.lang.String mimeType)
HarContent
object using mandatory fieldssize
- size [number] - Length of the returned content in bytes. Should
be equal to response.bodySize if there is no compression and
bigger when the content has been compressed.mimeType
- mimeType [string] - MIME type of the response text (value
of the Content-Type response header). The charset attribute of the
MIME type is included (if available).public HarContent(org.codehaus.jackson.JsonParser jp, java.util.List<HarWarning> warnings) throws org.codehaus.jackson.JsonParseException, java.io.IOException
HarContent
object from a JsonParser already
positioned at the beginning of the element contentjp
- a JsonParser already positioned at the beginning of the element
contentwarnings
- null if parser should fail on first error, pointer to
warning list if warnings can be issued for missing fieldsorg.codehaus.jackson.JsonParseException
java.io.IOException
public HarContent(HarDatabaseConfig config, long responseId) throws java.sql.SQLException
HarContent
object from a database. Retrieves the
HarContent objects that corresponds to the specified response id.config
- the database configuration to useresponseId
- the response id we refer tojava.sql.SQLException
- if a database error occurspublic void writeHar(org.codehaus.jackson.JsonGenerator g) throws org.codehaus.jackson.JsonGenerationException, java.io.IOException
g
- a JsonGeneratorjava.io.IOException
- if an IO error occursorg.codehaus.jackson.JsonGenerationException
- if the generator failsHarFileWriter.writeHarFile(HarLog, java.io.File)
public void writeJDBC(long responseId, HarDatabaseConfig config, long logId) throws java.sql.SQLException
responseId
- the response id this object refers toconfig
- the database configuration to usejava.sql.SQLException
- if a database error occurspublic void deleteFromJDBC(HarDatabaseConfig config, long logId) throws java.sql.SQLException
config
- the database configurationlogId
- the logId this object refers tojava.sql.SQLException
- if a database access error occurspublic long getSize()
public void setSize(long size)
size
- The size to set.public long getCompression()
public void setCompression(long compression)
compression
- The compression to set.public java.lang.String getMimeType()
public void setMimeType(java.lang.String mimeType)
mimeType
- The mimeType to set.public java.lang.String getText()
public void setText(java.lang.String text)
text
- The text to set.public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding
- The encoding to set.public java.lang.String getComment()
public void setComment(java.lang.String comment)
comment
- The comment to set.public HarCustomFields getCustomFields()
public void setCustomFields(HarCustomFields customFields)
customFields
- The customFields to set.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright © 2011 Emmanuel Cecchet - University of Massachusetts - All Rights Reserved.