静态html在Jersey中加载15秒以上

时间:2015-12-05 04:02:20

标签: java jersey jetty jersey-2.0

我有一个由Jersey提供的简单Java REST API应用程序。但只是加载(没有请求,我检查了Chrome网络视图)静态HTML需要15秒以上。日志似乎没有表明任何错误。什么可能导致这个?我已经尝试了几种渲染静态页面的方法(forwardOn404和staticContentRegex),但只有一种方法有效。跟踪也不起作用。

我在泽西岛2.7

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<servlet>
    <servlet-name>jersey</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>
            io.swagger.jaxrs.listing, com.btjroq.user.UserApi,com.btjroq.user.CreateUserApi,com.btjroq.twitter.TwitterApi,com.btjroq.stats.StatsApi
        </param-value>
    </init-param>

    <!--<init-param>-->
        <!--<param-name>jersey.config.servlet.servlet.forwardOn404</param-name>-->
        <!--<param-value>true</param-value>-->
    <!--</init-param>-->

    <!--<init-param>-->
        <!--<param-name>jersey.config.servlet.servlet.staticContentRegex</param-name>-->
        <!--&lt;!&ndash;<param-value>/.*html</param-value>&ndash;&gt;-->
        <!--<param-value>/(pages/.*|minoral/.*|js/.*|css/.*|bower_components/.*|apidocs/.*|swagger/.*)</param-value>-->
    <!--</init-param>-->


    <init-param>
        <param-name>jersey.config.server.tracing.threshold</param-name>
        <param-value>VERBOSE</param-value>
    </init-param>
    <init-param>
    <param-name>jersey.config.server.tracing.type</param-name>
    <param-value>ALL</param-value>
    </init-param>



    <!--<load-on-startup>1</load-on-startup>-->
</servlet>


<servlet-mapping>
    <servlet-name>jersey</servlet-name>
    <url-pattern>/api/*</url-pattern>
</servlet-mapping>



<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/js/*</url-pattern>
</servlet-mapping>


<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/bower_components/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/pages/*</url-pattern>
</servlet-mapping>



<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/css/*</url-pattern>
</servlet-mapping>


<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/minoral/*</url-pattern>
</servlet-mapping>


<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/swagger/*</url-pattern>
</servlet-mapping>


<welcome-file-list>
    <welcome-file>pages/index.html</welcome-file>
</welcome-file-list>

<filter>
    <filter-name>ObjectifyFilter</filter-name>
    <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ObjectifyFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>


<servlet>
    <servlet-name>RedirectCallback</servlet-name>
    <servlet-class>com.auth0.Auth0ServletCallback</servlet-class>
    <init-param>
        <param-name>auth0.redirect_on_success</param-name>
        <param-value>/</param-value>
    </init-param>
    <init-param>
        <param-name>auth0.redirect_on_error</param-name>
        <param-value>/login</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>RedirectCallback</servlet-name>
    <url-pattern>/callback</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>WarmupServlet</servlet-name>
    <servlet-class>com.btjroq.WarmupServlet</servlet-class>
    <load-on-startup>1</load-on-startup>


</servlet>

<servlet-mapping>
    <servlet-name>WarmupServlet</servlet-name>
    <url-pattern>/WarmupServlet</url-pattern>
</servlet-mapping>
<filter>
    <filter-name>JWTFilter</filter-name>
    <filter-class>com.btjroq.util.JWTFilter</filter-class>

</filter>

<!-- We are going to restrict /api/* paths -->
<filter-mapping>
    <filter-name>JWTFilter</filter-name>
    <url-pattern>*/private/*</url-pattern>
</filter-mapping>



</web-app>

0 个答案:

没有答案