You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alessio Gambi <ag...@gmail.com> on 2010/10/18 07:30:57 UTC
Using Symbols
Hi,
I am using Tapestry 5.0.1.5 and I have problem with using Symbols.
In a service, I need the version of tapestry currently run, so I
injected the TAPESTRY_VERSION symbol in the service constructor (see
the code below)
public class MyComponentEventResultProcessor implements
ComponentEventResultProcessor
private String tapestryVersion;
final RequestGlobals requestGlobals
public MyComponentEventResultProcessor(RequestGlobals requestGlobals,
@Symbol(SymbolConstants.TAPESTRY_VERSION) String tapestryVersion) {
this.requestGlobals = requestGlobals;
this.tapestryVersion = tapestryVersion;
}
public void processResultValue(Object value) throws IOException {
System
.out.println("MyComponentEventResultProcessor.processResultValue()
tapestryVersion = "+ tapestryVersion );
...
}
...
}
When the service method is called, then the output in the console is
not what I expected:
MyComponentEventResultProcessor.processResultValue() tapestryVersion =
MyComponentEventResultProcessor
The service is used to advice the AjaxComponentEventResultProcessor:
@Match("*ComponentEventResultProcessor")
public static void adviseAjaxRequest(
MethodAdviceReceiver receiver,
final RequestGlobals requestGlobals,
final MyComponentEventResultProcessor
myComponentEventResultProcessor) {
Did I do something wrong ? How can I solve/workaround this ?
Thank you.
-- Alessio
Re: Using Symbols
Posted by Kalle Korhonen <ka...@gmail.com>.
As I recall, it had something to do with the IoC having an issue
identifying symbol injection with String value types without
additional information.
Kalle
On Sun, Oct 17, 2010 at 10:41 PM, Alessio Gambi <ag...@gmail.com> wrote:
> Hi,
>
> I solved this by adding the @Inject annotation. BTW, why something @Symbol
> annotation is used without the @Inject and other time they are coupled ?
>
> Thanks.
> -- Alessio
>
> On Oct 18, 2010, at 7:30 AM, Alessio Gambi wrote:
>
>> Hi,
>>
>> I am using Tapestry 5.0.1.5 and I have problem with using Symbols.
>>
>> In a service, I need the version of tapestry currently run, so I injected
>> the TAPESTRY_VERSION symbol in the service constructor (see the code below)
>>
>> public class MyComponentEventResultProcessor implements
>> ComponentEventResultProcessor
>>
>> private String tapestryVersion;
>> final RequestGlobals requestGlobals
>>
>> public MyComponentEventResultProcessor(RequestGlobals
>> requestGlobals, @Symbol(SymbolConstants.TAPESTRY_VERSION) String
>> tapestryVersion) {
>> this.requestGlobals = requestGlobals;
>> this.tapestryVersion = tapestryVersion;
>> }
>>
>> public void processResultValue(Object value) throws IOException {
>>
>> System.out.println("MyComponentEventResultProcessor.processResultValue()
>> tapestryVersion = "+ tapestryVersion );
>> ...
>> }
>> ...
>> }
>>
>> When the service method is called, then the output in the console is not
>> what I expected:
>>
>> MyComponentEventResultProcessor.processResultValue() tapestryVersion =
>> MyComponentEventResultProcessor
>>
>>
>> The service is used to advice the AjaxComponentEventResultProcessor:
>> @Match("*ComponentEventResultProcessor")
>> public static void adviseAjaxRequest(
>> MethodAdviceReceiver receiver,
>> final RequestGlobals requestGlobals,
>> final MyComponentEventResultProcessor
>> myComponentEventResultProcessor) {
>>
>> Did I do something wrong ? How can I solve/workaround this ?
>>
>> Thank you.
>>
>> -- Alessio
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Using Symbols
Posted by Alessio Gambi <ag...@gmail.com>.
Hi,
I solved this by adding the @Inject annotation. BTW, why something
@Symbol annotation is used without the @Inject and other time they are
coupled ?
Thanks.
-- Alessio
On Oct 18, 2010, at 7:30 AM, Alessio Gambi wrote:
> Hi,
>
> I am using Tapestry 5.0.1.5 and I have problem with using Symbols.
>
> In a service, I need the version of tapestry currently run, so I
> injected the TAPESTRY_VERSION symbol in the service constructor (see
> the code below)
>
> public class MyComponentEventResultProcessor implements
> ComponentEventResultProcessor
>
> private String tapestryVersion;
> final RequestGlobals requestGlobals
>
> public MyComponentEventResultProcessor(RequestGlobals
> requestGlobals, @Symbol(SymbolConstants.TAPESTRY_VERSION) String
> tapestryVersion) {
> this.requestGlobals = requestGlobals;
> this.tapestryVersion = tapestryVersion;
> }
>
> public void processResultValue(Object value) throws IOException {
>
> System
> .out.println("MyComponentEventResultProcessor.processResultValue()
> tapestryVersion = "+ tapestryVersion );
> ...
> }
> ...
> }
>
> When the service method is called, then the output in the console is
> not what I expected:
>
> MyComponentEventResultProcessor.processResultValue() tapestryVersion
> = MyComponentEventResultProcessor
>
>
> The service is used to advice the AjaxComponentEventResultProcessor:
> @Match("*ComponentEventResultProcessor")
> public static void adviseAjaxRequest(
> MethodAdviceReceiver receiver,
> final RequestGlobals requestGlobals,
> final MyComponentEventResultProcessor
> myComponentEventResultProcessor) {
>
> Did I do something wrong ? How can I solve/workaround this ?
>
> Thank you.
>
> -- Alessio