天空是蓝色的

做好软件为中国 #gcc -c helloworld.c -o helloworld.o //编译目标文件 #gcc helloworld.o -o helloworld //编译成可执行exe #helloworld //运行exe
数据加载中……
Extension Tapestry4`s restart service to clear my login cookies

接上篇,自定义一个logout service 把我的login cookies 清楚掉

Tapestry .java

package common.tapestry;

public final  class Tapestry {
  public static final String LOGOUT_SERVICE = "logout";
}

LogoutService.java
package common.tapestry.engine;

import java.io.IOException;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.RestartService;

import common.tapestry.Tapestry;

public class LogoutService extends RestartService {
 private LoginCookiesManager loginCookiesManager;


 public void setLoginCookiesManager(
   LoginCookiesManager loginCookiesManager) {
  this.loginCookiesManager = loginCookiesManager;
 }

 public void service(IRequestCycle cycle) throws IOException {
  loginCookiesManager.removeCookies();
  super.service(cycle);
 }

 public String getName() {
  return Tapestry.LOGOUT_SERVICE;
 }
}

hivemodule.xml
<?xml version="1.0"?>
<module id="common.tapestry" version="1.0.0">

 <!-- extends tapestry RestartService and clear the login cookies info-->
    <service-point id="LogoutService" interface="org.apache.tapestry.engine.IEngineService">
        <invoke-factory>
            <construct class="common.tapestry.engine.LogoutService">
             <set-service property="request" service-id="tapestry.globals.HttpServletRequest" />
                <set-service property="response" service-id="tapestry.globals.HttpServletResponse" />
                <set-object property="servletPath" value="app-property:org.apache.tapestry.servlet-path" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
                <set-object property="loginCookiesManager" value="service:common.tapestry.LoginCookiesManager"/>
             </construct>
        </invoke-factory>
    </service-point>

    <contribution configuration-id="tapestry.services.ApplicationServices">
        <service name="logout" object="service:common.tapestry.LogoutService" />
    </contribution>

</module>

in your Pages
<a jwcid="@ServiceLink" href="#" service="ognl:@common.tapestry.Tapestry@LOGOUT_SERVICE" target="_top">退出</a>

系原创
作者其他blog  http://oxyc.spaces.live.com
                        http://hiok.blog.sohu.com

posted on 2008-03-24 15:34 bluesky 阅读(2057) 评论(1)  编辑  收藏 所属分类: 工作总结

评论

# re: Extension Tapestry4`s restart service to clear my login cookies 2016-06-14 14:59 http://www.antiquites-carrau.fr

public class LogoutService extends RestartService {
  回复  更多评论    

只有注册用户登录后才能发表评论。


网站导航: