`
- 浏览:
2877992 次
- 性别:
- 来自:
上海
-
spring transaction and interceptor
spring 声明性事务
java 代码
- "category" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true">
- "transactionManager">"hibernatetransaction"/>
- "target">"categoryhelper"/>
- "transactionAttributes">
-
<props></props>
- "get*">PROPAGATION_REQUIRED,readOnly
- "find*">PROPAGATION_REQUIRED,readOnly
- "save*">PROPAGATION_REQUIRED
- "del*">PROPAGATION_REQUIRED
-
-
-
spring interceptor
java 代码
- public boolean beforeAction(Action action, ActionMapping mapping,
- ActionForm form, HttpServletRequest request,
- HttpServletResponse response)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("edit vote permission interceptor beforeAction called");
- }
-
- int voteID = ParamUtils.getInteger(request , "voteid");
-
- try
- {
-
- Vote vote = ForumNukeServiceLocatorFactory.getServiceLocator().getVoteHelper().getVote(voteID);
- HttpSession session = request.getSession();
- OnlineUser sessionUser = (OnlineUser)session.getAttribute(Constants.SESSION_ONLINEUSER_KEY);
- if (sessionUser.getUserName().equals(vote.getPoster()))
- {
- Forum forum = (Forum)ForumNukeServiceLocatorFactory.getServiceLocator().getThreadHelper().getThreadByVote(voteID).getForum();
-
-
- Permission perm = UserFactory.newPermission("editvote.do" , true , "forumid=" + forum.getForumID());
- return hasPermission(perm , request , response , mapping);
- }
- else
- {
- forwardNoPermission(mapping , request , response);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- forwardNoPermission(mapping , request , response);
- }
-
- return false;
- }
-
-
-
-
-
-
-
-
-
-
- public boolean afterAction(Action action, ActionMapping mapping,
- ActionForm form, HttpServletRequest request,
- HttpServletResponse response)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("edit vote permission interceptor afterAction called");
- }
-
- return true;
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Error setting property values; nested ...
JdbcTemplate JdbcTemplate 执行与更新 <br>JdbcTemplate - 查询 以物件方式进行操作 DataFieldMaxValueIncrementer 交易管理 Spring 提供编程式的交易管理(Programmatic transaction ...
class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager" ref="transactionManager"></property> <property name="transactionAttributes"> ...
class="org.springframework.transaction.interceptor.TransactionInterceptor"> <!-- 事务拦截器bean需要依赖注入一个事务管理器 --> <!-- 下面定义事务传播属性 [ bus* 事务的方法名]--> *">...
HibernateInterceptor HibernateJdbcException HibernateJdbcException HibernateJpaDialect HibernateJpaVendorAdapter HibernateObjectRetrievalFailureException HibernateObjectRetrievalFailureException...
-- JTA环境的事务配置 <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager or WebLogicJtaTransactionManager"/> --> <!-- 使用annotation定义事务 --> ...
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314) at org.springframework.transaction.interceptor....
使用SpringSecurity + Spring Email + Interceptor + Redis + ThreadLocal实现权限,注册,登陆,设置等功能。 3.使用Advice + AOP + Transaction实现帖子,评论,私信功能。 4.使用Redis实现点赞,关注,统计用户...
8. …//getter and setter 9. } 特别需要注意的是:数据库表为Blob类型的字段在Tfile中的fileContent类型为byte[]。Tfile的Hibernate映射文件Tfile.hbm.xml放在Tfile .java类文件的相同目录下: 代码 2 领域...
com.kingdee.bos.transaction.springframework.transaction.interceptor com.kingdee.bos.transaction.springframework.transaction.jta com.kingdee.bos.transaction.springframework.transaction.support ...
{12.15}Transaction}{177}{section.12.15} {12.16}char与varchar2}{178}{section.12.16} {12.17}number}{179}{section.12.17} {12.18}\ttfamily user\_tables, user\_objects}{179}{section.12.18} {12.19}...
│ spring.xml │ struts.xml │ ├─28个java常用的工具类 │ │ Base64.java │ │ Base64DecodingException.java │ │ CConst.java │ │ CharTools.java │ │ ConfigHelper.java │ │ Counter.java │ │ C...