Class LiveReloadServer
- java.lang.Object
- org.springframework.boot.devtools.livereload.LiveReloadServer
public class LiveReloadServer extends Object
A livereload server.- Since:
- 1.3.0
- See Also:
- livereload.com
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
The default live reload server port.
Constructor Summary
Constructors Constructor Description LiveReloadServer()
Create a newLiveReloadServer
listening on the default port.LiveReloadServer(int port)
Create a newLiveReloadServer
listening on the specified port.LiveReloadServer(int port, ThreadFactory threadFactory)
Create a newLiveReloadServer
listening on the specified port with a specificThreadFactory
.LiveReloadServer(ThreadFactory threadFactory)
Create a newLiveReloadServer
listening on the default port with a specificThreadFactory
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.boot.devtools.livereload.Connection
createConnection(Socket socket, InputStream inputStream, OutputStream outputStream)
Factory method used to create theConnection
.int
getPort()
Return the port that the server is listening on.boolean
isStarted()
Return if the server has been started.int
start()
Start the livereload server and accept incoming connections.void
stop()
Gracefully stop the livereload server.void
triggerReload()
Trigger livereload of all connected clients.
Field Detail
DEFAULT_PORT
public static final int DEFAULT_PORT
The default live reload server port.- See Also:
- Constant Field Values
Constructor Detail
LiveReloadServer
public LiveReloadServer()
Create a newLiveReloadServer
listening on the default port.
LiveReloadServer
public LiveReloadServer(ThreadFactory threadFactory)
Create a newLiveReloadServer
listening on the default port with a specificThreadFactory
.- Parameters:
threadFactory
- the thread factory
LiveReloadServer
public LiveReloadServer(int port)
Create a newLiveReloadServer
listening on the specified port.- Parameters:
port
- the listen port
LiveReloadServer
public LiveReloadServer(int port, ThreadFactory threadFactory)
Create a newLiveReloadServer
listening on the specified port with a specificThreadFactory
.- Parameters:
port
- the listen portthreadFactory
- the thread factory
Method Detail
start
public int start() throws IOException
Start the livereload server and accept incoming connections.- Returns:
- the port on which the server is listening
- Throws:
IOException
- in case of I/O errors
isStarted
public boolean isStarted()
Return if the server has been started.- Returns:
true
if the server is running
getPort
public int getPort()
Return the port that the server is listening on.- Returns:
- the server port
stop
public void stop() throws IOException
Gracefully stop the livereload server.- Throws:
IOException
- in case of I/O errors
triggerReload
public void triggerReload()
Trigger livereload of all connected clients.
createConnection
protected org.springframework.boot.devtools.livereload.Connection createConnection(Socket socket, InputStream inputStream, OutputStream outputStream) throws IOException
Factory method used to create theConnection
.- Parameters:
socket
- the source socketinputStream
- the socket input streamoutputStream
- the socket output stream- Returns:
- a connection
- Throws:
IOException
- in case of I/O errors