You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2006/11/10 09:20:33 UTC
svn commit: r473249 - in /james/server/trunk/src: java/org/apache/james/
java/org/apache/james/transport/mailets/ test/org/apache/james/
Author: norman
Date: Fri Nov 10 00:20:30 2006
New Revision: 473249
URL: http://svn.apache.org/viewvc?view=rev&rev=473249
Log:
Put the hostname and hostaddress in the mailetcontext to remove all InetAddress usage from mailets. See JAMES-643
Modified:
james/server/trunk/src/java/org/apache/james/Constants.java
james/server/trunk/src/java/org/apache/james/James.java
james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
james/server/trunk/src/test/org/apache/james/JamesTest.java
Modified: james/server/trunk/src/java/org/apache/james/Constants.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/Constants.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/Constants.java (original)
+++ james/server/trunk/src/java/org/apache/james/Constants.java Fri Nov 10 00:20:30 2006
@@ -58,5 +58,15 @@
* Avalon aware Mailets.
*/
public static final String AVALON_COMPONENT_MANAGER = "AVALON_COMP_MGR";
+
+ /**
+ * Key used to store the hostaddress of the localhost
+ */
+ public static final String HOSTADDRESS = "127.0.0.1";
+
+ /**
+ * Key used to store the hostname of localhost
+ */
+ public static final String HOSTNAME = "localhost";
}
Modified: james/server/trunk/src/java/org/apache/james/James.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/James.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/James.java (original)
+++ james/server/trunk/src/java/org/apache/james/James.java Fri Nov 10 00:20:30 2006
@@ -259,6 +259,14 @@
java.io.File configDir = fileSystem.getFile("file://conf/");
attributes.put("confDir", configDir.getCanonicalPath());
+ try {
+ attributes.put(Constants.HOSTADDRESS, lookupDNSServer().getLocalHost().getHostAddress());
+ attributes.put(Constants.HOSTNAME, lookupDNSServer().getLocalHost().getHostName());
+ } catch (java.net.UnknownHostException _) {
+ attributes.put(Constants.HOSTADDRESS, "127.0.0.1");
+ attributes.put(Constants.HOSTNAME, "localhost");
+ }
+
initializeLocalDeliveryMailet();
System.out.println(SOFTWARE_NAME_VERSION);
Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java Fri Nov 10 00:20:30 2006
@@ -44,6 +44,7 @@
import org.apache.mailet.RFC2822Headers;
import org.apache.mailet.dates.RFC822DateFormat;
+import org.apache.james.Constants;
import org.apache.james.core.MailImpl;
import org.apache.james.core.MimeMessageUtil;
@@ -982,14 +983,9 @@
// We don't need to use the original Remote Address and Host,
// and doing so would likely cause a loop with spam detecting
// matchers.
- try {
- newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
- newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
- } catch (java.net.UnknownHostException _) {
- newMail.setRemoteAddr("127.0.0.1");
- newMail.setRemoteHost("localhost");
- }
-
+ newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
+ newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
+
if (isDebug) {
log("New mail - sender: " + newMail.getSender()
+ ", recipients: " + arrayToString(newMail.getRecipients().toArray())
Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java Fri Nov 10 00:20:30 2006
@@ -21,6 +21,7 @@
package org.apache.james.transport.mailets;
+import org.apache.james.Constants;
import org.apache.james.core.MailImpl;
import org.apache.james.util.VirtualUserTableUtil;
import org.apache.mailet.GenericMailet;
@@ -164,13 +165,9 @@
// duplicates the Mail object, to be able to modify the new mail keeping the original untouched
MailImpl newMail = new MailImpl(mail);
try {
- try {
- newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
- newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
- } catch (java.net.UnknownHostException _) {
- newMail.setRemoteAddr("127.0.0.1");
- newMail.setRemoteHost("localhost");
- }
+ newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
+ newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
+
newMail.setRecipients(recipientsToAddForward);
newMail.setAttribute(MARKER, Boolean.TRUE);
getMailetContext().sendMail(newMail);
Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java Fri Nov 10 00:20:30 2006
@@ -152,14 +152,9 @@
// We don't need to use the original Remote Address and Host,
// and doing so would likely cause a loop with spam detecting
// matchers.
- try {
- newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
- newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
- } catch (java.net.UnknownHostException _) {
- newMail.setRemoteAddr("127.0.0.1");
- newMail.setRemoteHost("localhost");
- }
-
+ newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
+ newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
+
if (originalMail.getSender() == null) {
if (isDebug)
log("Processing a bounce request for a message with an empty reverse-path. No bounce will be sent.");
Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Fri Nov 10 00:20:30 2006
@@ -860,8 +860,8 @@
PrintWriter out = new PrintWriter(sout, true);
String machine = "[unknown]";
try {
- InetAddress me = InetAddress.getLocalHost();
- machine = me.getHostName();
+ machine = getMailetContext().getAttribute(Constants.HOSTNAME).toString();
+
} catch(Exception e){
machine = "[address unknown]";
}
Modified: james/server/trunk/src/test/org/apache/james/JamesTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/JamesTest.java?view=diff&rev=473249&r1=473248&r2=473249
==============================================================================
--- james/server/trunk/src/test/org/apache/james/JamesTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/JamesTest.java Fri Nov 10 00:20:30 2006
@@ -42,6 +42,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
@@ -126,6 +127,10 @@
DNSServer dns = new AbstractDNSServer() {
public String getHostName(InetAddress addr) {
return "localhost";
+ }
+
+ public InetAddress getLocalHost() throws UnknownHostException {
+ throw new UnknownHostException("Unknown");
}
};
return dns;
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r473249 - in /james/server/trunk/src: java/org/apache/james/
java/org/apache/james/transport/mailets/ test/org/apache/james/
Posted by Stefano Bagnara <ap...@bago.org>.
norman@apache.org wrote:
> Author: norman
> Date: Fri Nov 10 00:20:30 2006
> New Revision: 473249
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=473249
> Log:
> Put the hostname and hostaddress in the mailetcontext to remove all InetAddress usage from mailets. See JAMES-643
> [...]
> Modified: james/server/trunk/src/java/org/apache/james/Constants.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/Constants.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/Constants.java (original)
> +++ james/server/trunk/src/java/org/apache/james/Constants.java Fri Nov 10 00:20:30 2006
> @@ -58,5 +58,15 @@
> * Avalon aware Mailets.
> */
> public static final String AVALON_COMPONENT_MANAGER = "AVALON_COMP_MGR";
> +
> + /**
> + * Key used to store the hostaddress of the localhost
> + */
> + public static final String HOSTADDRESS = "127.0.0.1";
> +
> + /**
> + * Key used to store the hostname of localhost
> + */
> + public static final String HOSTNAME = "localhost";
The key you used are misleading, I would change it to:
public static final String HOSTADDRESS =
"org.apache.james.localhost_address";
public static final String HOSTNAME = "org.apache.james.localhost_name";
Otherwise people could think we hardcoded the hostname "localhost" and
the hostaddress "127.0.0.1" in the Constants, that is not the case: they
only are strings to be used as map keys.
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r473249 - in /james/server/trunk/src: java/org/apache/james/ java/org/apache/james/transport/mailets/ test/org/apache/james/
Posted by Bernd Fondermann <be...@googlemail.com>.
How do you know localhost resolves to "localhost" with IP 127.0.0.1
and not for example "loopback" with IP 127.0.0.2?
I am not a network guru, not even an expert, but AFAIK, this would be
all legitimate.
Bernd
On 11/10/06, norman@apache.org <no...@apache.org> wrote:
> Author: norman
> Date: Fri Nov 10 00:20:30 2006
> New Revision: 473249
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=473249
> Log:
> Put the hostname and hostaddress in the mailetcontext to remove all InetAddress usage from mailets. See JAMES-643
>
> Modified:
> james/server/trunk/src/java/org/apache/james/Constants.java
> james/server/trunk/src/java/org/apache/james/James.java
> james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
> james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
> james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
> james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
> james/server/trunk/src/test/org/apache/james/JamesTest.java
>
> Modified: james/server/trunk/src/java/org/apache/james/Constants.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/Constants.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/Constants.java (original)
> +++ james/server/trunk/src/java/org/apache/james/Constants.java Fri Nov 10 00:20:30 2006
> @@ -58,5 +58,15 @@
> * Avalon aware Mailets.
> */
> public static final String AVALON_COMPONENT_MANAGER = "AVALON_COMP_MGR";
> +
> + /**
> + * Key used to store the hostaddress of the localhost
> + */
> + public static final String HOSTADDRESS = "127.0.0.1";
> +
> + /**
> + * Key used to store the hostname of localhost
> + */
> + public static final String HOSTNAME = "localhost";
>
> }
>
> Modified: james/server/trunk/src/java/org/apache/james/James.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/James.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/James.java (original)
> +++ james/server/trunk/src/java/org/apache/james/James.java Fri Nov 10 00:20:30 2006
> @@ -259,6 +259,14 @@
> java.io.File configDir = fileSystem.getFile("file://conf/");
> attributes.put("confDir", configDir.getCanonicalPath());
>
> + try {
> + attributes.put(Constants.HOSTADDRESS, lookupDNSServer().getLocalHost().getHostAddress());
> + attributes.put(Constants.HOSTNAME, lookupDNSServer().getLocalHost().getHostName());
> + } catch (java.net.UnknownHostException _) {
> + attributes.put(Constants.HOSTADDRESS, "127.0.0.1");
> + attributes.put(Constants.HOSTNAME, "localhost");
> + }
> +
> initializeLocalDeliveryMailet();
>
> System.out.println(SOFTWARE_NAME_VERSION);
>
> Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java (original)
> +++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java Fri Nov 10 00:20:30 2006
> @@ -44,6 +44,7 @@
>
> import org.apache.mailet.RFC2822Headers;
> import org.apache.mailet.dates.RFC822DateFormat;
> +import org.apache.james.Constants;
> import org.apache.james.core.MailImpl;
> import org.apache.james.core.MimeMessageUtil;
>
> @@ -982,14 +983,9 @@
> // We don't need to use the original Remote Address and Host,
> // and doing so would likely cause a loop with spam detecting
> // matchers.
> - try {
> - newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
> - newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
> - } catch (java.net.UnknownHostException _) {
> - newMail.setRemoteAddr("127.0.0.1");
> - newMail.setRemoteHost("localhost");
> - }
> -
> + newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
> + newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
> +
> if (isDebug) {
> log("New mail - sender: " + newMail.getSender()
> + ", recipients: " + arrayToString(newMail.getRecipients().toArray())
>
> Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java (original)
> +++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java Fri Nov 10 00:20:30 2006
> @@ -21,6 +21,7 @@
>
> package org.apache.james.transport.mailets;
>
> +import org.apache.james.Constants;
> import org.apache.james.core.MailImpl;
> import org.apache.james.util.VirtualUserTableUtil;
> import org.apache.mailet.GenericMailet;
> @@ -164,13 +165,9 @@
> // duplicates the Mail object, to be able to modify the new mail keeping the original untouched
> MailImpl newMail = new MailImpl(mail);
> try {
> - try {
> - newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
> - newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
> - } catch (java.net.UnknownHostException _) {
> - newMail.setRemoteAddr("127.0.0.1");
> - newMail.setRemoteHost("localhost");
> - }
> + newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
> + newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
> +
> newMail.setRecipients(recipientsToAddForward);
> newMail.setAttribute(MARKER, Boolean.TRUE);
> getMailetContext().sendMail(newMail);
>
> Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java (original)
> +++ james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java Fri Nov 10 00:20:30 2006
> @@ -152,14 +152,9 @@
> // We don't need to use the original Remote Address and Host,
> // and doing so would likely cause a loop with spam detecting
> // matchers.
> - try {
> - newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getHostAddress());
> - newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getHostName());
> - } catch (java.net.UnknownHostException _) {
> - newMail.setRemoteAddr("127.0.0.1");
> - newMail.setRemoteHost("localhost");
> - }
> -
> + newMail.setRemoteAddr(getMailetContext().getAttribute(Constants.HOSTADDRESS).toString());
> + newMail.setRemoteHost(getMailetContext().getAttribute(Constants.HOSTNAME).toString());
> +
> if (originalMail.getSender() == null) {
> if (isDebug)
> log("Processing a bounce request for a message with an empty reverse-path. No bounce will be sent.");
>
> Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
> +++ james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Fri Nov 10 00:20:30 2006
> @@ -860,8 +860,8 @@
> PrintWriter out = new PrintWriter(sout, true);
> String machine = "[unknown]";
> try {
> - InetAddress me = InetAddress.getLocalHost();
> - machine = me.getHostName();
> + machine = getMailetContext().getAttribute(Constants.HOSTNAME).toString();
> +
> } catch(Exception e){
> machine = "[address unknown]";
> }
>
> Modified: james/server/trunk/src/test/org/apache/james/JamesTest.java
> URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/JamesTest.java?view=diff&rev=473249&r1=473248&r2=473249
> ==============================================================================
> --- james/server/trunk/src/test/org/apache/james/JamesTest.java (original)
> +++ james/server/trunk/src/test/org/apache/james/JamesTest.java Fri Nov 10 00:20:30 2006
> @@ -42,6 +42,7 @@
> import java.io.File;
> import java.io.FileNotFoundException;
> import java.net.InetAddress;
> +import java.net.UnknownHostException;
> import java.util.ArrayList;
> import java.util.List;
>
> @@ -126,6 +127,10 @@
> DNSServer dns = new AbstractDNSServer() {
> public String getHostName(InetAddress addr) {
> return "localhost";
> + }
> +
> + public InetAddress getLocalHost() throws UnknownHostException {
> + throw new UnknownHostException("Unknown");
> }
> };
> return dns;
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r473249 - in /james/server/trunk/src: java/org/apache/james/ java/org/apache/james/transport/mailets/ test/org/apache/james/
Posted by Bernd Fondermann <be...@googlemail.com>.
-- climbing out of the trap --
Thanks, ;-)
Bernd
On 11/10/06, Norman Maurer <nm...@byteaction.de> wrote:
> Stefano Bagnara schrieb:
> > norman@apache.org wrote:
> >> Author: norman
> >> Date: Fri Nov 10 00:20:30 2006
> >> New Revision: 473249
> >>
> >> URL: http://svn.apache.org/viewvc?view=rev&rev=473249
> >> Log:
> >> Put the hostname and hostaddress in the mailetcontext to remove all
> >> InetAddress usage from mailets. See JAMES-643
> >> [...]
> >> Modified: james/server/trunk/src/java/org/apache/james/Constants.java
> >> URL:
> >> http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/Constants.java?view=diff&rev=473249&r1=473248&r2=473249
> >>
> >> ==============================================================================
> >>
> >> --- james/server/trunk/src/java/org/apache/james/Constants.java
> >> (original)
> >> +++ james/server/trunk/src/java/org/apache/james/Constants.java Fri
> >> Nov 10 00:20:30 2006
> >> @@ -58,5 +58,15 @@
> >> * Avalon aware Mailets.
> >> */
> >> public static final String AVALON_COMPONENT_MANAGER =
> >> "AVALON_COMP_MGR";
> >> + + /**
> >> + * Key used to store the hostaddress of the localhost
> >> + */
> >> + public static final String HOSTADDRESS = "127.0.0.1";
> >> + + /**
> >> + * Key used to store the hostname of localhost
> >> + */
> >> + public static final String HOSTNAME = "localhost";
> >
> >
> > The key you used are misleading, I would change it to:
> >
> > public static final String HOSTADDRESS =
> > "org.apache.james.localhost_address";
> > public static final String HOSTNAME = "org.apache.james.localhost_name";
> >
> > Otherwise people could think we hardcoded the hostname "localhost" and
> > the hostaddress "127.0.0.1" in the Constants, that is not the case:
> > they only are strings to be used as map keys.
> >
> > Stefano
> >
> >
> You are absolutly right..
> I now changed it to:
>
> public static final String HOSTADDRESS = "LOCAL_HOSTADDRESS";
> public static final String HOSTNAME = "LOCAL_HOSTNAME";
>
>
> bye
> Norman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r473249 - in /james/server/trunk/src: java/org/apache/james/
java/org/apache/james/transport/mailets/ test/org/apache/james/
Posted by Norman Maurer <nm...@byteaction.de>.
Stefano Bagnara schrieb:
> norman@apache.org wrote:
>> Author: norman
>> Date: Fri Nov 10 00:20:30 2006
>> New Revision: 473249
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=473249
>> Log:
>> Put the hostname and hostaddress in the mailetcontext to remove all
>> InetAddress usage from mailets. See JAMES-643
>> [...]
>> Modified: james/server/trunk/src/java/org/apache/james/Constants.java
>> URL:
>> http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/Constants.java?view=diff&rev=473249&r1=473248&r2=473249
>>
>> ==============================================================================
>>
>> --- james/server/trunk/src/java/org/apache/james/Constants.java
>> (original)
>> +++ james/server/trunk/src/java/org/apache/james/Constants.java Fri
>> Nov 10 00:20:30 2006
>> @@ -58,5 +58,15 @@
>> * Avalon aware Mailets.
>> */
>> public static final String AVALON_COMPONENT_MANAGER =
>> "AVALON_COMP_MGR";
>> + + /**
>> + * Key used to store the hostaddress of the localhost
>> + */
>> + public static final String HOSTADDRESS = "127.0.0.1";
>> + + /**
>> + * Key used to store the hostname of localhost
>> + */
>> + public static final String HOSTNAME = "localhost";
>
>
> The key you used are misleading, I would change it to:
>
> public static final String HOSTADDRESS =
> "org.apache.james.localhost_address";
> public static final String HOSTNAME = "org.apache.james.localhost_name";
>
> Otherwise people could think we hardcoded the hostname "localhost" and
> the hostaddress "127.0.0.1" in the Constants, that is not the case:
> they only are strings to be used as map keys.
>
> Stefano
>
>
You are absolutly right..
I now changed it to:
public static final String HOSTADDRESS = "LOCAL_HOSTADDRESS";
public static final String HOSTNAME = "LOCAL_HOSTNAME";
bye
Norman
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org