Class HttpDevice

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

public class HttpDevice extends 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
  • 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 Device
      Overrides:
      type in class BaseDevice
    • getBooleanCapability

      public boolean getBooleanCapability(Capability capability)
      Specified by:
      getBooleanCapability in interface Device
      Overrides:
      getBooleanCapability in class BaseDevice
    • getNumericCapability

      public Integer getNumericCapability(Capability capability)
      Specified by:
      getNumericCapability in interface Device
      Overrides:
      getNumericCapability in class BaseDevice
    • getStringCapability

      public String getStringCapability(Capability capability)
      Specified by:
      getStringCapability in interface Device
      Overrides:
      getStringCapability in class BaseDevice