Module org.htmlunit

Class Request

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.fetch.Request
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class Request extends HtmlUnitScriptable
A JavaScript object for Request.
Author:
Ahmed Ashour, Ronald Brill
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, LEGACY_CONST, PERMANENT, READONLY, STRICTLY_READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body as ArrayBuffer.
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body as Blob.
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body as Uint8Array.
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body as FormData.
    Returns the body as ReadableStream.
    Returns the cache mode.
    Returns the credentials mode.
    Returns the destination; always empty for requests created by script.
    Returns the duplex mode; always 'half'.
    Returns the headers.
    Returns the integrity metadata.
    Returns the method.
    Returns the mode.
    Returns the redirect mode.
    Returns the referrer: 'about:client', an empty string (no referrer) or the url.
    Returns the referrer policy.
    Returns the signal.
    Returns the url.
    boolean
    Returns whether the body was used.
    boolean
    Returns whether this is a history navigation request; always false.
    boolean
    Returns whether this is a reload navigation request; always false.
    boolean
    Returns the keepalive flag.
    Returns a copy of this request.
    static Request
    jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
    JavaScript constructor.
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body parsed as JSON.
    org.htmlunit.corejs.javascript.NativePromise
    Returns a promise for the body as text.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Constructor Details

    • Request

      public Request()
      Default constructor.
  • Method Details

    • jsConstructor

      public static Request jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
      JavaScript constructor.
      Parameters:
      cx - the current context
      scope - the scope
      args - the arguments (the input - a url or a Request - and the optional init)
      ctorObj - the function object
      inNewExpr - whether invoked via new
      Returns:
      the new Request instance
      See Also:
    • jsClone

      public Request jsClone()
      Returns a copy of this request.
      Returns:
      the copy
    • getMethod

      public String getMethod()
      Returns the method.
      Returns:
      the method
    • getUrl

      public String getUrl()
      Returns the url.
      Returns:
      the url
    • getHeaders

      public Headers getHeaders()
      Returns the headers.
      Returns:
      the headers
    • getDestination

      public String getDestination()
      Returns the destination; always empty for requests created by script.
      Returns:
      the destination
    • getReferrer

      public String getReferrer()
      Returns the referrer: 'about:client', an empty string (no referrer) or the url.
      Returns:
      the referrer
    • getReferrerPolicy

      public String getReferrerPolicy()
      Returns the referrer policy.
      Returns:
      the referrer policy
    • getMode

      public String getMode()
      Returns the mode.
      Returns:
      the mode
    • getCredentials

      public String getCredentials()
      Returns the credentials mode.
      Returns:
      the credentials mode
    • getCache

      public String getCache()
      Returns the cache mode.
      Returns:
      the cache mode
    • getRedirect

      public String getRedirect()
      Returns the redirect mode.
      Returns:
      the redirect mode
    • getIntegrity

      public String getIntegrity()
      Returns the integrity metadata.
      Returns:
      the integrity metadata
    • isKeepalive

      public boolean isKeepalive()
      Returns the keepalive flag.
      Returns:
      the keepalive flag
    • getSignal

      public AbortSignal getSignal()
      Returns the signal.
      Returns:
      the signal
    • getDuplex

      public String getDuplex()
      Returns the duplex mode; always 'half'.
      Returns:
      the duplex mode
    • isIsHistoryNavigation

      public boolean isIsHistoryNavigation()
      Returns whether this is a history navigation request; always false.
      Returns:
      false
    • isIsReloadNavigation

      public boolean isIsReloadNavigation()
      Returns whether this is a reload navigation request; always false.
      Returns:
      false
    • getBody

      public ReadableStream getBody()
      Returns the body as ReadableStream.
      Returns:
      the stream or null if there is no body
    • isBodyUsed

      public boolean isBodyUsed()
      Returns whether the body was used.
      Returns:
      whether the body was used
    • text

      public org.htmlunit.corejs.javascript.NativePromise text()
      Returns a promise for the body as text.
      Returns:
      the promise
    • json

      public org.htmlunit.corejs.javascript.NativePromise json()
      Returns a promise for the body parsed as JSON.
      Returns:
      the promise
    • arrayBuffer

      public org.htmlunit.corejs.javascript.NativePromise arrayBuffer()
      Returns a promise for the body as ArrayBuffer.
      Returns:
      the promise
    • bytes

      public org.htmlunit.corejs.javascript.NativePromise bytes()
      Returns a promise for the body as Uint8Array.
      Returns:
      the promise
    • blob

      public org.htmlunit.corejs.javascript.NativePromise blob()
      Returns a promise for the body as Blob.
      Returns:
      the promise
    • formData

      public org.htmlunit.corejs.javascript.NativePromise formData()
      Returns a promise for the body as FormData.
      Returns:
      the promise