rss在web开发过程中的全方位应用

      http://www.qqvan.com/item/ri6

 

      简介:这是rss在web开发过程中的全方位应用。的详细页面,介绍了和java,.net,rss,csdn,sun,entry,有关的知识,加入收藏请按键盘ctrl+D,谢谢大家的观看!要查看更多有关信息,请点击此处

 在web当中应用,要有以下两个开发包,

  jdom.jar:jdom开源项目中(http://www.jdom.org/)

  rome.jar : rome开源项目中(http://wiki.java.net/bin/view/javawsxml/rome)

  关于rss在javaweb中的应用,分为两个步骤实施:

  1.生成rss格式的xml文件:

  

      public class feedwriter {

和 "rss在web开发过程中的全方位应用。" 有关的java编程小帖士:

strong>Locale.equals

比较当前Locale对象和作为参数传入的Locale对象。

语法

public boolean equals ( Object obj );

参数

obj

与当前Locale对象相比较的对象。

返回值

如果两个Locale对象合理地相等(logically equivalent),则返回true,否则返回false。

说明

用这个方法比较当前Locale对象和作为参数传入的Locale对象。如果两个Locale对象描述的是同一个场所,则返回true。

  private static final string date_format = "yyyy-mm-dd";

 

  public static void main(string[] args) {

  boolean ok = false;

  if (args.length==2) {

  try {

  string feedtype = args[0];

  string filename = args[1];

  dateformat dateparser = new simpledateformat(date_format);

  syndfeed feed = new syndfeedimpl(); //feed流

  feed.setfeedtype(feedtype); //设置rss版本

  feed.settitle("sample feed (created with rome)"); //< title>设置标题

  feed.setlink(http://www.csdn.net); //< link>

  feed.setdescription("this feed has been created using rome (java syndication utilities");

  list entries = new arraylist();

  syndentry entry;

  syndcontent description;

  entry = new syndentryimpl(); //子节点

  entry.settitle("rome v1.0");

  entry.setlink(http://www.csdn.net);

  entry.setpublisheddate(dateparser.parse("2004-06-08"));

  description = new syndcontentimpl();

  description.settype("text/plain");

  description.setvalue("initial release of rome");

  entry.setdescription(description);

  entries.add(entry);

  entry = new syndentryimpl();

  entry.settitle("rome v2.0");

  entry.setlink(http://ww.csdn.net);

  entry.setpublisheddate(dateparser.parse("2004-06-16"));

  description = new syndcontentimpl(); //描述

  description.settype("text/xml");

  description.setvalue("bug fixes, < xml>xml< /xml> minor api changes and some new features");

  entry.setdescription(description);

  entries.add(entry);

  entry = new syndentryimpl();

  entry.settitle("rome v3.0");

  entry.setlink("http://www.csdn.net");

  entry.setpublisheddate(dateparser.parse("2004-07-27"));

  description = new syndcontentimpl();

  description.settype("text/html");

  description.setvalue("< p>more bug fixes, mor api changes, some new features and some unit testing< /p>"+

  "< p>for details check the < a href=\"http://www.csdn.net\">changes log< /a>< /p>");

  entry.setdescription(description);

  entries.add(entry);

  feed.setentries(entries); //设置子节点

  writer writer = new filewriter(filename);

  syndfeedoutput output = new syndfeedoutput();

  output.output(feed,writer); //写到文件中去

  writer.close();

  system.out.println("the feed has been written to the file ["+filename+"]");

  ok = true;

  }

  catch (exception ex) {

  ex.printstacktrace();

  system.out.println("error: "+ex.getmessage());

  }

  }

  if (!ok) {

  system.out.println();

  system.out.println("feedwriter creates a rss/atom feed and writes it to a file.");

  system.out.println("the first parameter must be the syndication format for the feed");

  system.out.println(" (rss_0.90, rss_0.91, rss_0.92, rss_0.93, rss_0.94, rss_1.0 rss_2.0 or atom_0.3)");

  system.out.println("the second parameter must be the file name for the feed");

  system.out.println();

  }

  }

  }

 2.对此xml文件的读取:

  

      < %@page contenttype="text/html"%>

  < %@page pageencoding="utf-8"%>

  < html>

  < head>

  < meta http-equiv="content-type" content="text/html; charset=utf-8">

  < title>sina news< /title>

  < /head>

  < body>

  < %

  java.util.properties systemsettings = system.getproperties();

  systemsettings.put("http.proxyhost", "mywebcache.com");

  systemsettings.put("http.proxyport", "8080");

  system.setproperties(systemsettings);

  string urlstr = "http://rss.sina.com.cn/news/marquee/ddt.xml";

  java.net.urlconnection feedurl = new java.net.url(urlstr).openconnection();

  feedurl.setrequestproperty("user-agent", "mozilla/4.0 (compatible; msie 5.0; windows nt; digext)");

  com.sun.syndication.io.syndfeedinput input = new com.sun.syndication.io.syndfeedinput();

  com.sun.syndication.feed.synd.syndfeed feed = input.build(new com.sun.syndication.io.xmlreader(feedurl));

  %>

  < div align="center">

  < h1>< %=feed.gettitle()%>< /h1>

  < table border=1 cellpadding=3 width="700">

  < tr>

  < th>number< /th>

  < th>title< /th>

  < th>time< /th>

  < /tr>

  < %

  java.util.list list = feed.getentries();

  for (int i=0; i< list.size(); i++) {

  com.sun.syndication.feed.synd.syndentry entry = (com.sun.syndication.feed.synd.syndentry)list.get(i);

  %>

  < tr>

  < td>< %=i+1%>< /td>

  < td>< a href="< %=entry.getlink()%>">< %=entry.gettitle()%>< /a>< /td>

  < td>< %=entry.getpublisheddate()%>< /td>

  < /tr>

  < %}%>

  < /table>

  < /div>

  < br>

  < /body>

  < /html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
蛋白质是生物体普遍存在的一类重要生物大分子,由天然氨基酸通过肽键连接而成。它具有复杂的分子结构和特定的生物功能,是表达生物遗传性状的一类主要物质。 蛋白质的结构可分为四级:一级结构是组成蛋白质多肽链的线性氨基酸序列;二级结构是依靠不同氨基酸之间的C=O和N-H基团间的氢键形成的稳定结构,主要为α螺旋和β折叠;三级结构是通过多个二级结构元素在三维空间的排列所形成的一个蛋白质分子的三维结构;四级结构用于描述由不同多肽链(亚基)间相互作用形成具有功能的蛋白质复合物分子。 蛋白质在生物体内具有多种功能,包括提供能量、维持电解质平衡、信息交流、构成人的身体以及免疫等。例如,蛋白质分解可以为人体提供能量,每克蛋白质能产生4千卡的热能;血液里的蛋白质能帮助维持体内的酸碱平衡和血液的渗透压;蛋白质是组成人体器官组织的重要物质,可以修复受损的器官功能,以及维持细胞的生长和更新;蛋白质也是构成多种生理活性的物质,如免疫球蛋白,具有维持机体正常免疫功能的作用。 蛋白质的合成是指生物按照从脱氧核糖核酸(DNA)转录得到的信使核糖核酸(mRNA)上的遗传信息合成蛋白质的过程。这个过程包括氨基酸的活化、多肽链合成的起始、肽链的延长、肽链的终止和释放以及蛋白质合成后的加工修饰等步骤。 蛋白质降解是指食物的蛋白质经过蛋白质降解酶的作用降解为多肽和氨基酸然后被人体吸收的过程。这个过程在细胞的生理活动发挥着极其重要的作用,例如将蛋白质降解后成为小分子的氨基酸,并被循环利用;处理错误折叠的蛋白质以及多余组分,使之降解,以防机体产生错误应答。 总的来说,蛋白质是生物体内不可或缺的一类重要物质,对于维持生物体的正常生理功能具有至关重要的作用。
RSS检查DUT发送的应用报文时,需要关注以下几个方面: 首先,需要验证报文的格式是否正确。这包括报文的头部、主体和尾部。头部应当包含必要的标识符,例如版本号、序列号和源地址等;主体应当包含实际的数据内容;尾部应当包含一些用于校验的数据,如校验和等。通过比对规范文档和实际报文,我们可以确保报文的格式正确无误。 其次,需要检查报文的语法是否正确。这包括使用正确的语言、编码方式、数据类型和数据格式等。例如,在XML格式的报文,需要正确使用标签、元素、属性和命名空间等;在JSON格式的报文,需要正确使用键值对和数组等。通过检查语法规则,可以确保报文能够被DUT正确地解析和处理。 第三,需要验证报文的语义是否正确。这包括报文所包含的数据是否符合规范和业务需求。例如,如果一个报文是用于查询学生信息的,则需要验证查询条件、返回结果和数据格式是否正确;如果一个报文是用于支付交易的,则需要验证金额、币种、交易时间和交易状态等是否符合预期。通过检查语义规则,可以确保报文能够达到预期的效果。 最后,需要检查报文的安全性和稳定性。这包括报文的加密和解密、防御攻击和保证性能等。例如,在HTTPS或SSL/TLS协议下发送的报文需要确保加密和解密的安全性;在遇到恶意攻击或流量过载时,需要保证DUT的鲁棒性和稳定性。通过检查安全和稳定性,可以确保报文在传输过程能够保持机密性、完整性和可用性。 综上所述,在RSS检查DUT发送的应用报文需要关注格式、语法、语义和安全性等方面。同时需要结合实际业务需要和规范要求,制定相应的测试用例和结果验证方法。只有通过严格的测试和验证,才能确保DUT在实际使用能够正常工作,提高产品质量和用户满意度。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值