You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew Madu <an...@gmail.com> on 2007/02/17 12:20:24 UTC

HowTo obtain ISP smtp address via server/environment variables

Hi,
I have the following line in my flow document:

var sendEmail = SimpleEmail.send('smtp.ntlworld.com',userGlobal.getEmail(),'
sales@acim.com','Your Receipt',receipt());

Instead of having to hard code the smtp address, in this case '
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','Your Receipt',receipt());

--
Regards

Andrew

Re: HowTo obtain ISP smtp address via server/environment variables

Posted by Jeroen Reijn <j....@hippo.nl>.
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 <ma...@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
>     <ma...@acim.com>
>      > <mailto:sales@acim.com <ma...@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 <ma...@acim.com>
>      > <mailto:sales@acim.com <ma...@acim.com>>','Your
>     Receipt',receipt());
>      >
>      > --
>      > Regards
>      >
>      > Andrew
>      >
>      >
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>     <ma...@cocoon.apache.org>
>     For additional commands, e-mail: users-help@cocoon.apache.org
>     <ma...@cocoon.apache.org>
> 
> 

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


Higher security with DatabaseAuthenticatorAction

Posted by Gajo Csaba <cs...@enyem.com>.
Hello,

I was trying out the DatabaseAuthenticatorAction component for basic  
authentification/security. Though it works well, I noticed that it  
requires the passwords from the database not to be encrypted. Is there a  
way I can use, for example, MD5 hashing, and then compare the result with  
that in the database?

I know I could write my own Java class to do that, but I was wondering if  
Cocoon has something similar already built-in?

Thanks, Csaba



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


Re: HowTo obtain ISP smtp address via server/environment variables

Posted by Dev at weitling <de...@weitling.net>.
Hi Andrew,

you are in search for something like DHCP for mail? Sorry, there are no
common techniques yet.
If you don't want to generically use any SMTP server on the net, it
could suffice to make a property list and detect the appropriate ip/domain.

Florian

Andrew Madu wrote:
> 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?

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


Re: HowTo obtain ISP smtp address via server/environment variables

Posted by Andrew Madu <an...@gmail.com>.
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....@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
>
> Andrew Madu wrote:
> > Hi,
> > I have the following line in my flow document:
> >
> > var sendEmail = SimpleEmail.send('smtp.ntlworld.com
> > <http://smtp.ntlworld.com>',userGlobal.getEmail(),'sales@acim.com
> > <ma...@acim.com>','Your Receipt',receipt());
> >
> > Instead of having to hard code the smtp address, in this case
> > '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
> > <ma...@acim.com>','Your Receipt',receipt());
> >
> > --
> > Regards
> >
> > Andrew
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: HowTo obtain ISP smtp address via server/environment variables

Posted by Jeroen Reijn <j....@hippo.nl>.
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

Andrew Madu wrote:
> Hi,
> I have the following line in my flow document:
> 
> var sendEmail = SimpleEmail.send('smtp.ntlworld.com 
> <http://smtp.ntlworld.com>',userGlobal.getEmail(),'sales@acim.com 
> <ma...@acim.com>','Your Receipt',receipt());
> 
> Instead of having to hard code the smtp address, in this case 
> '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 
> <ma...@acim.com>','Your Receipt',receipt());
> 
> --
> Regards
> 
> Andrew
> 
> 

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