Package org.elypia.webhooker
Class Webhooker
- java.lang.Object
-
- org.elypia.webhooker.Webhooker
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class Webhooker extends Object implements Closeable
This class should be used as a singleton. There is no need to create multiple web servers.
-
-
Constructor Summary
Constructors Constructor Description Webhooker(String publicUrl)Webhooker(String publicUrl, int port)Webhooker(String publicUrl, int port, ClientController controller)Webhooker(String publicUrl, int port, ClientController controller, com.google.gson.Gson gson)Create an instance of Webhooker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()ClientControllergetController()com.google.gson.GsongetGson()StringgetPublicUrl()StringgetPublicUrl(Client client)WebhookRoutegetRoute()
-
-
-
Constructor Detail
-
Webhooker
public Webhooker(String publicUrl) throws MalformedURLException
- Throws:
MalformedURLException
-
Webhooker
public Webhooker(String publicUrl, int port) throws MalformedURLException
- Throws:
MalformedURLException
-
Webhooker
public Webhooker(String publicUrl, int port, ClientController controller) throws MalformedURLException
- Throws:
MalformedURLException
-
Webhooker
public Webhooker(String publicUrl, int port, ClientController controller, com.google.gson.Gson gson) throws MalformedURLException
Create an instance of Webhooker.- Parameters:
publicUrl- The public URL public services are expected to POST to. This must include a route parameter/:uuid.port- The port to run the webserver, this defaults toSparks default if set to -1, a random port if 0, else the specified port.controller- The controller to manager clients.gson- The Gson (de)serializer for converting objects from JSON to POJO.- Throws:
MalformedURLException- If publicUrl is not a valid URL.
-
-
Method Detail
-
getGson
public com.google.gson.Gson getGson()
-
getPublicUrl
public String getPublicUrl()
-
getController
public ClientController getController()
-
getRoute
public WebhookRoute getRoute()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-