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

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

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

    fun

     

    2009年5月7日

    大規(guī)模網(wǎng)站架構(gòu)ppt

    為公司講解的一個(gè)PPT,相關(guān)內(nèi)容如下:

     

     http://www.bt285.cn BT下載 有300W部BT種子.
    http://www.5a520.cn 小說520網(wǎng) 有300W部小說

    CAP原則
    BASE策略
    異步(MessageQueue)
    數(shù)據(jù)庫
       數(shù)據(jù)的水平切分及垂直切分
        數(shù)據(jù)庫讀寫分離
        避免分布式事務(wù)
        反范式的數(shù)據(jù)庫設(shè)計(jì)
    負(fù)載均衡
        DNS負(fù)載均衡
        反向代理負(fù)載均衡
         LVS
    緩存
        數(shù)據(jù)庫緩存
         服務(wù)器緩存/頁面緩存/數(shù)據(jù)緩存/靜態(tài)化
        反向代理緩存

    HA
    Session

    Share Nothing Architecture架構(gòu)
    瀏覽器優(yōu)化
        瀏覽器緩存/CDN/小圖片合并
    分布式文件系統(tǒng)(MogileFS)

    下載地址為:http://www.bt285.cn/soft/res.ppt

     

    posted @ 2009-11-06 19:44 fun 閱讀(2554) | 評(píng)論 (3)編輯 收藏

    Tomcat配置成https方式訪問(用單向認(rèn)證)

    在命令提示符窗口,進(jìn)入Tomcat目錄,執(zhí)行以下命令:
    keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600
    通過以上步驟生成server.keystore證書文件、

    將servlet.xml一下的的注釋打開(最好拷貝此段)
    <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->  
    <Connector protocol="org.apache.coyote.http11.Http11Protocol"    
                         port="8443" maxHttpHeaderSize="8192"  
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  
               enableLookups="false" disableUploadTimeout="true"  
               acceptCount="100" scheme="https" secure="true"  
               clientAuth="false" sslProtocol="TLS"                   
               keystoreFile="server.keystore"    
               keystorePass="changeit"/> 
    到這一步訪問https;//ip:8443/item

    一般Tomcat默認(rèn)的SSL端口號(hào)是8443,但是對(duì)于SSL標(biāo)準(zhǔn)端口號(hào)是443,這樣在訪問網(wǎng)頁的時(shí)候,直接使用https而不需要輸入端口號(hào)就可以訪問,如http://www.bt285.cn
    想要修改端口號(hào),需要修改Tomcat的server.xml文件:
    1.non-SSL HTTP/1.1 Connector定義的地方,一般如下:
         <Connector port="80" maxHttpHeaderSize="8192"
                    maxThreads="500" minSpareThreads="25" maxSpareThreads="75"
                    enableLookups="false" redirectPort="443" acceptCount="100"
                    connectionTimeout="20000" disableUploadTimeout="true" />
    將其中的redirectPort端口號(hào)改為:443
    2.SSL HTTP/1.1 Connector定義的地方,修改端口號(hào)為:443,如下:
    <Connector    
       port="443" maxHttpHeaderSize="8192"
       maxThreads="150" minSpareThreads="25"
       maxSpareThreads="75"
       enableLookups="false"
       disableUploadTimeout="true"
       acceptCount="100" scheme="https"
       secure="true"
       clientAuth="false" sslProtocol="TLS"
       keystoreFile="conf/tomcat.keystore"
       keystorePass="123456" />
    3.AJP 1.3 Connector定義的地方,修改redirectPort為443,如下:
         <Connector port="8009"
                    enableLookups="false" redirectPort="443" protocol="AJP/1.3" />

    重新啟動(dòng)Tomcat就可以了。到這一步可以形成訪問方式 http://www.5a520.cn /item

    到tomcat下面的webapps下面的ROOT下面的index.jsp文件的內(nèi)容
    <?xml version="1.0" encoding="ISO-8859-1"?>
      <%response.sendRedirect("/item");%>

    修改web.xml文件的內(nèi)容
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">

      <display-name>Welcome to Tomcat</display-name>
      <description> 
         http://www.feng123.com 蜂蜜交易網(wǎng)
      </description>

      <welcome-file-list>
       <welcome-file>/index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    刪除lib目錄下的lib文件
    重啟Tomcat服務(wù)器,在這一步可以直接通過https:ip來訪問項(xiàng)目

    posted @ 2009-05-12 11:35 fun| 編輯 收藏

    10分鐘學(xué)懂Struts 2.0 攔截器

    Struts 2.0攔截器

    簡(jiǎn)介

     

    Struts 2.0 中的攔截器,要實(shí)現(xiàn)com.opensymphony.xwork2.interceptor.Interceptor接口,在struts.xml中配置。可以用攔截器來完成調(diào)用Action業(yè)務(wù)邏輯之前的預(yù)處理或是之后的善后處理。還可以通過配置多個(gè)攔截器來滿足action需求。

     

    Interceptor stack是由多個(gè)攔截器組成的攔截器組,在攔截器組中可以對(duì)每一個(gè)攔截器映射。所有進(jìn)行配置攔截器時(shí),不必對(duì)每一個(gè)攔截器進(jìn)行配置,而只需對(duì)interceptor stack進(jìn)行配置即可。在struts 2中默認(rèn)配置了一個(gè)全局interceptor stack,包括Exception InterceptorValidation Interceptor等。

     

    實(shí)例

     

    在這個(gè)實(shí)例當(dāng)中,我將配置一個(gè)時(shí)間攔截器,用來統(tǒng)計(jì)每個(gè)action的請(qǐng)求時(shí)間。

    package interceptor;      
         
    import com.opensymphony.xwork2.ActionInvocation;      
    import com.opensymphony.xwork2.interceptor.Interceptor;      
    /**
    *author by 
    http://www.bt285.cn http://www.5a520.cn
    */
         
    public class ActionTimer implements Interceptor{      
        
    public String intercept(ActionInvocation next) throws Exception {      
            
    long t1 = System.currentTimeMillis();      
            String s
    = next.invoke();      
            
    long t2 = System.currentTimeMillis();      
            System.out.println(
    "Action "+next.getAction().getClass().getName()+" took "+(t2-t1)+" millisecs");      
            
    return s;      
        }
          
              
        
    public void init() {      
        }
          
        
    public void destroy() {      
        }
          
    }
      
    struts.xml
    <?xml version="1.0" encoding="UTF-8" ?>     
    <!DOCTYPE struts PUBLIC      
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"      
        "http://struts.apache.org/dtds/struts-2.0.dtd"
    >     
    <struts>     
        
    <package name="interceptor" extends="struts-default">     
            
    <interceptors>     
                
    <interceptor name="actiontimer"     
                    class
    ="interceptor.ActionTimer" />     
         
                
    <interceptor-stack name="demostack">     
                    
    <interceptor-ref name="defaultStack" />     
                    
    <interceptor-ref name="actiontimer" />     
                
    </interceptor-stack>     
            
    </interceptors>     
            
    <default-interceptor-ref name="demostack" />     
            
    <action name="InterceptorDemo"     
                class
    ="interceptor.action.InterceptorDemo">     
                
    <result>http://www.bt285.cn /interceptor/interceptordemo.jsp</result>     
            
    </action>     
        
    </package>     
         
    </struts>   

    interceptordemo.jsp

    <html>     
    <head>     
         
    </head>     
    <body>     
    </body>     
    </html>   

     

     

    posted @ 2009-05-08 20:31 fun| 編輯 收藏

    Spring中的定時(shí)任務(wù)介紹

    下面我們來看一下Spring中提供的定時(shí)任務(wù)開發(fā):
    在Spring中開發(fā)定時(shí)任務(wù),分為3個(gè)步驟。
    1 創(chuàng)建定時(shí)任務(wù)
    2 注冊(cè)定時(shí)任務(wù)
    3 啟動(dòng)定時(shí)任務(wù)
    分別來看一下
    1 創(chuàng)建定時(shí)任務(wù):

    package org.jnotnull;
    import java.util.TimerTask;
    public class MyTesk extends TimerTask{
    ....
    public void run(){
    //添加任務(wù)
    }
    ....
    }

    2 注冊(cè)定時(shí)任務(wù),并設(shè)置參數(shù)
    我們來配置TimerConfig.xml防御WEB-INF下

    <bean id="myTesk" class="edu.cumt.jnotnull.action.TaskAction">  
            
    <property name="newsManageService">  
                
    <ref bean="newsManageService" />  
            
    </property>  
        
    </bean>  
        
    <bean id="stTask"  
            class
    ="org.springframework.scheduling.timer.ScheduledTimerTask">  
            
    <property name="delay">  
                
    <value>20000</value>  
            
    </property>  
            
    <property name="period">  
                
    <value>30000</value>  
            
    </property>  
            
    <property name="timerTask">  
                
    <ref bean="myTesk" />  
            
    </property>  
        
    </bean>  
        
    <bean id="timerFactory"  
            class
    ="org.springframework.scheduling.timer.TimerFactoryBean">  
            
    <property name="scheduledTimerTasks">  
                
    <list>  
                    
    <ref bean="stTask" />  
                
    </list>  
            
    </property>  
        
    </bean>  
    3 啟動(dòng)定時(shí)任務(wù)   
    <PRE class=xml name="code"><?xml version="1.0" encoding="UTF-8"?>  
    <web-app>  
    <context-param>  
    <param-name>contextConfigLocation</param-name>  
    <param-value>http://www.bt285.cn /WEB-INF/TimerConfig.xml</param-value>  
    </context-param>  
    <listener>  
    <listener-class>  
     org.springframework.web.context.ContextLoaderListener   
    </listener-class>  
    </listener>  
    </web-app>  
    </PRE>  
    <BR>  
    <BR>下面我們?cè)賮砜纯丛赟pring中如何使用Quartz實(shí)現(xiàn)定時(shí)功能   
    <BR>1 創(chuàng)建定時(shí)任務(wù):   
    <BR><PRE class=java name="code">package org.jnotnull;   
    import java.util.TimerTask;   
    /**
    *http://www.5a520.cn
    */
    public class MyTesk extends TimerTask{   
     
    public void excute(){   
    //添加任務(wù)   
    }   
    .   
    }   
    </PRE>  
    <BR>2 注冊(cè)定時(shí)任務(wù),并設(shè)置參數(shù)   
    <BR>我們來配置TimerConfig.xml防御WEB-INF下   
    <BR><PRE class=xml name="code"><?xml version="1.0" encoding="UTF-8">  
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"    
    "http://www.springframework.org/dtd/spring-beans.dtd">  
    <beans>  
    <bean id ="myTesk" class="org.jnotnull.MyTesk"/>  
    <bean id ="myJob"    
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">  
    <property name="targetObject">  
    <ref bean="myTask">  
    </property>  
    <propertyproperty ="targetMethod">  
    <value>execute</value>  
    </property>  
    </bean>  
    <bean id ="timeTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">  
    <property name="jobDetail">  
     <ref bean="myJob">  
    </property>  
    <property name="cronExpression">  
    <value>12,23****?</value>  
    </property>  
    </bean>  
    <bean id ="timerFactory"    
    class="org.springframework.scheduling.quartz.ScheduleFactoryBean">  
    <property name="triggers">  
    <list>  
    <refref="timeTrigger">  
    </list>  
    </property>  
    </bean>  
    </beans>  
    </PRE>  
    <BR>3 啟動(dòng)定時(shí)任務(wù)   
    <BR><PRE class=xml name="code"><?xml version="1.0" encoding="UTF-8"
    ?>  
    <web-app>  
    <context-param>  
    <param-name>contextConfigLocation</param-name>  
    <param-value> http://www.bt285.cn /WEB-INF/TimerConfig.xml</param-value>  
    </context-param>  
    <listener>  
    <listener-class>  
     org.springframework.web.context.ContextLoaderListener   
    </listener-class>  
    </listener>  
    </web-app>  
    </PRE>    

    posted @ 2009-05-07 18:59 fun| 編輯 收藏

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(11)

    隨筆檔案

    友情鏈接

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲精品国产成人片| 亚洲av手机在线观看| 九九免费久久这里有精品23| 亚洲精品在线免费观看视频| 国产精品亚洲综合专区片高清久久久 | 免费无码一区二区三区| 日韩毛片在线免费观看| 亚洲人成www在线播放| 亚洲精品美女久久久久9999| 亚洲男人的天堂www| 亚洲精品和日本精品| 日日操夜夜操免费视频| 无人在线观看完整免费版视频| 最近2019中文字幕免费直播| 国产精品99久久免费观看| a高清免费毛片久久| 午夜成人无码福利免费视频| 久久亚洲精品无码gv| 亚洲欧美日韩一区二区三区在线| 亚洲欧洲在线播放| 亚洲男人天堂2017| 亚洲成人在线电影| 久久久影院亚洲精品| 久久精品国产精品亚洲色婷婷| 中文字幕精品亚洲无线码一区| 亚洲精品一级无码鲁丝片| 亚洲av区一区二区三| 亚洲精品黄色视频在线观看免费资源| 手机看片久久国产免费| 精品久久免费视频| 在线观看国产情趣免费视频 | 亚洲精品蜜夜内射| 亚洲精品人成网线在线播放va| 亚洲av日韩av永久无码电影 | 免费A级毛片无码A| 国产免费131美女视频| 伊在人亚洲香蕉精品区麻豆| 日本中文一区二区三区亚洲| 国产成人精品日本亚洲专区| 亚洲综合无码AV一区二区| 亚洲精品狼友在线播放|