SMTP/Jar/Java Generic/GWT

[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<ServiceType, Object>

servicePool = new EnumMap<ServiceType, Object>(ServiceType.class);

public static <T> T getService(Class<T> 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]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值