Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Beginnings of the master single page application.
Self review
  • Loading branch information
joeldenning committed May 17, 2019
1 parent 61178e8 commit 852c5c3
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
@@ -0,0 +1,33 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
*
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.web;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SinglePageApplicationServlet extends HttpServlet {

private static final Logger log = LoggerFactory.getLogger(SinglePageApplicationServlet.class);

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
RequestDispatcher dispatcher = request.getRequestDispatcher("/master-single-page-application.jsp");
dispatcher.forward(request, response);
} catch (Exception e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
this.log.error("Failed to render GSP for master-single-page-application", e);
}
}
}
2 changes: 1 addition & 1 deletion webapp/src/main/webapp/.gitignore
@@ -1,4 +1,4 @@
*.jsp
/*.css
/*.js

!master-single-page-application.jsp
9 changes: 9 additions & 0 deletions webapp/src/main/webapp/WEB-INF/web.xml
Expand Up @@ -306,6 +306,15 @@
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.openmrs.web.SinglePageApplicationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<session-config>
<cookie-config>
Expand Down
22 changes: 22 additions & 0 deletions webapp/src/main/webapp/master-single-page-application.jsp
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Open MRS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="importmap-type" content="systemjs-importmap">
<link rel="preload" href="${cookie['import-map-override-url'] == null ? 'import-map.json' : cookie['import-map-override-url'].getValue()}" as="script" crossorigin="anonymous" />
<script type='systemjs-importmap' src="${cookie['import-map-override-url'] == null ? 'import-map.json' : cookie['import-map-override-url'].getValue()}"></script>
<script src="https://unpkg.com/import-map-overrides@1.5.0/dist/import-map-overrides.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/3.1.6/system.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/3.1.6/extras/amd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/3.1.6/extras/named-exports.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/3.1.6/extras/named-register.min.js"></script>
<script>
System.import("@openmrs/root-config")
</script>
</head>
<body>
</body>
</html>

0 comments on commit 852c5c3

Please sign in to comment.