cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <p...@betaversion.org>
Subject Re: Problem with SourceResolver, so sending html email from flowscript seems impossible at the moment
Date Wed, 19 Oct 2005 12:54:52 GMT
On 19 Oct 2005, at 13:41, Ross McDonald wrote:
>
> Hi guys,
>
> I am hoping you can help me out, I am trying to send an html email  
> from flowscript...
>
> something like this...
>
>      resolver = cocoon.getComponent(SourceResolver.ROLE);
>      var sender = new MailMessageSender("our mail server");
>      sender.setCharset("UTF-8");
>      sender.setFrom(from);
>      sender.setSubject(subject);
>      //sender.setBody(body);
>      sender.setBodyFromSrc("http://www.google-evil-emporium.com");
>      sender.setBodyFromSrcMimeType("text/html");
>      sender.setTo(to);
>      sender.send(resolver);
>
> but the SourceResolver (org.apache.cocoon.environment) seems to be  
> extended from org.apache.excalibur.source.SourceResolver, so in  
> MailMessageSender the send method complains because the  
> SourceResolver passed in is not what it is expecting.  See error  
> mesage below:
>
> org.mozilla.javascript.EvaluatorException: "file:/C:/hippocms/site/ 
> editor/newsletterfrance/newsletter.js", line 126: Can't find method  
> org.apache.cocoon.mail.MailMessageSender.send 
> (org.apache.cocoon.components.CocoonComponentManager).
>
> cause: org.mozilla.javascript.EvaluatorException: "file:/C:/ 
> hippocms/site/editor/newsletterfrance/newsletter.js", line 126:  
> Can't find method org.apache.cocoon.mail.MailMessageSender.send 
> (org.apache.cocoon.components.CocoonComponentManager).
>
> I appreciate your help,

As far as I can see, o.a.cocoon.components.ComponentManager  
implements o.a.excalibur.source.SourceResolver, while  
o.a.cocoon.mail.MailMessageSender requires an  
o.a.cocoon.environment.SourceResolver...

Now, problem is that when we do a lookup for  
o.a.cocoon.environment.SourceResolver.ROLE, the returned component  
does not implement this interface (ROLE is inherited by  
o.a.excalibur.source.SourceResolver.ROLE), and therefore it gets all  
foobared up...

In other words, is there a way to get a hold on an instance of  
o.a.cocoon.environment.SourceResolver instance from the  
ComponentManager?

     Pier


Mime
View raw message