Just so I can catch up a bit: you no longer have a null-pointer problem when
accessing the ServletContext? And the URL object returned from getResource()
is non-null? I did assume that your application has an index.html - you may
want to try a path you know exists within your application.

Mike


On 1/21/08, Ding, Qin <[EMAIL PROTECTED]> wrote:
>
>  Mike:
>
>
>
> After getting ServletContextAware, as you said, I called URL url =
> servletContext.getResource("/index.html").  Also, I tried to get Host,
> Port … from url object, I got Host null, and port 0.  What did I do wrong?
> The applicationURL does not work without host, serverName, and port.
>
>
>
> QD
>    ------------------------------
>
> *From:* Michael Horwitz [mailto:[EMAIL PROTECTED]
> *Sent:* Friday, January 18, 2008 9:39 AM
> *To:* [email protected]
> *Subject:* Re: [appfuse-user] Send Email from Service Layer
>
>
>
> Make your bean extend the interface ServletContextAware. When Spring wires
> up your application it will pass in the ServletContext. To obtain the web
> URL simply call servletContext.getResource("/index.html") or something
> similar.
>
>
>
> Mike
>
>
>
> On 1/18/08, *Ding, Qin* <[EMAIL PROTECTED]> wrote:
>
> Yes, Matt, I can pass the emailEngine but how do I get "applicationURL"
> value to the service layer?
>
> Qin
>
> -----Original Message-----
> From: Matt Raible [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 17, 2008 4:36 PM
> To: [email protected]
> Subject: Re: [appfuse-user] Send Email from Service Layer
>
> You should be able to add a setEmailEngine method and wire it up in
> your XML file with:
>
> <property name="emailEngine" ref="emailEngine"/>
>
> Matt
>
> On 1/17/08, Ding, Qin <[EMAIL PROTECTED]> wrote:
> > I have a need to send email from service layer (ie.,
> > xxxManagerImpl.java) rather than web layer. There is no web layer for
> > the application. This is a scheduled batch job. How do I get the
> > emailEngine bean defined in spring applicationContext-service.xml from
> > xxxManagerImpl.java?
> >
> > Thank you.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

Reply via email to