Class Task

java.lang.Object
io.dropwizard.servlets.tasks.Task
Direct Known Subclasses:
GarbageCollectionTask, LogConfigurationTask, PostBodyTask, SslReloadTask

public abstract class Task extends Object
An arbitrary administrative task which can be performed via the admin interface.
See Also:
  • Constructor Details

    • Task

      protected Task(String name)
      Create a new task with the given name.
      Parameters:
      name - the task's name
    • Task

      protected Task(String name, @Nullable String responseContentType)
      Create a new task with the given name and response content type
      Parameters:
      name - the task's name
      responseContentType - the task's response content type
      Since:
      2.0
  • Method Details

    • 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 parameters
      output - a PrintWriter wrapping the output stream of the task
      Throws:
      Exception - if something goes wrong