One POSSIBLE approach is to creats a Struts plug-in. In that you can get access to the ServletContext through the ActionServlet reference that is passed in by Struts. I THINK that will give you enough information to create the portion of your URLs that wouldn't change. Then just store that in a static variable somewhere and access it later from your service thread to create your final URLs. I'm pretty sure you can't get access to the server, port and all that stuff from there, but depending on your needs you may not have to. Anyway, it might be worth a few minutes to explore the possibility.
Frank
From: Ken Pelletier <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Dynamically creating URLs w/o request? Date: Thu, 10 Jun 2004 11:50:56 -0500
I have a struts application that makes use of an email service layer. The email service provides a merge facility (via Velocity) and a delivery facility (via JavaMail).
Typically, the application invokes the mail service within a struts action, where it has access to the request to get the relevant URL into a merge context. Here I make use of RequestUtils.serverURL(request), request.getContextPath(), et al. to cook up a URL string.
I now have a new use case where a service thread running inside the container will be invoking the email service. Since this thread does not have access to a request, I'm struggling to find a way to get dynamically create URLs for a merge context without declaring anything statically inside a config.
Any suggestions?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Looking to buy a house? Get informed with the Home Buying Guide from MSN House & Home. http://coldwellbanker.msn.com/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]