Package ru.vyarus.guicey.admin
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
ConstructorsConstructorDescriptionAdmin rest will be mapped on the same path as main rest if rest mapping is different from '/*'.AdminRestBundle(String path) Path must end with '/*', otherwise error will be thrown. -
Method Summary
Modifier and TypeMethodDescriptionShortcut foridentifyAdminPathsInRequestLogs(true).identifyAdminContextInRequestLogs(boolean identifyAdminPathsInRequestLogs) As admin rest just redirects to main context rest, then all admin rest calls would be logged.voidrun(ru.vyarus.dropwizard.guice.module.installer.bundle.GuiceyEnvironment environment) Methods inherited from class ru.vyarus.dropwizard.guice.module.context.unique.item.UniqueGuiceyBundle
equals, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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
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
Shortcut foridentifyAdminPathsInRequestLogs(true).- Returns:
- bundle instance
-
identifyAdminContextInRequestLogs
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
-