Create WAP Push SMS Messages (from C# to JAVA)
猪年无聊,改了一个代码,有点D版那个意思,把WAP PUSH的C#代码改到了JAVA
原来出处:
http://www.codeproject.com/cs/internet/wappush.asp
改过后的代码在下面,程序好像可以输出了WAPPUSH的结构化的东西,但是,没有在CMPP协议上测试通过。
共7个文件:
package com.wap.wbxml;
public class Runner {
/**
* @param args
*/
public static void main(String[] args) {
try
{
String recipient = ""; // mobile number to send the message to
String href = "http://wap.monternet.com"; // url of the content to be pushed
String text = "A WAP Push to 梦网 site"; // description of the content displayed to the user
PushMessage message = new PushMessage(href, text);
HexDecoder decoder = new HexDecoder();
// Console.WriteLine("SMS body");
System.out.println("SMS body");
// Console.WriteLine(body);
String body = new String(decoder.GetChars(message.GetSMSBytes()));
System.out.println(body);
body =byteToHexStr(message.GetSMSBytes());
System.out.println(body);
// this body is now ready to be sent, either via
// an SMS Web Service as shown below or
// via a mobile phone on a serial port.
// Making sure the message is flagged as containing
// a User Data Header
// A free evaluation account for this service can
// be set up at https://www.esendex.com/secure/registration/evaluation.aspx
// messenger.MessengerHeader header = new messenger.MessengerHeader();
// header.Username = ""; // username for the SMS account
// header.Password = ""; // password for the SMS account
// header.Account = ""; // account reference
//
// messenger.SendService service = new messenger.SendService();
// service.Messeng
相关文档:
第一种DES加密算法
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
/**
*
* 使用DES加密与解密,可对byte[],String类型进行加密与解密 密文可使用 ......
枚举类型是JDK5.0的新特征。Sun引进了一个全新的关键字enum来定义一个枚举类。下面就是一个典型枚举类型的定义:
Java代码
public enum Color{
RED,BLUE,BLACK,YELLOW,GREEN
}
public enum Color{
RED,BLUE,BLACK,YELLOW,GREEN
}
显 ......
比如applet文件是AppletTest.class
1)
在AppletTest.java的代码中
使用默认包,即不用package语句
在html页中的代码是
<applet code="AppletTest.class" width="400" height="300">
</applet>
AppletTest.class文件和html页放在一个文件夹中
2)
在AppletTest.java的代码中
package xx.yy;
在html页 ......
Java中的事务处理
一般情况下,J2EE应用服务器支持JDBC事务、JTA(Java Transaction API)事务、容器管理事务。一般情况下,最好不要在程序中同时使用上述三种事务类型,比如在JTA事务中嵌套JDBC事务。第二方面,事务要在尽可能短的时间内完成,不要在不同方法中实现事务的使用。下面我们列举两种事务处理方式。
......
为什么会有Java,为什么会有.NET
有人说,Java是为了跨Windows和UNIX而产生的。是这样吗?
Sun有自己的操作系统solaris,并且打的是高端市场,而Java发展早期阶段,Windows还主
要定位在中小型企业,并没有打算与Sun一争高端客户。
而且Sun的用户大部分都是大型企业级,而Windows定位在家庭消费用户, ......