亚洲国产精品线在线观看,亚洲香蕉免费有线视频,亚洲日韩精品国产3区 http://www.tkk7.com/cnbarry/category/50458.html代碼大樓是怎樣建成的?zh-cnTue, 27 Dec 2011 09:10:05 GMTTue, 27 Dec 2011 09:10:05 GMT60【hello world】Using Spring Security in JWA (2) - spring secure casehttp://www.tkk7.com/cnbarry/articles/367177.htmlcnbarrycnbarryMon, 26 Dec 2011 04:44:00 GMThttp://www.tkk7.com/cnbarry/articles/367177.htmlhttp://www.tkk7.com/cnbarry/comments/367177.htmlhttp://www.tkk7.com/cnbarry/articles/367177.html#Feedback0http://www.tkk7.com/cnbarry/comments/commentRss/367177.htmlhttp://www.tkk7.com/cnbarry/services/trackbacks/367177.htmlweb.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns
="http://java.sun.com/xml/ns/javaee"
        xmlns:web
="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

    id
="WebApp_ID" version="2.5">

    <display-name>JSFSpringNoSecurityWebApp</display-name>

    <!-- Spring configuration file location -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext-business.xml
            /WEB-INF/applicationContext-security.xml
        </param-value>
    </context-param>


    <!-- Let Spring handle all requests coming to the web application through this filter. -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

 
    <!-- All the requests to be handled by the above filter -->
    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>


    <!-- To start/stop Spring framework automatically. -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
</web-app>


newly added applicationContext-security.xml  
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans
="http://www.springframework.org/schema/beans"
    xsi:schemaLocation
="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security-3.0.xsd"
>
    

    <!-- Method based security -->
    <global-method-security>
        <protect-pointcut access="ROLE_SPECIAL_USER"
          expression
="execution(* org.swview.springsecuritytestapp.logic.Calculator.add(..))"/>
        <protect-pointcut access="ROLE_GENERAL_USER"
          expression
="execution(* org.swview.springsecuritytestapp.logic.Calculator.subtract(..))"/>
    </global-method-security>
    

    <!-- URL pattern based security -->
    <http auto-config="true">
        <intercept-url pattern="/**" access="ROLE_GENERAL_USER, ROLE_SPECIAL_USER" />
    </http>


    <!--
    Usernames/Passwords are
        kamal/swview
        test/spring
    
-->
    <authentication-manager>
        <authentication-provider>
            <password-encoder hash="md5"/>
            <user-service>
                <user name="kamal"
                   password
="65dc70650690999922d7dcd99dbd4033" authorities="ROLE_SPECIAL_USER" />
                <user name="test"
                   password
="2a2d595e6ed9a0b24f027f2b63b134d6" authorities="ROLE_GENERAL_USER" />
            </user-service>
        </authentication-provider>
    </authentication-manager>

</beans:beans>




other files remain the same...








        


cnbarry 2011-12-26 12:44 發表評論
]]>
【hello world】Using Spring Security in JWA (1) - no security casehttp://www.tkk7.com/cnbarry/articles/367041.htmlcnbarrycnbarryThu, 22 Dec 2011 14:53:00 GMThttp://www.tkk7.com/cnbarry/articles/367041.htmlhttp://www.tkk7.com/cnbarry/comments/367041.htmlhttp://www.tkk7.com/cnbarry/articles/367041.html#Feedback1http://www.tkk7.com/cnbarry/comments/commentRss/367041.htmlhttp://www.tkk7.com/cnbarry/services/trackbacks/367041.html

Sample applications were developed and deployed in the environment described below:

  1. JDK 1.6.11
  2. JBoss Application Server 5.1.0
  3. Spring Framework 3.0.3
  4. Spring Security 3.0.3
  5. Eclipse IDE 3.5 (Galileo)
  6. JavaServer Faces 1.2 (JSF) – No separate implementations were used other than what's found with JBoss 5.1.0
loading config - web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>JSFSpringNoSecurityWebApp</display-name>

    <!-- Spring configuration file location -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext-business.xml
        </param-value>
    </context-param>

    <!-- To start/stop Spring framework automatically. -->
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
</web-app>
 Spring config - applicationContext-business.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <bean id="calculatorBean" class="org.swview.springsecuritytestapp.logic.CalculatorIpml">
    </bean>
</beans>
JSF config - 
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2">

    <application>
        <el-resolver>
          org.springframework.web.jsf.el.SpringBeanFacesELResolver
        </el-resolver>
    </application>
    
    <managed-bean>
        <managed-bean-name>calculatorController</managed-bean-name>
        <managed-bean-class>
          org.swview.springsecuritytestapp.jsf.CalculatorController
        </managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
            <property-name>calculator</property-name>
            <value>#{calculatorBean}</value>
        </managed-property>
    </managed-bean>
</faces-config>

page file - 
calculator.jsp file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Calculator</title>
</head>
<body>
<f:view>
<h:form>
    <h:panelGrid border="1" columns="3">
        <h:outputLabel value="Number 1:"></h:outputLabel>
        <h:inputText value="#{calculatorController.number1}" id="number1Field">
            <f:convertNumber />
        </h:inputText>
        <h:message for="number1Field"></h:message>
        <h:outputText value="Number 2:"></h:outputText>
        <h:inputText value="#{calculatorController.number2}" id="number2Field">
            <f:convertNumber />
        </h:inputText>
        <h:message for="number2Field"></h:message>
        <h:outputLabel value="Sum:"></h:outputLabel>
        <h:outputLabel value="#{calculatorController.results}"></h:outputLabel>
    </h:panelGrid>
    <h:commandButton value="Add Again"
        action="#{calculatorController.add}"></h:commandButton>
</h:form>
</f:view>
</body>
</html>

Controller:

package org.swview.springsecuritytestapp.jsf;

import org.swview.springsecuritytestapp.logic.Calculator;

public class CalculatorController {
    private double number1;
    private double number2;
    private double results;
    
    private Calculator calculator;
    
    public void setCalculator(Calculator calculator) {
        this.calculator = calculator;
    }

    public double getNumber1() {
        return number1;
    }
    public void setNumber1(double number1) {
        this.number1 = number1;
    }
    public double getNumber2() {
        return number2;
    }
    public void setNumber2(double number2) {
        this.number2 = number2;
    }
    public double getResults() {
        return results;
    }
    public void setResults(double results) {
        this.results = results;
    }

    public String add() {
        results = calculator.add(number1, number2);
        return "success";
    }    
}
Spring bean implementation
package org.swview.springsecuritytestapp.logic;

public class CalculatorIpml implements Calculator {
    
    public double add(double a, double b) {
        return a + b;
    }
    
    public double subtract(double a, double b) {
        return a - b;
    }
}

---testing.. to be continue




cnbarry 2011-12-22 22:53 發表評論
]]>
主站蜘蛛池模板: 日韩欧美一区二区三区免费观看 | 国产精品手机在线亚洲| 春暖花开亚洲性无区一区二区| 最好2018中文免费视频| 久久久受www免费人成| 曰批全过程免费视频播放网站| 最新中文字幕免费视频| 亚洲国产成人精品久久久国产成人一区二区三区综 | aa级一级天堂片免费观看| 国产精品嫩草影院免费| 亚洲综合av永久无码精品一区二区 | 亚洲精品一级无码中文字幕| 亚洲AV无码乱码国产麻豆| 色老板亚洲视频免在线观| 国产天堂亚洲国产碰碰| 一个人免费视频在线观看www| 2019中文字幕在线电影免费| 国产精品视_精品国产免费 | 亚洲婷婷综合色高清在线| 在线观看亚洲电影| 免费污视频在线观看| 成人免费在线观看网站| 狠狠综合久久综合88亚洲| 亚洲人成伊人成综合网久久| 黄页视频在线观看免费| 日本在线看片免费人成视频1000| 女人让男人免费桶爽30分钟| 国产亚洲色视频在线| 亚洲免费二区三区| 九九九国产精品成人免费视频| 精品无码AV无码免费专区| 免费人成视频在线观看视频| 99亚洲精品高清一二区| 日本一区二区三区在线视频观看免费 | 四虎影视成人永久免费观看视频| 韩国免费三片在线视频| 亚洲av无码片在线播放| 噜噜综合亚洲AV中文无码| 最近免费字幕中文大全视频| 日韩亚洲国产二区| 亚洲国产中文在线二区三区免|