Skip to content

Wrong context root for java_mini_profile? #1

Description

@MoriTanosuke

I tried to add java-mini-profiler to my simple webapp today but I got stuck after adding all the needed parts to my java/jsp code.

This is my web.xml:

<web-app>
    <display-name>My Web Application</display-name>
    <filter>
        <filter-name>miniprofiler-filter</filter-name>
        <filter-class>au.com.funkworks.jmp.MiniProfilerFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>miniprofiler-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>Jersey REST Service</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>de.kopis.upordown</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>miniprofiler</servlet-name>
        <servlet-class>au.com.funkworks.jmp.MiniProfilerServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>miniprofiler</servlet-name>
        <url-pattern>/java_mini_profile/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Jersey REST Service</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

I'm using jersey and angularjs. This is the JSP code I use:

<%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!doctype html>
<html ng-app="project">
<head>
    <title>My webapp</title>
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angularresource.min.js"></script>
    <script src="project.js"></script>
</head>
<body>
<c:out value="${mini_profile_includes}" escapeXml="false" />
<h1>My Webapp</h1>
...
</body>
</html>

The code of your java-mini-profiler gets inserted into my page, but it wants to load the HTML/CSS from http://MYWEBSERVER/java_mini_profile/resource?id=mini_profiler.css instead of http://MYWEBSERVER/mycontextroot/java_mini_profile/resource?id=mini_profiler.css

Do I have to install another webapp (maybe https://github.com/alvins82/java-mini-profiler-web) for the profiler UI? But when I add mycontextroot to the GET requests for the HTML/CSS I can see the sourcecode that is generated...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions