OpenShift returns a response with the title text / plain instead of text / html

Firstly, my English is not very good (I'm Vietnamese), sorry for that.

I am new to OpenShift. I hosted a Java web application (Spring MVC Restful + AngularJS) on OpenShift at https://bms-sps2.rhcloud.com/bms . When I access it, OpenShift returns a plaintext page instead of an html page. But when I develop the application on localhost, this problem does not occur.

problem

Here is the structure of my application:

structure

And resource mapping configuration:

<mvc:resources mapping="/" location="/app/index.html/" cache-period="86400" />

In my research, this problem is due to

MIME Type Mappings: Tomcat "Content-Type" web.xml.

mime-mapping ? mime-mapping, :

<mime-mapping>
    <extension></extension>
    <mime-type>text/html</mime-type>
</mime-mapping>

<mime-mapping>
    <extension>*</extension>
    <mime-type>text/html</mime-type>
</mime-mapping>

<mime-mapping>
    <extension></extension>
    <mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>*</extension>
    <mime-type>text/html</mime-type>
</mime-mapping>

.

: web.xml

<web-app>
<display-name>Business Management System</display-name>

<servlet>
    <servlet-name>bms</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>bms</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/root-context.xml
    </param-value>
</context-param>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/rest/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>hibernateFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
    </filter-class>
    <init-param>
        <param-name>sessionFactoryBeanName</param-name>
        <param-value>sessionFactory</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>hibernateFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

- ?

.

+4
1

, url https://bms-sps2.rhcloud.com/bms/index.html#/ ( html), . , - web.xml, tomcat html.

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

Source: https://habr.com/ru/post/1618704/


All Articles