<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    2005年8月18日

    前提:需要有javamail的類文件包,JAF(javabean activation framework)。

    需要的類:
     1 Properties
      javamail需要properties來創(chuàng)建一個session對象。它將尋找字符串"mail.smtp.host"。屬性值就是發(fā)送郵件的主機(jī),如:
      Properties props = new Properties();
      props.put("mail.smtp.host","smtp.sohu.com");

    2 Session
    這個Session類代表javamail中的一個郵件session,每一個基于javamail的應(yīng)用程序至少要有一個session,但是可以有多個session,session對象需要知道用來處理郵件的smtp郵件服務(wù)器。例如:
          Session sendMailSession;
          sendMailSession = Session.getInstance(props, null);

    3 Transport
    javamail 用兩個類來實(shí)現(xiàn)兩個功能:Transport  和 Store。transport用來發(fā)信,store用來收信。
    用javamail的session的getTransport()方法來初始化Transport 。傳過去的字符串申明了對象所要用的協(xié)議。如smtp,如:
        Transport  transport ;
        transprot = sendMessageSession.getTransport("smtp");
    javamail并不是支持每一個協(xié)議。目前支持imap  smtp   pop3

    4 Message
    Message 對象存儲我們實(shí)際發(fā)送的電子郵件信息。Message對象被作為一個MimeMessage對象來創(chuàng)建并且需要知道應(yīng)當(dāng)選擇哪一個JavaMail Session
        Message newMessage = new MimeMessage(sendMailSession);


    創(chuàng)建并發(fā)送Message對象

    message.setFrom(new InternetAddress(request.getParameter("from")));
    message.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("to")));
    message.setSubject(request.getParameter("subject"));
    message.setSentDate(new Date());
    message.setText(request.getParameter("text"));

    transport.send(message);
     
    posted @ 2005-08-20 15:01 kingtiger2003 閱讀(209) | 評論 (0)編輯 收藏
     
    prefer-web-inf-classes Element
      The weblogic.xml Web application deployment descriptor contains a prefer-web-inf-classes element(a sub element of container-descriptor element ).By default this element is set to false,Setting this element to true subverts the classloader delegation model so that class definitions from the web application are loaded in preference to class definitions in high-leavel classloader.This allows web application to use its own version of a third-party class,which might also be part of weblogic server.
      When using this feature.you must be careful not to mix instances created from the web application's class definition with issuances created from the server application's class definition If such instance is mixed , a ClassCastException results.
      Changing classes in running program
      Weblogic Server allows you to deploy newer versions of application modules such as EJB modules while server is running.this process is known as hot-deploy or hot-redeploy and is closely related to classloading.
      java classloader do not have a standard mechanism to undeploy or unload a set of class ,nor can they load new version of classes .In order to make updates to classes in a running virtual machine.the classloader that loaded the changed classes  must be replaced with a new classloader.When a classloader is replaced ,all classes that were loaded from that classloader (or any classloaders  that are offspring of that classloader) must be reloaded.Any instance of these classes must be re-instantiated.
      In weblogic Server ,each application has a hierarchy of classloaders that are offspring of the system classloader.These hierarchies allows applications or parts of applications to be individually reloaded   without affecting the rest of the system.

    Weblogic Server application classloader overview
    Application Classloading
      Weblogic Server application classloading is centered on the concept of an application.An application is normally packaged in an Enterprise Archive file containing application classes .Everything within an EAR file is considered part of the same application.The following may be part of an EAR or can be loaded as standalone applications.
     1 EJB jar files
     2 WAR files
     3 A resource adapter RAR files
    If you deploy an EJB and a web applciation seperately ,they are considered two applications.If they are deployed together within an EAR file.they are on one application.You deploy modules together in an EAR file for them to be considered part of the same application.
    Every application receives its own classloader hierarchy; the parent of this hierarchy is system classpath classloader ,this isolates applications so that application A can not see the clasloaders or classes of application B, In classloader hierarchy,no sibling or friend concepts exist.
    Application Classloader Hierarchy
      Weblogic Server automatically creates a hierarchy of classloaders when an application is deployed.The root classloader in this hierarchy loads any EJB jar files in the application.A child classloader is created for each Web application war file.
    Because it is common for web application to call  EJBs,the weblogic server application classloader architecture allows jsp files and servlets to see the EJB interfaces in their parent classloader .This architecture   also allows web applications to be redeployed without redeploying the EJB tier .In practice it is common to change jsp files than to change the EJB tier.
      If your application includes servlets and jsp files that use EJBs
      1.Package the servlets and jsp files in a war file
      2.Package the Enterprise javaBeans in an EJB jar file
      3.Package the war and jar files in an Ear file
      4.Deploy the EAR file
    Although you could deploy war file and jar file seperately.deploying them together in an ear file produces a classloader arrangement that allows the servlets and jsps to find EJB classes,If you deploy tha war and jar seperately ,Weblogic Server creates sibling classloaders for them This means that you might include the EJB home and remote interfaces in the war file.and weblogic server must use the RMI stub and skeleton classes for EJB calls.just as it does when EJB clients and implementation classes in different JVMs.
    Note: The web application classloader contains all classes for the web application except for the jsp class.The jsp class obtains its own classloader which is a child of the web application classloader this allows jsp to be individully reloaded.

    Custom Module Classloader Hierarchies
    You can create custom classloader hierarchy for an application allowing for better control over class visibility and reloadability ,you achieve this by defining a classloader-structure element in the weblogic-application.xml deployment descriptor files.

    posted @ 2005-08-18 15:36 kingtiger2003 閱讀(182) | 評論 (0)編輯 收藏
     
    主站蜘蛛池模板: 国产成人无码区免费内射一片色欲 | 国产精品无码免费播放| 歪歪漫画在线观看官网免费阅读| 在线观看亚洲免费视频| 亚洲中文久久精品无码ww16| 亚洲最大中文字幕| 日本中文字幕免费看| 久久久久高潮毛片免费全部播放| 日本免费一区二区三区最新| 中文字幕亚洲码在线| 久久成人免费播放网站| 四虎亚洲国产成人久久精品| 亚洲视频一区网站| www一区二区www免费| 国产成人精品高清免费| 亚洲一级毛片免费看| 曰批全过程免费视频在线观看无码| 亚洲一区爱区精品无码| 亚洲AV无码成人精品区日韩 | 久久久青草青青国产亚洲免观| 亚洲最大的成人网| 免费国产黄网站在线观看视频| 久久久久无码专区亚洲av| 中国一级全黄的免费观看| www.91亚洲| 精品亚洲永久免费精品 | 亚洲视频免费在线看| 国产成人亚洲综合色影视| 免费人成视频在线播放| 亚洲伊人色欲综合网| 久9这里精品免费视频| 亚洲日韩精品一区二区三区| 精品熟女少妇a∨免费久久| 亚洲精品无码人妻无码| 男女免费观看在线爽爽爽视频| 亚洲视频中文字幕| 大地资源网高清在线观看免费| 亚洲人成伊人成综合网久久| 日本最新免费网站| 亚洲男人天堂影院| 在线看片韩国免费人成视频|