Hi Remi,

quite there, but still not sure if there is a better way to do this.

ConfigurableComponent is used on two separate places:
- to instantiate core parts of Stripes (i.e. object factory, action bean
resolver, property binder, context factory, etc.). Stripes only allows to
have on of each one of those parts, so if I want to access there Stripes'
configuration I have to replace one of those core, default classes with a
custom one. Not very appealing. Also, at that stage, Stripes Configuration
hasn't finished, so depending on which part you substitute, you may not
have all the information you need from Stripes configuration.

- to initialize Interceptors which also implement ConfigurableComponent. I
went this way, hoping that I could declare an Interceptor without
annotating it with @Intercepts (so it would be called only when
initializated), but if the Interceptor isn't annotated, then it gets
ignored. So I've ended up with an empty intercepts() method which get's
called on every request, but at least I'm able to get the required
configuration at init() time. Not the cleanest thing, but it gets things
done. I also looked at ObjectPostProcessors, but they're instantiated too
early to be able to have a look at url bindings.

Ideally, to support this kind of use cases, it would be nice to have some
sort of CustomConfigurableComponent (empty interface extending
ConfigurableComponent) which Stripes could use to initialize all classes
implementing it after it's done with the other ConfigurableComponents.
Thoughts?

Finally, just out of curiosity, regarding multiple configs: I've come
accross some comments on StripesFilter saying that it's possible, is there
any more documentation about this feature? I've had a quick look at
StripesFilter code, so most probably are more comments or javadocs
elsewhere.


thanks in advance,
juan pablo



On Thu, Jul 28, 2016 at 3:09 PM, VANKEISBELCK Remi <r...@rvkb.com> wrote:

> Hi Juan Pablo,
>
> Maybe keep the configuration it as a static field of a
> @ConfigurableComponent ?
>
> Note that it'll work only if you have one config. Stripes config allows to
> do lots of fancy stuff that I personally never used, but who knows, that
> door is open :P
>
> Cheers
>
> Rémi
>
>
>
> 2016-07-28 14:27 GMT+02:00 Juan Pablo Santos Rodríguez <
> juanpablo.san...@gmail.com>:
>
>> 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
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to