org.apidesign.bck2brwsr.launcher

## Class InvocationContext

- java.lang.Object
- - org.apidesign.bck2brwsr.launcher.InvocationContext

-     public final class InvocationContext
      extends Object

  Represents individual method invocation, its context and its result.
  Author:
    Jaroslav Tulach

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHttpResource(String relativePath, String mimeType, String[] parameters, InputStream content)` HTTP resource to be available during execution.
    `String` | `invoke()` Invokes the associated method.
    `String` | `invoke(int[] time)` Invokes the associated method.
    `void` | `setArguments(String... args)` Arguments to pass to the invoked method.
    `void` | `setHtmlFragment(String html)` An HTML fragment to be available for the execution.
    `String` | `toString()` Obtains textual result of the invocation.

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

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

- - ### Method Detail

    - #### setHtmlFragment

          public void setHtmlFragment(String html)

      An HTML fragment to be available for the execution. Useful primarily when executing in a browser via `Launcher.createBrowser(java.lang.String)`.
      Parameters:
        `html` - the html fragment

    - #### setArguments

          public void setArguments(String... args)

      Arguments to pass to the invoked method.
      Parameters:
        `args` - textual arguments to pass to the method
      Since:
        0.18

    - #### addHttpResource

          public void addHttpResource(String relativePath,
                                      String mimeType,
                                      String[] parameters,
                                      InputStream content)

      HTTP resource to be available during execution. An invocation may perform an HTTP query and obtain a resource relative to the page.

    - #### invoke

          public String invoke()
                        throws IOException

      Invokes the associated method.
      Returns:
        the textual result of the invocation
      Throws:
        `IOException` - if execution fails

    - #### invoke

          public String invoke(int[] time)
                        throws IOException

      Invokes the associated method.
      Parameters:
        `time` - one element array to store the length of the invocation - can be `null`
      Returns:
        the textual result of the invocation
      Throws:
        `IOException` - if execution fails
      Since:
        0.20

    - #### toString

          public String toString()

      Obtains textual result of the invocation.
      Overrides:
        `toString` in class `Object`
      Returns:
        text representing the exception or result value

Copyright © 2025 API Design. All Rights Reserved.