Class AdminRestBundle

java.lang.Object
ru.vyarus.dropwizard.guice.module.context.unique.item.UniqueGuiceyBundle
ru.vyarus.guicey.admin.AdminRestBundle
All Implemented Interfaces:
ru.vyarus.dropwizard.guice.module.installer.bundle.GuiceyBundle

public class AdminRestBundle extends ru.vyarus.dropwizard.guice.module.context.unique.item.UniqueGuiceyBundle
Adds rest support in admin context by simply redirecting from admin servlet into jersey (all rest methods are accessible from admin context).

Such approach is better than registering completely separate jersey context for admin rest because of no overhead and simplicity of jersey extensions management.

If no specific mapping path specified, rest will be mapped into the same path as main rest. If main rest mapping default ('/*') isn't changed, admin rest will be mapped to '/api/*'.

In order to hide admin specific rest methods or entire resources AdminResource annotation may be used. If some security solution is used within application, rest could be hidden with security framework permissions.

Since:
05.08.2015
  • Constructor Summary

    Constructors
    Constructor
    Description
    Admin rest will be mapped on the same path as main rest if rest mapping is different from '/*'.
    Path must end with '/*', otherwise error will be thrown.
  • Method Summary

    Modifier and Type
    Method
    Description
    Shortcut for identifyAdminPathsInRequestLogs(true).
    identifyAdminContextInRequestLogs(boolean identifyAdminPathsInRequestLogs)
    As admin rest just redirects to main context rest, then all admin rest calls would be logged.
    void
    run(ru.vyarus.dropwizard.guice.module.installer.bundle.GuiceyEnvironment environment)
     

    Methods inherited from class ru.vyarus.dropwizard.guice.module.context.unique.item.UniqueGuiceyBundle

    equals, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ru.vyarus.dropwizard.guice.module.installer.bundle.GuiceyBundle

    initialize
  • Constructor Details

    • AdminRestBundle

      public AdminRestBundle()
      Admin rest will be mapped on the same path as main rest if rest mapping is different from '/*'. Otherwise admin rest mapped to '/api/*'.
    • AdminRestBundle

      public AdminRestBundle(String path)
      Path must end with '/*', otherwise error will be thrown. For example, '/rest/*' is a valid path.
      Parameters:
      path - path to map admin rest on
  • Method Details

    • identifyAdminContextInRequestLogs

      public AdminRestBundle identifyAdminContextInRequestLogs()
      Shortcut for identifyAdminPathsInRequestLogs(true).
      Returns:
      bundle instance
    • identifyAdminContextInRequestLogs

      public AdminRestBundle identifyAdminContextInRequestLogs(boolean identifyAdminPathsInRequestLogs)
      As admin rest just redirects to main context rest, then all admin rest calls would be logged. It might be hard to identify admin calls in such logs (if rest contexts are the same and resources used from both contexts). When enabled, " (ADMIN REST)" string is appended for loggable request uri.
      Parameters:
      identifyAdminPathsInRequestLogs - true to identify admin calls in request logs
      Returns:
      bundle instance
    • run

      public void run(ru.vyarus.dropwizard.guice.module.installer.bundle.GuiceyEnvironment environment) throws Exception
      Throws:
      Exception