|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.baka.ambient.commons.SocketServer sk.baka.ambient.collection.ampache.AmpacheServer
public final class AmpacheServer
Provides the Ampache XML API services over a network. Hosts local tracks only.
Field Summary | |
---|---|
String |
myIP
IP address of this device, must not be null . |
static int |
PORT
The port to listen on. |
Constructor Summary | |
---|---|
AmpacheServer(String password,
ICollection collection)
Creates new server instance. |
Method Summary | |
---|---|
protected void |
handleRequest(Socket socket,
InputStream in,
OutputStream out)
Handles a request. |
protected void |
onStopping()
Invoked when the server is being stopped. |
void |
reset(String password)
Resets the server and sets new credentials required. |
Methods inherited from class sk.baka.ambient.commons.SocketServer |
---|
close, isStarted, newThread, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PORT
public volatile String myIP
null
.
Constructor Detail |
---|
public AmpacheServer(String password, ICollection collection)
password
- initial password. If null
then the security is
disabled.collection
- The backend collection, must not be null
.Method Detail |
---|
public void reset(String password)
password
- the passwordprotected void handleRequest(Socket socket, InputStream in, OutputStream out) throws IOException, ServerHttpException, InterruptedException
SocketServer
Thread.isInterrupted()
, terminating ASAP when
interrupted.
handleRequest
in class SocketServer
socket
- the socket for this request.in
- opened read pipe from the socket.out
- opened write pipe to the socket.
IOException
- if i/o error occurs.
ServerHttpException
- if HTTP error occurs. This error is written as a HTTP
response. If you decide to throw this error then make sure
that nothing was written yet to out
.
InterruptedException
- if interrupted.protected void onStopping()
SocketServer
onStopping
in class SocketServer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |