<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>bigzerg</title>
    <description></description>
    <link>http://bigzerg.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>struts2 &amp; maven</title>
        <author>bigzerg</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://bigzerg.javaeye.com">bigzerg</a>&nbsp;
          链接：<a href="http://bigzerg.javaeye.com/blog/182460" style="color:red;">http://bigzerg.javaeye.com/blog/182460</a>&nbsp;
          发表时间: 2008年04月14日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          1、创建struts2项目：<br /><a href="http://struts.apache.org/2.0.11.1/docs/ready-set-go.html" target="_blank">reference</a><br /><br /><pre name="code" class="java">
mvn archetype:create -DgroupId=tutorial \
         -DartifactId=tutorial \
         -DarchetypeGroupId=org.apache.struts \
         -DarchetypeArtifactId=struts2-archetype-starter \
         -DarchetypeVersion=2.0.9-SNAPSHOT \
         -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
</pre><br /><br />如果需要使用struts2的snapshot版本，需要在POM.XML中添加：<br /><pre name="code" class="xml">
&lt;dependency>
  &lt;groupId>org.apache.struts&lt;/groupId>
    &lt;artifactId>struts2-core&lt;/artifactId>
      &lt;version>2.1.1&lt;/version>
&lt;/dependency>
</pre><br /><pre name="code" class="xml">
&lt;repositories>
  &lt;repository>
    &lt;id>apache.snapshots&lt;/id>
    &lt;name>ASF Maven 2 Snapshot&lt;/name>
    &lt;url>http://people.apache.org/repo/m2-snapshot-repository&lt;/url>
  &lt;/repository>
&lt;/repositories>
</pre><br />2、然后使用 mvn -Dwtpversion=1.0 eclipse:eclipse<br />建立Eclipse项目。<br /><br />3、struts2需要jdk1.5以上的tools.jar，如果maven不能定位到，手动添加：<br /><pre name="code" class="xml">
		&lt;dependency>
			&lt;groupId>com.sun&lt;/groupId>
			&lt;artifactId>tools&lt;/artifactId>
			&lt;version>1.5.0&lt;/version>
			&lt;scope>system&lt;/scope>
			&lt;systemPath>
				C:/Program Files/Java/jdk1.6.0/lib/tools.jar
			&lt;/systemPath>
		&lt;/dependency>
</pre><br /><br />4、如果安装m2eclipse，使用m2eclipse管理项目。<br />可能需要将mvn生成的[Java Build Path]里的repo链接删除，用m2ecipse自动管理。<br /><br />5、在project->properties->J2EE Module Dependencies 选取需要的Jar/Moule.<br />    这将自动把需要的lib拷贝到容器对于的lib目录。
          <br/>
          <span style="color:red;">
            <a href="http://bigzerg.javaeye.com/blog/182460#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 14 Apr 2008 08:51:22 +0800</pubDate>
        <link>http://bigzerg.javaeye.com/blog/182460</link>
        <guid>http://bigzerg.javaeye.com/blog/182460</guid>
      </item>
      <item>
        <title>Spring-security 实践</title>
        <author>bigzerg</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://bigzerg.javaeye.com">bigzerg</a>&nbsp;
          链接：<a href="http://bigzerg.javaeye.com/blog/179096" style="color:red;">http://bigzerg.javaeye.com/blog/179096</a>&nbsp;
          发表时间: 2008年04月03日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Maven设置，当前的版本是2.0.0-RC1：<br /><br /><pre name="code" class="XML">
    &lt;dependency>
    	&lt;groupId>org.springframework.security&lt;/groupId>
    	&lt;artifactId>spring-security-core&lt;/artifactId>
    	&lt;version>2.0.0-RC1&lt;/version>
    &lt;/dependency>

    &lt;repository>
      &lt;id>spring-milestone&lt;/id>
      &lt;name>Spring Portfolio Milestone Repository&lt;/name>
      &lt;url>http://s3.amazonaws.com/maven.springframework.org/milestone/&lt;/url>
    &lt;/repository>
</pre><br />由于不是release版本，加上spring的repository。<br /><br /><br />1、web.xml设置：<br />在 web.xml 中, 每个应用程序需要一个 Spring Security filter，使用 FilterChainProxy. <br /><pre name="code" class="xml">
    &lt;filter>
        &lt;filter-name>filterChainProxy&lt;/filter-name>
        &lt;filter-class>org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class>
    &lt;/filter>

    &lt;filter-mapping>
      &lt;filter-name>filterChainProxy&lt;/filter-name>
      &lt;url-pattern>/*&lt;/url-pattern>
    &lt;/filter-mapping>
</pre><br /><br />2、设置filterChainProxy：<br /><pre name="code" class="xml">
&lt;bean id="filterChainProxy"
        class="org.springframework.security.util.FilterChainProxy">
    &lt;property name="filterInvocationDefinitionSource">
        &lt;value>
  CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
  PATTERN_TYPE_APACHE_ANT
  /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor,switchUserProcessingFilter
        &lt;/value>
    &lt;/property>
&lt;/bean>
</pre><br />在内部，Spring Security 将使用 PropertyEditor转换XML中的字符串注入到FilterInvocationDefinitionSource对象中。这一阶段，重要的是设置的这一系列的filter将被运行，每个filter对应到应用上下文中定义的 &lt;bean id> 。<br /> in our case some extra beans will also appear in the application context, and they'll be named httpSessionContextIntegrationFilter, logoutFilter and so on. The order that the filters should appear is discussed in the filters section of the reference guide - although they are correct in the above example.<br /><br />例中有<strong>AuthenticationProcessingFilter</strong>和<strong>BasicProcessingFilter</strong>被使用。这些"认证机制"分别对应到基于form-based认证和BASIC HTTP header-based认证(we discussed the role of authentication mechanisms earlier in this reference guide)。如果你不使用form或BASIC认证, 这些beans就不需要定义。你可以另外定义filters来应用到你需要的认证环境，例如DigestProcessingFilter或CasProcessingFilter。 Refer to the individual chapters of this part of the reference guide to learn how to configure each of these authentication mechanisms.<br /><br />Recall that <strong>HttpSessionContextIntegrationFilter</strong> keeps the contents of the SecurityContext between invocations inside an HTTP线程。这意味着这个认证机制仅仅会被使用一次，当第一次试着初始化认证时。The rest of the time the authentication mechanisms sit there and silently pass the request through to the next filter in the chain. That is a practical requirement due to the fact that few authentication approaches present credentials on each and every call (BASIC authentication being a notable exception), but what happens if a principal's account gets cancelled or disabled or otherwise changed (eg an increase or decrease in GrantedAuthority[]s) after the initial authentication step? Let's look at how that is handled now.<br /><br />The major authorization provider for secure objects has previously been introduced as AbstractSecurityInterceptor. This class needs to have access to an AuthenticationManager. It also has configurable settings to indicate whether an Authentication object should be re-authenticated on each secure object invocation. By default it just accepts any Authentication inside the SecurityContextHolder is authenticated if Authentication.isAuthenticated() returns true. This is great for performance, but not ideal if you want to ensure up-to-the-moment authentication validity. For such cases you'll probably want to set the AbstractSecurityInterceptor.alwaysReauthenticate property to true.<br />6、认证并发线程的控制：<br />控制web应用接受认证的线程数量，避免攻击。<br />在web.xml加入：<br /><pre name="code" class="xml">
&lt;listener>
    &lt;listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher&lt;/listener-class>
&lt;/listener>  
</pre><br />在spring设置中加入：<br /><pre name="code" class="xml">
&lt;bean id="authenticationManager"
        class="org.springframework.security.providers.ProviderManager">
    &lt;property name="providers">
        &lt;!-- your providers go here -->
    &lt;/property>
    &lt;property name="sessionController">
        &lt;ref bean="concurrentSessionController"/>
    &lt;/property>
&lt;/bean>

&lt;bean id="concurrentSessionController" class="org.springframework.security.concurrent.ConcurrentSessionControllerImpl">
    &lt;property name="maximumSessions">&lt;value>1&lt;/value>&lt;/property>
    &lt;property name="sessionRegistry">&lt;ref local="sessionRegistry"/>&lt;/property>
&lt;/bean>

&lt;bean id="sessionRegistry" class="org.springframework.security.concurrent.SessionRegistryImpl"/>
</pre>
          <br/>
          <span style="color:red;">
            <a href="http://bigzerg.javaeye.com/blog/179096#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 03 Apr 2008 10:42:58 +0800</pubDate>
        <link>http://bigzerg.javaeye.com/blog/179096</link>
        <guid>http://bigzerg.javaeye.com/blog/179096</guid>
      </item>
      <item>
        <title>Maven &amp; Eclipse WTP</title>
        <author>bigzerg</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://bigzerg.javaeye.com">bigzerg</a>&nbsp;
          链接：<a href="http://bigzerg.javaeye.com/blog/172341" style="color:red;">http://bigzerg.javaeye.com/blog/172341</a>&nbsp;
          发表时间: 2008年03月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          1、生成标准布局的webapp项目，在控制台执行下面命令(groupId后面是包名，artifactId后面是项目名称)：<br /><pre name="code" class="java">mvn archetype:create -DgroupId=org.example -DartifactId=example-webapp -DarchetypeArtifactId=maven-archetype-webapp</pre><br />2、设置project facets:<br /><pre name="code" class="xml">
	&lt;build>
		&lt;finalName>sample-webapp&lt;/finalName>
		&lt;plugins>
			&lt;plugin>
				&lt;groupId>org.apache.maven.plugins&lt;/groupId>
				&lt;artifactId>maven-compiler-plugin&lt;/artifactId>
				&lt;configuration>
					&lt;source>1.5&lt;/source>
					&lt;target>1.5&lt;/target>
				&lt;/configuration>
			&lt;/plugin>
		&lt;/plugins>
	&lt;/build>

</pre><br />3、生成eclipse项目<br />在控制台下进入项目目录，如果是从maven webapp项目生成eclipse wtp，执行：<br /><pre name="code" class="java">mvn –Dwtpversion=1.0 eclipse:eclipse</pre><br />（wtp1.0以上版本均可用，可设置为R7/1.0/1.5）<br />4、为项目添加新的依赖<br /><br />编辑pom文件，添加新的dependency，保存后，在控制台分别执行：<br /><pre name="code" class="java">
mvn eclipse:clean 
mvn -Dwtpversion=1.0 eclipse:eclipse
</pre><br />在eclipse中刷新项目即可看到新的依赖项已经添加到eclipse项目中<br /><br />5、使用<br /><a href="http://code.google.com/p/m2wtp/" target="_blank">m2wtp</a> or <a href="http://blogs.unixage.com/blojsom/blog/adam.kruszewski/eclipse/2006/05/02/Maven2-Eclipse-plugin-with-latest-WTP-from-callisto-update-site.html" target="_blank">libCopy</a>: <a href="http://adam.kruszewski.name/eclipse/" target="_blank">update site</a><br /><br />来拷贝maven管理的lib到webapp中。
          <br/>
          <span style="color:red;">
            <a href="http://bigzerg.javaeye.com/blog/172341#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 16 Mar 2008 15:39:45 +0800</pubDate>
        <link>http://bigzerg.javaeye.com/blog/172341</link>
        <guid>http://bigzerg.javaeye.com/blog/172341</guid>
      </item>
      <item>
        <title>Warp Maven2   </title>
        <author>bigzerg</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://bigzerg.javaeye.com">bigzerg</a>&nbsp;
          链接：<a href="http://bigzerg.javaeye.com/blog/172282" style="color:red;">http://bigzerg.javaeye.com/blog/172282</a>&nbsp;
          发表时间: 2008年03月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          由于作者未使用maven管理warp项目，给我们习惯用maven的带来不便。<img src="../../../images/smiles/icon_cry.gif" alt="" /> <br /><br />Neither Josh nor I are fans of Maven; but I don't mind if you or<br />someone wants to manage the effort?<br /><br />Though if I ever get buildr working on mac I may end up maintaining a<br />script for it and publishing to maven2's ibiblio.org.<br /><br />Dhanji. <br /><br /><img src="/images/smiles/icon_twisted.gif"/><br /><br /><a href="http://code.google.com/p/warp-core/wiki/WarpWithMaven2" target="_blank">WarpWithMaven2</a>上有一些相关步骤设置使用maven。 <br /><br />1、使用svn下载warp-core的源代码：<a href="http://warp-core.googlecode.com/svn/trunk/" target="_blank">http://warp-core.googlecode.com/svn/trunk/</a>； <br />2、在warp-core源目录新增pom.xml文件，将上面链接中的对应内容拷贝其中； <br />3、<pre name="code" class="java">mvn install -Dtest=false -DfailIfNoTests=false</pre>（测试没法通过～～～） <br />之前需要手工deploy包，使用： <br /><pre name="code" class="java">mvn deploy:deploy-file -DgroupId=com.google.code.guice -DartifactId=guice-servlet -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file</pre><br />如果你有自己的artifactory，deploy它们。 <br /><br />4、新建project, 使用<a href="http://code.google.com/p/warp-core/wiki/WarpWithMaven2" target="_blank">WarpWithMaven2</a>的例子pom.xml，不过缺几个包。 <br /><pre name="code" class="xml">
      &lt;dependency>
      &lt;groupId>org.directwebremoting&lt;/groupId>
      &lt;artifactId>dwr&lt;/artifactId>
      &lt;version>2.0.1&lt;/version>
    &lt;/dependency> 
         &lt;dependency>
      &lt;groupId>xpp3&lt;/groupId>
      &lt;artifactId>xpp3&lt;/artifactId>
      &lt;version>1.1.4&lt;/version>
    &lt;/dependency> 
         &lt;dependency>
      &lt;groupId>org.mvel&lt;/groupId>
      &lt;artifactId>mvel&lt;/artifactId>
      &lt;version>1.2.0RC3&lt;/version>
    &lt;/dependency>    </pre><br /><br />xpp3/mvel使用源文件中带的包，deploy它们。。。
          <br/>
          <span style="color:red;">
            <a href="http://bigzerg.javaeye.com/blog/172282#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 16 Mar 2008 09:29:05 +0800</pubDate>
        <link>http://bigzerg.javaeye.com/blog/172282</link>
        <guid>http://bigzerg.javaeye.com/blog/172282</guid>
      </item>
      <item>
        <title>guice/warp的相关链接</title>
        <author>bigzerg</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://bigzerg.javaeye.com">bigzerg</a>&nbsp;
          链接：<a href="http://bigzerg.javaeye.com/blog/172281" style="color:red;">http://bigzerg.javaeye.com/blog/172281</a>&nbsp;
          发表时间: 2008年03月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <a href="http://groups.google.com/group/google-guice" target="_blank">google-guice</a><br /><a href="http://code.google.com/p/guice-examples/" target="_blank">guice-examples</a><br /><br /><a href="http://www.wideplay.com/" target="_blank">warp 主页</a><br /><a href="http://code.google.com/p/warp-core/" target="_blank">warp-core</a><br /><a href="http://code.google.com/p/warp-persis/" target="_blank">warp-persis</a><br /><a href="http://code.google.com/p/warp-persist-sample/" target="_blank">warp-persist-sample</a>: warp-persit的Dynamic Finders/Queries等使用的例子程序。<br /><br /><a href="http://www.jroller.com/page/dhanji" target="_blank">Dhanji's Blog (Tutorials)</a> 有个Blog的例子，简单示范了warp-core/warp-persist的使用。
          <br/>
          <span style="color:red;">
            <a href="http://bigzerg.javaeye.com/blog/172281#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 16 Mar 2008 09:25:05 +0800</pubDate>
        <link>http://bigzerg.javaeye.com/blog/172281</link>
        <guid>http://bigzerg.javaeye.com/blog/172281</guid>
      </item>
  </channel>
</rss>