Package jline.cli

Class LineServer

java.lang.Object
org.java_websocket.WebSocketAdapter
org.java_websocket.AbstractWebSocket
org.java_websocket.server.WebSocketServer
jline.cli.LineServer
All Implemented Interfaces:
Runnable, org.java_websocket.WebSocketListener

public class LineServer extends org.java_websocket.server.WebSocketServer
LineServer is a WebSocket server that receives client connections, processes incoming messages, and interacts with the LINE Solver. It handles both text and binary messages and can be started on a specified port or host and port.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.java_websocket.server.WebSocketServer

    org.java_websocket.server.WebSocketServer.WebSocketWorker
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class org.java_websocket.server.WebSocketServer

    decoders
  • Constructor Summary

    Constructors
    Constructor
    Description
    LineServer(int port)
    Constructs a new LineServer instance on the specified port.
    LineServer(String host, int port)
    Constructs a new LineServer instance on the specified host and port.
    Constructs a new LineServer instance with a specified address.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    The main method, which serves as the entry point for the server application.
    void
    onClose(org.java_websocket.WebSocket conn, int code, String reason, boolean remote)
    Called when a connection is closed.
    void
    onError(org.java_websocket.WebSocket conn, Exception ex)
    Called when an error occurs.
    void
    onMessage(org.java_websocket.WebSocket conn, String message)
    Called when a message is received from a client.
    void
    onMessage(org.java_websocket.WebSocket conn, ByteBuffer message)
    Called when a binary message is received from a client.
    void
    onOpen(org.java_websocket.WebSocket conn, org.java_websocket.handshake.ClientHandshake handshake)
    Called when a new client connection is opened.
    void
    Called when the server is started.

    Methods inherited from class org.java_websocket.server.WebSocketServer

    addConnection, allocateBuffers, broadcast, broadcast, broadcast, broadcast, broadcast, broadcast, createBuffer, getAddress, getConnections, getDraft, getLocalSocketAddress, getMaxPendingConnections, getPort, getRemoteSocketAddress, getWebSocketFactory, onCloseInitiated, onClosing, onConnect, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand, queue, releaseBuffers, removeConnection, run, setMaxPendingConnections, setWebSocketFactory, start, stop, stop

    Methods inherited from class org.java_websocket.AbstractWebSocket

    getConnectionLostTimeout, isReuseAddr, isTcpNoDelay, setConnectionLostTimeout, setReuseAddr, setTcpNoDelay, startConnectionLostTimer, stopConnectionLostTimer

    Methods inherited from class org.java_websocket.WebSocketAdapter

    onPreparePing, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPong

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • message

      public String message
  • Constructor Details

    • LineServer

      public LineServer(int port)
      Constructs a new LineServer instance on the specified port.
      Parameters:
      port - the port on which the server will listen.
    • LineServer

      public LineServer(String host, int port)
      Constructs a new LineServer instance on the specified host and port.
      Parameters:
      host - the hostname or IP address on which the server will listen.
      port - the port on which the server will listen.
    • LineServer

      public LineServer(InetSocketAddress address)
      Constructs a new LineServer instance with a specified address.
      Parameters:
      address - the address on which the server will listen.
  • Method Details

    • main

      public static void main(String[] args)
      The main method, which serves as the entry point for the server application. It initializes and starts the server on a specified port.
      Parameters:
      args - command-line arguments (currently unused).
    • onOpen

      public void onOpen(org.java_websocket.WebSocket conn, org.java_websocket.handshake.ClientHandshake handshake)
      Called when a new client connection is opened.
      Specified by:
      onOpen in class org.java_websocket.server.WebSocketServer
      Parameters:
      conn - the WebSocket connection.
      handshake - the client handshake data.
    • onMessage

      public void onMessage(org.java_websocket.WebSocket conn, String message)
      Called when a message is received from a client. This method processes the message, saves the client data to a temporary file, and invokes the LINE Solver with the specified arguments.
      Specified by:
      onMessage in class org.java_websocket.server.WebSocketServer
      Parameters:
      conn - the WebSocket connection.
      message - the message received from the client.
    • onMessage

      public void onMessage(org.java_websocket.WebSocket conn, ByteBuffer message)
      Called when a binary message is received from a client. This method is currently a placeholder for future binary message processing.
      Overrides:
      onMessage in class org.java_websocket.server.WebSocketServer
      Parameters:
      conn - the WebSocket connection.
      message - the binary message received from the client.
    • onClose

      public void onClose(org.java_websocket.WebSocket conn, int code, String reason, boolean remote)
      Called when a connection is closed.
      Specified by:
      onClose in class org.java_websocket.server.WebSocketServer
      Parameters:
      conn - the WebSocket connection.
      code - the status code indicating the reason for closure.
      reason - a textual description of the reason for closure.
      remote - indicates whether the connection was closed by the remote host.
    • onError

      public void onError(org.java_websocket.WebSocket conn, Exception ex)
      Called when an error occurs.
      Specified by:
      onError in class org.java_websocket.server.WebSocketServer
      Parameters:
      conn - the WebSocket connection.
      ex - the exception that was thrown.
    • onStart

      public void onStart()
      Called when the server is started. This method prints the server's address and port to the console.
      Specified by:
      onStart in class org.java_websocket.server.WebSocketServer