Juan Pablo Santos Rodríguez
2016-07-28 12:27:11 UTC
Hi,
we're currently developing some MBeans for some administrative tasks and we
would like to expose all registered ActionBeans URLs through JMX. Obtaining
them is easy, if you have a request routed through StripesFilter:
Map< String, Object > stripesUrlBindings() {
final Map< String, Object > stripesUrlBindings = new HashMap<>();
if( StripesFilter.getConfiguration() != null &&
StripesFilter.getConfiguration().getActionResolver() instanceof
AnnotatedClassActionResolver ) {
final AnnotatedClassActionResolver acar = (
AnnotatedClassActionResolver
)StripesFilter.getConfiguration().getActionResolver();
final Map< String, Class< ? extends ActionBean > >
stripesOriginalUrlBindings = acar.getUrlBindingFactory().getPathMap();
for( final Map.Entry< String, Class< ? extends ActionBean > >
entry : stripesOriginalUrlBindings.entrySet() ) {
final Map< String, String > map = new LinkedHashMap<>();
map.put( "actionbean", entry.getValue().getCanonicalName()
);
stripesUrlBindings.put( "{[" + entry.getKey() +
"],methods=[*]}", map );
}
}
return stripesUrlBindings;
}
However, a JMX call is not going to be routed through the StripesFilter so
StripesFilter.getConfiguration() yields null, and an error stating that the
request hasn't been routed through Stripes is logged.
any ideas on how to proceed?
thanks in advance,
juan pablo
we're currently developing some MBeans for some administrative tasks and we
would like to expose all registered ActionBeans URLs through JMX. Obtaining
them is easy, if you have a request routed through StripesFilter:
Map< String, Object > stripesUrlBindings() {
final Map< String, Object > stripesUrlBindings = new HashMap<>();
if( StripesFilter.getConfiguration() != null &&
StripesFilter.getConfiguration().getActionResolver() instanceof
AnnotatedClassActionResolver ) {
final AnnotatedClassActionResolver acar = (
AnnotatedClassActionResolver
)StripesFilter.getConfiguration().getActionResolver();
final Map< String, Class< ? extends ActionBean > >
stripesOriginalUrlBindings = acar.getUrlBindingFactory().getPathMap();
for( final Map.Entry< String, Class< ? extends ActionBean > >
entry : stripesOriginalUrlBindings.entrySet() ) {
final Map< String, String > map = new LinkedHashMap<>();
map.put( "actionbean", entry.getValue().getCanonicalName()
);
stripesUrlBindings.put( "{[" + entry.getKey() +
"],methods=[*]}", map );
}
}
return stripesUrlBindings;
}
However, a JMX call is not going to be routed through the StripesFilter so
StripesFilter.getConfiguration() yields null, and an error stating that the
request hasn't been routed through Stripes is logged.
any ideas on how to proceed?
thanks in advance,
juan pablo