Class HttpDevice

java.lang.Object
org.aesh.terminal.BaseDevice
org.aesh.terminal.http.HttpDevice
All Implemented Interfaces:
org.aesh.terminal.Device

public class HttpDevice extends org.aesh.terminal.BaseDevice
Device implementation for HTTP-based terminal connections.

Supports dynamic terminal type updates based on client capability reporting. When a web client connects, it can report its terminal type and capabilities, which this device will use to load the appropriate terminfo data.

Author:
Ståle W. Pedersen
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.aesh.terminal.Device

    org.aesh.terminal.Device.OscCode, org.aesh.terminal.Device.TerminalType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Default terminal type for web-based terminals.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new HTTP device with the default terminal type (xterm-256color).
    Creates a new HTTP device with the specified terminal type.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    getBooleanCapability(org.aesh.terminal.tty.Capability capability)
    Returns the client-reported features.
    getNumericCapability(org.aesh.terminal.tty.Capability capability)
    Returns the client-reported color depth as a string.
    getStringCapability(org.aesh.terminal.tty.Capability capability)
    Returns the client's user agent string.
    boolean
    hasFeature(String feature)
    Checks if the client reported a specific feature.
    void
    setFeatures(List<String> features)
    Sets the client-reported features.
    void
    Sets the client-reported color depth.
    void
    Updates the terminal type and reloads terminfo data.
    void
    setUserAgent(String userAgent)
    Sets the client's user agent string.

    Methods inherited from class org.aesh.terminal.BaseDevice

    getStringCapabilityAsInts, puts, puts

    Methods inherited from class Object

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

    Methods inherited from interface org.aesh.terminal.Device

    detectTerminalType, getColorDepth, getImageProtocol, isJetBrainsTerminal, isMultiplexer, isTmuxPassthroughEnabled, supportsGraphemeClusterMode, supportsHyperlinks, supportsImages, supportsOscCode, supportsOscQueries, supportsShellIntegration, supportsSynchronizedOutput, supportsThemeQuery
  • Field Details

    • DEFAULT_TYPE

      public static final String DEFAULT_TYPE
      Default terminal type for web-based terminals.
      See Also:
  • Constructor Details

    • HttpDevice

      public HttpDevice()
      Creates a new HTTP device with the default terminal type (xterm-256color).
    • HttpDevice

      public HttpDevice(String type)
      Creates a new HTTP device with the specified terminal type.
      Parameters:
      type - the terminal type (e.g., "vt100", "xterm-256color")
  • Method Details

    • setType

      public void setType(String type)
      Updates the terminal type and reloads terminfo data.

      This is typically called when the client reports its capabilities.

      Parameters:
      type - the new terminal type
    • setReportedColorDepth

      public void setReportedColorDepth(String colorDepth)
      Sets the client-reported color depth.
      Parameters:
      colorDepth - the color depth (e.g., "TRUE_COLOR", "256", "16")
    • getReportedColorDepth

      public String getReportedColorDepth()
      Returns the client-reported color depth as a string.
      Returns:
      the color depth, or null if not reported
    • setFeatures

      public void setFeatures(List<String> features)
      Sets the client-reported features.
      Parameters:
      features - list of feature names (e.g., "UNICODE", "CLIPBOARD")
    • getFeatures

      public List<String> getFeatures()
      Returns the client-reported features.
      Returns:
      list of feature names, or null if not reported
    • setUserAgent

      public void setUserAgent(String userAgent)
      Sets the client's user agent string.
      Parameters:
      userAgent - the user agent string
    • getUserAgent

      public String getUserAgent()
      Returns the client's user agent string.
      Returns:
      the user agent, or null if not reported
    • hasFeature

      public boolean hasFeature(String feature)
      Checks if the client reported a specific feature.
      Parameters:
      feature - the feature to check (e.g., "UNICODE", "CLIPBOARD")
      Returns:
      true if the feature was reported
    • type

      public String type()
      Specified by:
      type in interface org.aesh.terminal.Device
      Overrides:
      type in class org.aesh.terminal.BaseDevice
    • getBooleanCapability

      public boolean getBooleanCapability(org.aesh.terminal.tty.Capability capability)
      Specified by:
      getBooleanCapability in interface org.aesh.terminal.Device
      Overrides:
      getBooleanCapability in class org.aesh.terminal.BaseDevice
    • getNumericCapability

      public Integer getNumericCapability(org.aesh.terminal.tty.Capability capability)
      Specified by:
      getNumericCapability in interface org.aesh.terminal.Device
      Overrides:
      getNumericCapability in class org.aesh.terminal.BaseDevice
    • getStringCapability

      public String getStringCapability(org.aesh.terminal.tty.Capability capability)
      Specified by:
      getStringCapability in interface org.aesh.terminal.Device
      Overrides:
      getStringCapability in class org.aesh.terminal.BaseDevice