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

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

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

    皮杜妮

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      887 Posts :: 3 Stories :: 7 Comments :: 0 Trackbacks

    2016年5月4日 #

    jfinal+freemarker+jquery mobile  開發出web應用, 然后找個殼子打包成apk應用。





    http://www.cnblogs.com/gzggyy/archive/2013/05/14/3077510.html
    posted @ 2016-09-25 17:54 豬眼睛| 編輯 收藏

    可以使用AntiSamy防范XSS跨站腳本攻擊



    常用XSS方式分為以下幾種:

    1.      輸入框中直接輸入惡意腳本,如:

    ><script>alert(document.cookie)</script>

    2.      輸入框中輸入html標簽,在標簽中嵌入惡意腳本,如src,href,css style等。

    <IMG SRC="javascript:alert('XSS');">; <BODY BACKGROUND="javascript:alert('XSS')"> <STYLE>li {list-style-image:url("javascript:alert('XSS')");}</STYLE><UL><LI>XSS</br>

    3.      將惡意腳本注入在event事件中,如onClick,onBlur,onMouseOver等事件。

    <a onmouseover="alert(document.cookie)">xxslink</a>

    4.      在remote style sheet,javascript中,如

    <LINK REL="stylesheet"HREF="javascript:alert('XSS');">
    posted @ 2016-07-08 11:44 豬眼睛| 編輯 收藏

    ElasticSearch各個版本的apo
    https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.2/index.html


    posted @ 2016-05-10 15:46 豬眼睛| 編輯 收藏


    dubbo是阿里巴巴的框架,主要有4部分組成,1 服務臺提供方, 2 服務注冊方 3 服務消費分 4 監控部分

    1. 注冊方一般用zookeeper, 先下載安裝,啟動zkservece.cmd 會報錯,需要修改配置文件 zoo.cfg. 路徑中conf/下,,沒有自己加一個。
    正常啟動

    2. 編寫一個服務器端, 創建maven項目

    pom.xml文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>DubboService</groupId>
      <artifactId>DubboService</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <build/>
              <dependencies>
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>3.8.1</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                    <version>1.1.1</version>
                </dependency>
                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>dubbo</artifactId>
                    <version>2.5.3</version>
                </dependency>
                <dependency>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                    <version>3.18.1-GA</version>
                </dependency>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.15</version>
                    <exclusions>
                        <exclusion>
                            <groupId>com.sun.jdmk</groupId>
                            <artifactId>jmxtools</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>com.sun.jmx</groupId>
                            <artifactId>jmxri</artifactId>
                        </exclusion>
                        <exclusion>
                            <artifactId>jms</artifactId>
                            <groupId>javax.jms</groupId>
                        </exclusion>
                        <exclusion>
                            <artifactId>mail</artifactId>
                            <groupId>javax.mail</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                    <version>2.5.6.SEC03</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <version>1.7.6</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>1.6.1</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                    <version>3.4.5</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>com.101tec</groupId>
                    <artifactId>zkclient</artifactId>
                    <version>0.4</version>
                </dependency>
            </dependencies>
          <repositories>
            <repository>
                <id>spring-snapshots</id>
                <url>http://repo.spring.io/libs-snapshot</url>
            </repository>
        </repositories>   
        
    </project>

    config/applicationProvider.xml  配置文件,里面定義了注冊的bean, 和zookeeper的地址
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
        <dubbo:application name="hello-world" />
        <!-- 注冊地址 -->
         <dubbo:registry address="zookeeper://localhost:2181" />
         <dubbo:protocol name="dubbo" port="20880" />
            <!-- Service interface Concurrent Control -->
            <dubbo:service interface="cn.zto.service.IProcessData"    ref="demoService" executes="10" />
            <!-- designate implementation -->
            <bean id="demoService" class="cn.zto.service.impl.ProcessDataImpl" />
        </beans>
    IProcessData定義接口及實現類
    package cn.zto.service.impl;

    import cn.zto.service.IProcessData;
    public class ProcessDataImpl implements IProcessData {
    public String hello(String name) {
        System.out.println(name);
        return "hello : " + name;
    }}

    package cn.zto.service;

    public interface IProcessData {
        public String hello(String name);
    }
    啟動服務
    package cn.zto.app;

    import org.springframework.context.support.ClassPathXmlApplicationContext;
    public class Main {
    public static void main(String[] args) throws Exception {
         ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext(    new String[] {
    "config/applicationProvider.xml"
    });
    context.start();
    System.out.println("按任意鍵退出");
    System.in.read();
    }}
    運行起來。如下
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    按任意鍵退出



    下面再建一個client程序
    pom.xml
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>DubboClient</groupId>
      <artifactId>DubboClient</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <build/>
     
              <dependencies>
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>3.8.1</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                    <version>1.1.1</version>
                </dependency>
                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>dubbo</artifactId>
                    <version>2.5.3</version>
                </dependency>
                <dependency>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                    <version>3.18.1-GA</version>
                </dependency>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.15</version>
                    <exclusions>
                        <exclusion>
                            <groupId>com.sun.jdmk</groupId>
                            <artifactId>jmxtools</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>com.sun.jmx</groupId>
                            <artifactId>jmxri</artifactId>
                        </exclusion>
                        <exclusion>
                            <artifactId>jms</artifactId>
                            <groupId>javax.jms</groupId>
                        </exclusion>
                        <exclusion>
                            <artifactId>mail</artifactId>
                            <groupId>javax.mail</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                    <version>2.5.6.SEC03</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <version>1.7.6</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>1.6.1</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                    <version>3.4.5</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>com.101tec</groupId>
                    <artifactId>zkclient</artifactId>
                    <version>0.4</version>
                </dependency>
            </dependencies>
     
     
          <repositories>
            <repository>
                <id>spring-snapshots</id>
                <url>http://repo.spring.io/libs-snapshot</url>
            </repository>
        </repositories>   
        
    </project>


    注冊的接口類,和要服務器端的包路徑一致

    package cn.zto.service;

    public interface IProcessData {
        public String hello(String name);
    }

    客戶端的配置文件,接口定義及zookeeper的地址
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
        <dubbo:application name="consumer-of-helloworld-app" />
        <!-- 注冊地址 -->
         <dubbo:registry address="zookeeper://localhost:2181"/>
         <dubbo:consumer timeout="5000" />
         <dubbo:reference id="demoService" interface="cn.zto.service.IProcessData"/>
    </beans>

    客戶端啟動
    package cn.zto.consumer;
    import org.springframework.context.support.ClassPathXmlApplicationContext;

    import cn.zto.service.IProcessData;

    public class ConsumerThd{
        
        
        
    public void sayHello(){
    ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext(    
    new String[] {"config/applicationProvider.xml"});
    context.start();
    IProcessData demoService=(IProcessData) context.getBean("demoService");
    System.out.println(demoService.hello("world"));
    }


    public static void main(String args[]){
        new ConsumerThd().sayHello();
    }



    }


    運行結果如下

    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    hello : world


    這樣就基本實現了dubbo的框架,很簡單吧




    posted @ 2016-05-04 17:03 豬眼睛| 編輯 收藏

    spring boot 是spring 4.0提供的微框架,支持 jdk 1.8, maven 3以上,  否則會報一些錯誤。

    1. pom 文件, 主要寫依賴關系,
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.example</groupId>
        <artifactId>spring-boot</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>spring-boot-example</name>
        
        <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>1.3.3.RELEASE</version>
        </parent>
        
        <!-- Add typical dependencies for a web application -->
        
        <dependencies>
            <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            
            
            
        </dependencies>

        <repositories>
            <repository>
                <id>spring-snapshots</id>
                <url>http://repo.spring.io/libs-snapshot</url>
            </repository>
        </repositories>

        <pluginRepositories>
            <pluginRepository>
                <id>spring-snapshots</id>
                <url>http://repo.spring.io/libs-snapshot</url>
            </pluginRepository>
        </pluginRepositories>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>

    2. 然后就是提供的接口類UserController, 實體類User, 主要是幾個注解
    @RestController   l類同spring mvc 的@Controller
    @RequestMapping   類同spring mvc

    package two;

    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;

    @RestController
    @RequestMapping("/user")

    public class UserController {

        @RequestMapping("/hello")
        public User view(){
            
            User user=new User();
            user.setId((long)100);
            user.setName("fanjs");
            return user;
            
            
        }

    package two;

    public class User {
    private Long id;
    private String name;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }


    3.  然后就是程序啟動,這里不需要spring xml文件,完全依賴注解。
    @EnableAutoConfiguration
    @Configuration
    @ComponentScan

    package two;

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;

    @Configuration
    @ComponentScan
    @EnableAutoConfiguration


    public class RunMain {

        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub

            SpringApplication.run(RunMain.class, args);
        }

    }

    4.  測試路徑

    http://localhost:8080/user/hello

    {"id":100,"name":"fanjs"}






    posted @ 2016-05-04 15:39 豬眼睛| 編輯 收藏

    1、maven包查詢:

       http://mvnrepository.com/
    2、maven公共倉庫

       http://mirrors.ibiblio.org/pub/mirrors/maven2/
       http://gradle.artifactoryonline.com/gradle/libs

       http://gradle.artifactoryonline.com/gradle/plugins
       http://google-maven-repository.googlecode.com/svn/repository
       http://maven.springframework.org/release
       http://maven.springframework.org/milestone
       http://repository.codehaus.org
       http://repository.jboss.org/nexus/content/groups/public-jboss
       http://repo.jfrog.org/artifactory/plugins-releases-local
       http://repo.jfrog.org/artifactory/libs-releases-local
       http://download.java.net/maven/1
       http://download.java.net/maven/2
       http://repo1.maven.org/maven2
       http://www.intalio.org/public/maven2/

       http://www.jarvana.com/jarvana/browse/

       http://maven.alfresco.com/nexus/content/groups/public

    posted @ 2016-05-04 10:22 豬眼睛| 編輯 收藏

    主站蜘蛛池模板: 色影音免费色资源| 中国毛片免费观看| 亚洲喷奶水中文字幕电影| 久久丫精品国产亚洲av不卡| 内射少妇36P亚洲区| 182tv免费视频在线观看| 日韩一区二区a片免费观看| 一本久久综合亚洲鲁鲁五月天| 亚洲啪啪AV无码片| 亚洲av无码电影网| 三级毛片在线免费观看| 亚洲最大激情中文字幕| 国产亚洲欧美日韩亚洲中文色| 中文字幕一区二区免费| 国产成人免费ā片在线观看| 亚洲gv猛男gv无码男同短文| 久久久久亚洲精品无码网址色欲| 亚洲一区免费观看| 亚洲成av人片一区二区三区| 亚洲国产成人久久三区| 啦啦啦高清视频在线观看免费 | 色吊丝性永久免费看码| 99在线在线视频免费视频观看| 亚洲AV无码乱码在线观看| 久久嫩草影院免费看夜色| 国产最新凸凹视频免费| a在线视频免费观看在线视频三区| 真实乱视频国产免费观看| 精品日韩亚洲AV无码一区二区三区| 国产成人精品免费视| 亚洲国产第一站精品蜜芽| rh男男车车的车车免费网站 | 亚洲国产精久久久久久久| 一个人看的在线免费视频| 免费一级大黄特色大片| 亚洲 欧洲 日韩 综合在线| 一级特黄aa毛片免费观看| 亚洲第一成年网站视频| 免费国产黄线在线观看| 人体大胆做受免费视频| 亚洲三级中文字幕|