我想知道我的应用程序中的会话大小以优化它。为了找到这个大小,我使用mat进行堆转储并对其进行分析。
Seam在哪里存储会话和会话bean?
我虽然是在org.apache.catalina.session.StandardSession,但明显没有(我在这个bean中只有2个八位字节)。
答案 0 :(得分:0)
Seam将所有内容存储在HttpSession中。
Name("someFilter")
@Filter(around = { "org.jboss.seam.web.ajax4jsfFilter" })
@Scope(ScopeType.APPLICATION)
@Startup
@BypassInterceptors
public class SomeFilter extends AbstractFilter {
private static final LogProvider log = Logging.getLogProvider(SomeFilter.class);
@SuppressWarnings("unchecked")
public void doFilter(ServletRequest request, ServletResponse resp, FilterChain arg2) throws IOException, ServletException {
if (HttpServletRequest.class.isAssignableFrom(request.getClass())) {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse response = (HttpServletResponse) resp;
HttpSession session = req.getSession();
if (log.isInfoEnabled()) {
List<String> attrNames = Collections.list(session.getAttributeNames());
for (String o : attrNames) {
log.info("objects in session " + o);
}
}
}
}