Class NotFound

java.lang.Object
services.moleculer.service.MoleculerComponent
services.moleculer.service.Service
services.moleculer.web.middleware.HttpMiddleware
services.moleculer.web.middleware.NotFound
All Implemented Interfaces:
services.moleculer.service.MoleculerLifecycle, HttpConstants

public class NotFound extends HttpMiddleware implements HttpConstants
Refuses all requests with "Error 400 Not Found" message. Sample usage with ServeStatic and Favicon middlewares:
route.use(new NotFound());
route.use(new ServeStatic("/", "/www"));
route.use(new Favicon("/www/images/custom.ico"));
  • Field Details

    • htmlTemplatePath

      protected String htmlTemplatePath
      Template path of the HTML response.
    • htmlTemplate

      protected String htmlTemplate
      Template of the HTML response.
  • Constructor Details

    • NotFound

      public NotFound()
    • NotFound

      public NotFound(String htmlTemplateOrPath)
  • Method Details

    • install

      public RequestProcessor install(RequestProcessor next, io.datatree.Tree config)
      Specified by:
      install in class HttpMiddleware
    • getHtmlTemplate

      public String getHtmlTemplate()
      Returns:
      the htmlTemplate
    • setHtmlTemplate

      public void setHtmlTemplate(String htmlTemplate)
      Parameters:
      htmlTemplate - the htmlTemplate to set
    • getHtmlTemplatePath

      public String getHtmlTemplatePath()
      Returns:
      the htmlTemplatePath
    • setHtmlTemplatePath

      public void setHtmlTemplatePath(String htmlTemplatePath)
      Parameters:
      htmlTemplatePath - the htmlTemplatePath to set