Package org.htmlunit

# Class StringWebResponse

java.lang.Object
org.htmlunit.WebResponse
org.htmlunit.StringWebResponse

All Implemented Interfaces:
  `Serializable`

public class StringWebResponse extends WebResponse
A simple WebResponse created from a string. Content is assumed to be of type `text/html`.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StringWebResponse(String content, URL originatingURL)`
  Creates an instance associated with the specified originating URL.
  `StringWebResponse(String content, Charset charset, URL originatingURL)`
  Creates an instance associated with the specified originating URL.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isFromJavascript()`
  Returns the fromJavascript property.
  `void`
  `setFromJavascript(boolean fromJavascript)`
  Sets the fromJavascript_ property.

  ### Methods inherited from class org.htmlunit.WebResponse

  `cleanUp, defaultCharsetUtf8, getBlockReason, getContentAsStream, getContentAsStreamWithBomIfApplicable, getContentAsString, getContentAsString, getContentCharset, getContentCharsetOrNull, getContentLength, getContentType, getHeaderContentCharset, getLoadTime, getProtocolVersion, getRawSize, getResponseHeaders, getResponseHeaderValue, getStatusCode, getStatusMessage, getWebRequest, isSuccess, isSuccessOrUseProxy, isSuccessOrUseProxyOrNotModified, markAsBlocked, setProtocolVersion, setRawSize, wasBlocked, wasContentCharsetTentative`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### StringWebResponse

    public StringWebResponse(String content, URL originatingURL)
    Creates an instance associated with the specified originating URL.
    Parameters:
      `content` - the content to return
      `originatingURL` - the URL that this should be associated with

  - ### StringWebResponse

    public StringWebResponse(String content, Charset charset, URL originatingURL)
    Creates an instance associated with the specified originating URL.
    Parameters:
      `content` - the content to return
      `charset` - the charset used to convert the content
      `originatingURL` - the URL that this should be associated with

- ## Method Details

  - ### isFromJavascript

    public boolean isFromJavascript()
    Returns the fromJavascript property. This is true, if the response was created from javascript (usually document.write).
    Returns:
      the from fromJavascript_

  - ### setFromJavascript

    public void setFromJavascript(boolean fromJavascript)
    Sets the fromJavascript_ property. Set this to true, if the response was created from javascript (usually document.write).
    Parameters:
      `fromJavascript` - the new fromJavascript