cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@hippo.nl>
Subject Re: HowTo obtain ISP smtp address via server/environment variables
Date Sun, 18 Feb 2007 21:00:17 GMT
Andrew,

that depends on what you mean with dynamic. You could create an 
configuration file in XML format and load it with an XMLFileModule? That 
way you can change it if you want. I also noticed there is a 
PropertiesFileModule. Maybe that could be the answer to your question?

Regards,

Jeroen

Andrew Madu wrote:
> Hi Jeroen,
> many thanks for your help.
> 
> What I was actually wondering was whether there was a way to dynamically 
> obtain the smtp address of the ISP without having to physically hard 
> code it as a parameter in either the cocoon.xconf or sitemap documents?
> 
> --
> Regards
> 
> Andrew
> 
> On 17/02/07, *Jeroen Reijn* <j.reijn@hippo.nl <mailto:j.reijn@hippo.nl> 
>  > wrote:
> 
>     Hi Andrew,
> 
>     there are several ways of doing this.
> 
>     A. using global variables in the sitemap
>     B. setting the value in your session with for instance the setteraction.
>     C. Using the defaults module in the cocoon.xconf
> 
>     I think there is enough information on the setter action in the archives
>     [1], so i'll try to explain the other methods. (A and C)
> 
>     A. defining the value in the sitemap
> 
>     <map:pipelines>
>        <map:component-configurations>
>          <global-variables>
>            <smtphost>localhost</smtphost>
>          </global-variables>
>        </map:component-configurations>
>     </map:pipelines>
> 
>     and passing the value as a sitemap parameter to your flowscript
>     function.
> 
>     <map:match pattern="function">
>        <map:call function="test">
>          <map:parameter name="smtp" value="{global:smtphost}"/>
>        </map:call>
>     </map:match>
> 
>     and in your flowscript:
> 
>     var smtphost = cocoon.parameters["smtp"];
> 
>     C. could specify it as a variable in the DefaultsModule (cocoon.xconf)
> 
>     <component-instance
>     class="org.apache.cocoon.components.modules.input.DefaultsModule"
>     logger="core.modules.input " name="myconstants">
>         <values>
>           <smtphost>localhost</smtphost>
>         </values>
>     </component-instance>
> 
>     Then in your flowscript you can request the value with:
> 
>     var myConstants = cocoon.getComponent(InputModule.ROLE +
>     "Selector").select("myconstants");
> 
>     var myObject = myConstants.getAttribute("smtphost",null,null);
> 
>     I hope this helps.
> 
>     Kind regards,
> 
>     Jeroen Reijn
> 
>     [1] http://marc.theaimsgroup.com/?l=xml-cocoon-users&r=1&w=2
>     <http://marc.theaimsgroup.com/?l=xml-cocoon-users&r=1&w=2>
> 
>     Andrew Madu wrote:
>      > Hi,
>      > I have the following line in my flow document:
>      >
>      > var sendEmail = SimpleEmail.send('smtp.ntlworld.com
>     <http://smtp.ntlworld.com>
>      > <
>     http://smtp.ntlworld.com>',userGlobal.getEmail(),'sales@acim.com
>     <mailto:sales@acim.com>
>      > <mailto:sales@acim.com <mailto:sales@acim.com>>','Your
>     Receipt',receipt());
>      >
>      > Instead of having to hard code the smtp address, in this case
>      > 'smtp.ntlworld.com <http://smtp.ntlworld.com>
>     <http://smtp.ntlworld.com>', is there a
>      > server/environment variable that I can pull this value from within
>      > flowscript? So my line will now look something like:
>      >
>      > var sendEmail =
>      > SimpleEmail.send(cocoon.getISPsmtp,userGlobal.getEmail
>     (),'sales@acim.com <mailto:sales@acim.com>
>      > <mailto:sales@acim.com <mailto:sales@acim.com>>','Your
>     Receipt',receipt());
>      >
>      > --
>      > Regards
>      >
>      > Andrew
>      >
>      >
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     <mailto:users-unsubscribe@cocoon.apache.org>
>     For additional commands, e-mail: users-help@cocoon.apache.org
>     <mailto:users-help@cocoon.apache.org>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message