NutzCN Logo
问答 在UserModule添加logout方法,启动tomcat时没看到logout方法
发布于 2905天前 作者 burnszp 3220 次浏览 复制 上一个帖子 下一个帖子
标签: nutzbook

我在UserModule类中添加了如下代码:

package net.wendal.nutzbook.module;

import javax.servlet.http.HttpSession;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import net.wendal.nutzbook.bean.User;

@IocBean
@At("/user")
@Ok("json")
@Fail("http:500")
public class UserModule {

	@Inject
	protected Dao dao;

	@At
	public int count() {
		return dao.count(User.class);
	}

	@At
	public Object login(@Param("username") String name, @Param("password") String password, HttpSession session) {
		User user = dao.fetch(User.class, Cnd.where("name", "=", name).and("password", "=", password));
		if (user == null) {
			return false;
		} else {
			session.setAttribute("me", user.getId());
			return true;
		}
	}

	@At
	 @Ok(">>:/")
	public void logout(HttpSession session) {
		session.invalidate();
	}

}

启动tomcat时,
[DEBUG] 19:30:27.638 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/count' >> (UserModule.java:27).count : int | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:30:27.643 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/login' >> (UserModule.java:31).login : Object | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
[INFO ] 19:30:27.643 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:220) - Found 2 module methods

2 回复

我又重新clean一下项目,然后重新启动下,现在好了

[DEBUG] 19:53:49.528 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/' >> (UserModule.java:106).index : void | @Ok(jsp:jsp.user.list) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.543 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/add' >> (UserModule.java:61).add : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.543 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/count' >> (UserModule.java:38).count : int | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.544 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/update' >> (UserModule.java:72).update : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.550 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/delete' >> (UserModule.java:86).delete : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.552 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/query' >> (UserModule.java:95).query : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.553 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/login' >> (UserModule.java:44).login : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
[DEBUG] 19:53:49.555 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:146) - '/user/logout' >> (UserModule.java:56).logout : void | @Ok(>>:/ ) @Fail(http:500) | by 1 Filters | (I:UTF-8/O:UTF-8)
[INFO ] 19:53:49.555 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:220) - Found 8 module methods

添加回复
请先登陆
回到顶部