当前位置: 首页>>代码示例>>Java>>正文


Java SessionListener类代码示例

本文整理汇总了Java中net.bull.javamelody.SessionListener的典型用法代码示例。如果您正苦于以下问题:Java SessionListener类的具体用法?Java SessionListener怎么用?Java SessionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionListener类属于net.bull.javamelody包,在下文中一共展示了SessionListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doSessions

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
@RequestPart(HttpPart.SESSIONS)
void doSessions(@RequestParameter(HttpParameter.SESSION_ID) String sessionId)
		throws IOException {
	// par sécurité
	Action.checkSystemActionsEnabled();
	final List<SessionInformations> sessionsInformations;
	if (!isFromCollectorServer()) {
		if (sessionId == null) {
			sessionsInformations = SessionListener.getAllSessionsInformations();
		} else {
			sessionsInformations = Collections.singletonList(
					SessionListener.getSessionInformationsBySessionId(sessionId));
		}
	} else {
		sessionsInformations = collectorServer.collectSessionInformations(getApplication(),
				sessionId);
	}
	if (sessionId == null || sessionsInformations.isEmpty()) {
		htmlReport.writeSessions(sessionsInformations, messageForReport,
				HttpPart.SESSIONS.getName());
	} else {
		final SessionInformations sessionInformation = sessionsInformations.get(0);
		htmlReport.writeSessionDetail(sessionId, sessionInformation);
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:26,代码来源:HtmlController.java

示例2: doSessions

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
@RequestPart(HttpPart.SESSIONS)
void doSessions() throws IOException {
	// par sécurité
	Action.checkSystemActionsEnabled();
	final List<SessionInformations> sessionsInformations;
	if (!isFromCollectorServer()) {
		sessionsInformations = SessionListener.getAllSessionsInformations();
	} else {
		sessionsInformations = collectorServer.collectSessionInformations(getApplication(),
				null);
	}
	pdfOtherReport.writeSessionInformations(sessionsInformations);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:14,代码来源:PdfController.java

示例3: createSessionsSerializable

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
@RequestPart(HttpPart.SESSIONS)
Serializable createSessionsSerializable(
		@RequestParameter(HttpParameter.SESSION_ID) String sessionId) {
	// par sécurité
	Action.checkSystemActionsEnabled();
	if (sessionId == null) {
		return new ArrayList<SessionInformations>(SessionListener.getAllSessionsInformations());
	}
	return SessionListener.getSessionInformationsBySessionId(sessionId);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:11,代码来源:SerializableController.java

示例4: checkCsrfToken

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
public static void checkCsrfToken(HttpServletRequest httpRequest) {
	final String token = HttpParameter.TOKEN.getParameterFrom(httpRequest);
	if (token == null) {
		throw new IllegalArgumentException("csrf token missing");
	}
	final HttpSession session = httpRequest.getSession(false);
	if (session == null
			|| !token.equals(session.getAttribute(SessionListener.CSRF_TOKEN_SESSION_NAME))) {
		throw new IllegalArgumentException("invalid token parameter");
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:12,代码来源:MonitoringController.java

示例5: doCompressedHtml

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
private void doCompressedHtml(HttpServletRequest httpRequest, HttpServletResponse httpResponse,
		List<JavaInformations> javaInformationsList) throws IOException {
	if (CSRF_PROTECTION_ENABLED && SessionListener.getCurrentSession() == null) {
		SessionListener.bindSession(httpRequest.getSession());
	}
	final HtmlController htmlController = new HtmlController(collector, collectorServer,
			messageForReport, anchorNameForRedirect);
	// on teste CompressionServletResponseWrapper car il peut déjà être mis dans le serveur de collecte
	// par CollectorServlet.doCompressedPart
	if (isCompressionSupported(httpRequest)
			&& !(httpResponse instanceof CompressionServletResponseWrapper)
			// this checks if it is the Jenkins plugin
			// (another filter may already compress the stream, in which case we must not compress a second time,
			// in particular for org.kohsuke.stapler.compression.CompressionFilter
			// from https://github.com/stapler/stapler in Jenkins v1.470+ (issue JENKINS-14050)
			&& !GZIP_COMPRESSION_DISABLED) {
		// comme la page html peut être volumineuse avec toutes les requêtes sql et http
		// on compresse le flux de réponse en gzip à partir de 4 Ko
		// (à moins que la compression http ne soit pas supportée
		// comme par ex s'il y a un proxy squid qui ne supporte que http 1.0)

		final CompressionServletResponseWrapper wrappedResponse = new CompressionServletResponseWrapper(
				httpResponse, 4096);
		try {
			htmlController.doHtml(httpRequest, wrappedResponse, javaInformationsList);
		} finally {
			wrappedResponse.finishResponse();
		}
	} else {
		htmlController.doHtml(httpRequest, httpResponse, javaInformationsList);
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:33,代码来源:MonitoringController.java

示例6: getCsrfTokenUrlPart

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
public static String getCsrfTokenUrlPart() {
	if (CSRF_PROTECTION_ENABLED) {
		final HttpSession currentSession = SessionListener.getCurrentSession();
		String csrfToken = (String) currentSession
				.getAttribute(SessionListener.CSRF_TOKEN_SESSION_NAME);
		if (csrfToken == null) {
			final byte[] bytes = new byte[16];
			new SecureRandom().nextBytes(bytes);
			csrfToken = new String(Base64Coder.encode(bytes));
			currentSession.setAttribute(SessionListener.CSRF_TOKEN_SESSION_NAME, csrfToken);
		}
		return "&amp;" + HttpParameter.TOKEN + '=' + csrfToken;
	}
	return "";
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:16,代码来源:HtmlAbstractReport.java

示例7: HtmlSessionInformationsReport

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
HtmlSessionInformationsReport(List<SessionInformations> sessionsInformations, Writer writer) {
	super(writer);
	this.sessionsInformations = sessionsInformations;
	this.currentSession = SessionListener.getCurrentSession();
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:6,代码来源:HtmlSessionInformationsReport.java

示例8: writeMenu

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
private void writeMenu() throws IOException {
	writeln("<script type='text/javascript'>");
	writeln("function toggle(id) {");
	writeln("var el = document.getElementById(id);");
	writeln("if (el.getAttribute('class') == 'menuHide') {");
	writeln("  el.setAttribute('class', 'menuShow');");
	writeln("} else {");
	writeln("  el.setAttribute('class', 'menuHide');");
	writeln("} }");
	writeln("</script>");

	writeln("<div class='noPrint'> ");
	writeln("<div id='menuBox' class='menuHide'>");
	writeln("  <ul id='menuTab'><li><a href='javascript:toggle(\"menuBox\");'><img id='menuToggle' src='?resource=menu.png' alt='menu' /></a></li></ul>");
	writeln("  <div id='menuLinks'><div id='menuDeco'>");
	for (final Map.Entry<String, String> entry : menuTextsByAnchorName.entrySet()) {
		final String anchorName = entry.getKey();
		final String menuText = entry.getValue();
		writeDirectly("    <div class='menuButton'><a href='#" + anchorName + "'>" + menuText
				+ "</a></div>");
		writeln("");
	}
	final String customReports = Parameter.CUSTOM_REPORTS.getValue();
	if (customReports != null) {
		for (final String customReport : customReports.split(",")) {
			final String customReportName = customReport.trim();
			final String customReportPath = Parameters
					.getParameterValueByName(customReportName);
			if (customReportPath == null) {
				LOG.debug("Parameter not defined in web.xml for custom report: "
						+ customReportName);
				continue;
			}
			writeDirectly("    <div class='menuButton'><a href='?report="
					+ URLEncoder.encode(customReportName, "UTF-8") + "'>"
					+ htmlEncode(customReportName) + "</a></div>");
			writeln("");
		}
	}
	if (SessionListener.getCurrentSession() != null) {
		writeDirectly("    <div class='menuButton'><a href='?action=logout"
				+ getCsrfTokenUrlPart() + "'>" + I18N.getString("logout") + "</a></div>");
		writeln("");
	}
	writeln("  </div></div>");
	writeln("</div></div>");
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:48,代码来源:HtmlCoreReport.java

示例9: JavaInformations

import net.bull.javamelody.SessionListener; //导入依赖的package包/类
public JavaInformations(ServletContext servletContext, boolean includeDetails) {
	// CHECKSTYLE:ON
	super();
	memoryInformations = new MemoryInformations();
	tomcatInformationsList = TomcatInformations.buildTomcatInformationsList();
	sessionCount = SessionListener.getSessionCount();
	sessionAgeSum = SessionListener.getSessionAgeSum();
	activeThreadCount = JdbcWrapper.getActiveThreadCount();
	usedConnectionCount = JdbcWrapper.getUsedConnectionCount();
	activeConnectionCount = JdbcWrapper.getActiveConnectionCount();
	maxConnectionCount = JdbcWrapper.getMaxConnectionCount();
	transactionCount = JdbcWrapper.getTransactionCount();
	systemLoadAverage = buildSystemLoadAverage();
	systemCpuLoad = buildSystemCpuLoad();
	processCpuTimeMillis = buildProcessCpuTimeMillis();
	unixOpenFileDescriptorCount = buildOpenFileDescriptorCount();
	unixMaxFileDescriptorCount = buildMaxFileDescriptorCount();
	host = Parameters.getHostName() + '@' + Parameters.getHostAddress();
	os = buildOS();
	availableProcessors = Runtime.getRuntime().availableProcessors();
	javaVersion = System.getProperty("java.runtime.name") + ", "
			+ System.getProperty("java.runtime.version");
	jvmVersion = System.getProperty("java.vm.name") + ", "
			+ System.getProperty("java.vm.version") + ", " + System.getProperty("java.vm.info");
	if (servletContext == null) {
		serverInfo = null;
		contextPath = null;
		contextDisplayName = null;
		webappVersion = null;
	} else {
		serverInfo = servletContext.getServerInfo();
		contextPath = Parameters.getContextPath(servletContext);
		contextDisplayName = servletContext.getServletContextName();
		webappVersion = MavenArtifact.getWebappVersion();
	}
	startDate = START_DATE;
	jvmArguments = buildJvmArguments();
	final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
	threadCount = threadBean.getThreadCount();
	peakThreadCount = threadBean.getPeakThreadCount();
	totalStartedThreadCount = threadBean.getTotalStartedThreadCount();
	freeDiskSpaceInTemp = Parameters.TEMPORARY_DIRECTORY.getFreeSpace();
	springBeanExists = SPRING_AVAILABLE && SpringContext.getSingleton() != null;

	if (includeDetails) {
		dataBaseVersion = buildDataBaseVersion();
		dataSourceDetails = buildDataSourceDetails();
		threadInformationsList = buildThreadInformationsList();
		cacheInformationsList = CacheInformations.buildCacheInformationsList();
		jobInformationsList = JobInformations.buildJobInformationsList();
		pid = PID.getPID();
	} else {
		dataBaseVersion = null;
		dataSourceDetails = null;
		threadInformationsList = null;
		cacheInformationsList = null;
		jobInformationsList = null;
		pid = null;
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:61,代码来源:JavaInformations.java


注:本文中的net.bull.javamelody.SessionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。