[b]1. SMTP[/b]
JavaMail has no stmp server self.
1) embedded SMTP server:
It might have the spammer reject issue. like 550 5.7.1
usually it should have the public IP and dns, so that Gmail or other big Mail server can trust this embedded smtp server.
good article:
[url]http://www.oracle.com/technetwork/java/faq-135477.html#smtpauth[/url]
[url]http://www.coderanch.com/t/434948/open-source/Aspirin-Cannot-Send-Mails[/url]
[url]http://www.coderanch.com/t/435963/java/java/Help-Asprin-set-up-local[/url]
[url]http://www.chilkatsoft.com/faq/smtp550.html[/url]
[url]http://www.eudora.com/techsupport/kb/1593hq.html[/url]
Relay - 中继
Spammer - 垃圾邮件发送者
2) log4j also supports email appender as log destination
but currently it doesn't support SSL email server like gmail.
Have to write GmailAppender by self to extend SMTP Appender
3) Asprin as an embedded SMTP server is not stable enough when sending to multipe recipients. Prove again that multipe threads coding is headache.
[b]2. Jar file[/b]
- remeber to keep two spaces as splitor for each jar file name.
- can define main class and classpath in manifest.txt
used by Jar command. like:
Jar cvfm myJar.jar Manifest.txt .
good article:
[url]http://forums.sun.com/thread.jspa?threadID=364938[/url]
[url]http://hi.baidu.com/hdwt/blog/item/5f99b8c60bd1831c9d163dd9.html[/url]
[url]http://nssaiqq.blogbus.com/logs/32078188.html[/url]
[url]http://download.oracle.com/javase/tutorial/deployment/jar/appman.html[/url]
[b]3. Java Generic[/b]
Generic Type cannot be initilized like new() or classforName()
solution: use reflection.
article: [url]http://www.iteye.com/topic/113447[/url]
My first Generic code.
//ServiceFactory.java
import java.util.EnumMap;
enum ServiceType {
UserService,
LoginService
};
public class ServiceFactory {
private static EnumMap
servicePool = new EnumMap(ServiceType.class);
public static T getService(Class asyncService, Class service, ServiceType key) {
@SuppressWarnings("unchecked")
T aService = (T) servicePool.get(key);
if (aService == null) {
aService = GWT.create(service);
servicePool.put(key, aService);
}
return aService;
}
public static void main(String args[]) {
ILoginServiceAsync service = ServiceFactory.getService(
ILoginServiceAsync.class, ILoginService.class, ServiceType.LoginService);
}
}
However, this class can only run under Hosted Mode, not runtime mode. because GWT.create() can only work with liberal class - the argument cannot be a var. Terrible!
article: [url]http://code.google.com/p/google-web-toolkit/issues/detail?id=1045[/url]
But GWT.create() still can dynamically load class in client side. The com.google.core.ext.Generator plays the important part.
GWT Dynamic loading using GWT.create() with String literals instead of Class literals
[url]http://stackoverflow.com/questions/451658/gwt-dynamic-loading-using-gwt-create-with-string-literals-instead-of-class-lite[/url]
A Simple GWT Generator Example
[url]http://francisshanahan.com/index.php/2010/a-simple-gwt-generator-example/[/url]
[b]4. GWT limit[/b]
Gwt doesn't support reflection, serialization, multiple threads, classloading, Util.RegExp etc.
why? because they will be compile to Javascript. JavaScript doesn't support them. that's all.
good articles about reflection in GWT:
[url]http://chenjumin.iteye.com/blog/723991[/url]
[url]http://wenku.baidu.com/view/abbab84e852458fb770b566b.html[/url]
Solution: GWT ENT
[url]http://code.google.com/p/gwt-ent/[/url]