public class HttpRestServerImpl extends AbstractRestService implements HttpRestServer
RestService
interface using the
HttpRestServer
defined in com.sun.net.httpserver package.org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON>
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON>
Constructor and Description |
---|
HttpRestServerImpl()
Constructs a
HttpRestServerImpl listening to the given
localhost's port for HTTP requests. |
HttpRestServerImpl(ExecutorService aExecutorService)
Constructs a
HttpRestServerImpl listening to the given
localhost's port for HTTP requests. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
open(Integer aPort) |
void |
open(Integer aPort,
int aMaxConnections)
Opens the HTTP sever connection (socket) at the given port allowing the
given number of maximum connections at the same time.
|
addMediaTypeFactory, dispose, fireEvent, initMedaTypeFactories, onHttpRequest, subscribeObserver, subscribeObserver, toMediaTypeFactory, unsubscribeObserver
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserverSubscription, isEmpty, setThreadPriority, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addMediaTypeFactory, onDelete, onGet, onPost, onPut, subscribeObserver
public HttpRestServerImpl()
HttpRestServerImpl
listening to the given
localhost's port for HTTP requests.public HttpRestServerImpl(ExecutorService aExecutorService)
HttpRestServerImpl
listening to the given
localhost's port for HTTP requests.aMaxConnections
- The number of connections open at the same time.aExecutorService
- An executor service to be used when creating
Thread
s.public void open(Integer aPort) throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.ConnectionOpenable<Integer>
org.refcodes.component.OpenException
public void open(Integer aPort, int aMaxConnections) throws org.refcodes.component.OpenException
HttpRestServer
open
in interface HttpRestServer
aPort
- The port on which to listen for requests.aMaxConnections
- The number of maximum connections at the same timeorg.refcodes.component.OpenException
- thrown in case something went wrong such as the
port being already in use.public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
org.refcodes.component.CloseException
Copyright © 2016. All rights reserved.