Skip to content

Instantly share code, notes, and snippets.

@sadraskol
Last active October 6, 2015 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadraskol/f7f7c90794e3ba9cdc35 to your computer and use it in GitHub Desktop.
Save sadraskol/f7f7c90794e3ba9cdc35 to your computer and use it in GitHub Desktop.
working jsp deployment
$ curl -i http://localhost:8181/surv-karaf/monitor.jsp
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=yxgfs4wdknxxneykgeksvz6f;Path=/surv-karaf
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 854
Server: Jetty(8.1.17.v20150415)
<?xml version="1.0" encoding="UTF-8"?>
<Techno name="Karaf">
<Time universal="1444120784300" date="06/10/15" time="10:39:44" />
<Server name="hello">
<Component type="Instance" name="null">
<Param name="JavaVersion" val="1.8.0_51"/>
<Component type="JVMRuntime" name="JVMRuntime">
<Param name="UseMemory" val="182046952"/>
<Param name="FreeMemory" val="380514072"/>
<Param name="TotalMemory" val="562561024"/>
<Param name="UsePerm" val="143713968"/>
<Param name="MaxPerm" val="155779072"/>
</Component>
</Component>
</Server>
</Techno>
<%@page import="java.lang.management.*" %>
<%@page import="javax.management.*" %>
<%@page import="java.lang.*" %>
<%@page import="java.util.*" %>
<%@page import="java.text.*" %>
<%@page import="java.net.*" %>
<%
String instance = System.getProperty("Instance");
String JavaVersion = System.getProperty("java.version");
MemoryMXBean mxb = ManagementFactory.getMemoryMXBean();
MemoryUsage hmu = mxb.getHeapMemoryUsage();
MemoryUsage nhmu = mxb.getNonHeapMemoryUsage();
Long freeMemory = hmu.getUsed();
Long totalMemory = hmu.getCommitted();
Long useMemory = totalMemory.longValue() - freeMemory.longValue();
Long usePerm = nhmu.getUsed();
Long maxPerm = nhmu.getCommitted();
java.util.Date date = new java.util.Date();
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT , Locale.FRANCE);
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.MEDIUM , Locale.FRANCE);
DateFormat longFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.FRANCE);
%>
<?xml version="1.0" encoding="UTF-8"?>
<Techno name="Karaf">
<Time universal="<%= date.getTime() %>" date="<%= dateFormatter.format(date) %>" time="<%= timeFormatter.format(date) %>" />
<Server name="hello">
<Component type="Instance" name="<%= instance %>">
<Param name="JavaVersion" val="<%= JavaVersion %>"/>
<Component type="JVMRuntime" name="JVMRuntime">
<Param name="UseMemory" val="<%= useMemory %>"/>
<Param name="FreeMemory" val="<%= freeMemory %>"/>
<Param name="TotalMemory" val="<%= totalMemory %>"/>
<Param name="UsePerm" val="<%= usePerm %>"/>
<Param name="MaxPerm" val="<%= maxPerm %>"/>
</Component>
</Component>
</Server>
</Techno>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<!-- Some Parent -->
</parent>
<artifactId>SurvaKaraf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Web-ContextPath>/surv-karaf</Web-ContextPath>
<Webapp-Context>/surv-karaf</Webapp-Context>
<_wab>src/main/webapp</_wab>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" ?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<error-page>
<error-code>404</error-code>
<location>/erreur404.html</location>
</error-page>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment