Package io.dropwizard.servlets.tasks
Class Task
- java.lang.Object
-
- io.dropwizard.servlets.tasks.Task
-
- Direct Known Subclasses:
GarbageCollectionTask,LogConfigurationTask,PostBodyTask
public abstract class Task extends Object
An arbitrary administrative task which can be performed via the admin interface.- See Also:
TaskServlet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidexecute(Map<String,List<String>> parameters, PrintWriter output)Executes the task.StringgetName()Returns the task's name,Optional<String>getResponseContentType()Returns the task's response content type.
-
-
-
Constructor Detail
-
Task
protected Task(String name)
Create a new task with the given name.- Parameters:
name- the task's name
-
-
Method Detail
-
getName
public String getName()
Returns the task's name,- Returns:
- the task's name
-
getResponseContentType
public Optional<String> getResponseContentType()
Returns the task's response content type.- Returns:
- the task's response content type
- Since:
- 2.0
-
execute
public abstract void execute(Map<String,List<String>> parameters, PrintWriter output) throws Exception
Executes the task.- Parameters:
parameters- the query string parametersoutput- aPrintWriterwrapping the output stream of the task- Throws:
Exception- if something goes wrong
-
-