web
来源:互联网 发布:单机版考试软件 编辑:程序博客网 时间:2024/05/29 17:05
- import gov.hn12396.appintegration.mule.util.EncoderUtil;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.net.HttpURLConnection;
- import java.net.URL;
- import java.util.Calendar;
- /**
- * 模拟浏览器通过发送http请求,调用应用集成平台的mail协议,发送电子邮件
- * @author liuxp
- *
- */
- public class MailTestClient {
- /**
- * 保存应用集成平台暴露给其他应用程序调用的地址
- */
- // private static String Mail_URI = "http://localhost:8082/email/?";
- private static String Mail_URI = "http://10.2.11.40:8082/email/?";
- /**
- * 读取http请求的信息
- * @throws IOException
- */
- public static void readHttpFromMail() throws IOException {
- StringBuffer bufUrl = new StringBuffer(Mail_URI);
- bufUrl.append("email=328172228@qq.com&cc=liuxp@surekam.com&subject=dd&text=998打算发放");
- URL url = new URL(bufUrl.toString()); // 设置请求的链接
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- // System.out.println(conn.getResponseCode()); // 查看响应状态码
- // System.out.println(conn.getHeaderField("Content-Length")); // 响应文本内容的长度
- // System.out.println(conn.getContentEncoding()); // 响应文本内容的编码
- InputStream in = conn.getInputStream(); // 获取一个和服务器返回的内容相关联的流
- try {
- int len = 0;
- byte[] buffer = new byte[1024];
- while ((len = in.read(buffer)) > 0) {
- System.out.println(new String(buffer, 0, len)); // 输出到控制台
- }
- } finally {
- if (in != null)
- try {
- in.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public static void main(String[] args) throws IOException {
- readHttpFromMail();
- // sendHttpToJDBC();StringToEmailMessage
- }
- }
0 0
- web
- web
- web
- web
- web
- web
- web
- web
- WEB
- web
- web
- WEB
- web
- web
- Web
- web
- web
- web
- Windows 消息 机制
- 在 Eclipse 里使用 Java 6 注解处理器
- 游戏开发入门
- vtk读取obj文件和贴图
- NYOJ833 取石子(七)
- web
- s3c2410上搭建QT/Embedded4.8.5开发环境(三)--安装intel-x86嵌入式平台(基于qvfb)的qt库qt-everywhere-opensource-src-4.8.5
- 程序缘 Flex AIR之旅--第六章 编写用户登录界面
- git push 失败与解决方法汇总
- JAVA(四) ——购买商品简单程序【略详细】
- [hdu 2019] 数列有序
- Java线程(七):阻塞队列BlockingQueue
- 浮世情人劫
- hdu1251 字典树