-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from marklogic/Quick-Start-TomcatDeployment
Quick start tomcat deployment and initial page
- Loading branch information
Showing
29 changed files
with
10,226 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Data Hub In a Box - Quick Start | ||
|
||
Quick Start is a single-page web application that is deployed in an embedded Tomcat. | ||
|
||
## Configuring the Tomcat server port and web app context path | ||
- edit application.properties file and edit server.port and server.contextPath | ||
|
||
## Build and deploy the web app via command line | ||
- run ```gradle build``` | ||
- run ```java -jar build/libs/quick-start-0.1.0.war``` | ||
|
||
## Build and deploy the web app via Eclipse | ||
- Select Application.java then Run as Java Application | ||
|
||
## Go to the main page | ||
- The main page is accessible at http://localhost:[server.port]/[server.contextPath]. | ||
- If server.port is 8080 and server.contextPath is /quick-start in application.properties, go to http://localhost:8080/quick-start and you will see the main page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
quick-start/src/main/java/com/marklogic/hub/config/EnvironmentConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.marklogic.hub.config; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.stereotype.Component; | ||
|
||
/*** | ||
* | ||
* @author mturiana | ||
* This class is used to get the value of the keys in application.properties | ||
*/ | ||
@Component | ||
public class EnvironmentConfiguration { | ||
|
||
@Autowired | ||
private Environment environment; | ||
|
||
public String getServerPort() { | ||
return this.environment.getProperty("server.port"); | ||
} | ||
|
||
|
||
} |
34 changes: 34 additions & 0 deletions
34
quick-start/src/main/java/com/marklogic/hub/web/MainPageController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.marklogic.hub.web; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import com.marklogic.hub.config.EnvironmentConfiguration; | ||
|
||
@Controller | ||
public class MainPageController { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(MainPageController.class); | ||
|
||
@Autowired | ||
private EnvironmentConfiguration environmentConfiguration; | ||
|
||
@RequestMapping(value = "/", method = RequestMethod.GET) | ||
public String getHomePage(Model model) { | ||
LOGGER.debug("Loading home page from port " + environmentConfiguration.getServerPort()); | ||
return "index"; | ||
} | ||
|
||
@RequestMapping(value = "/deployToMarkLogic", method = RequestMethod.POST) | ||
public String deployToMarkLogic(Model model) { | ||
return "redirect:/"; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Spring embedded tomcat config. Does not apply when war file is deployed on external Tomcat. | ||
server.port=8080 | ||
server.contextPath=/quick-start | ||
spring.thymeleaf.cache=true | ||
logging.level.com.marklogic.hub: DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
app.title=Data Hub in a Box | ||
app.footer=©2016. Data Hub in a Box. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="templates/base-template"> | ||
<head> | ||
</head> | ||
<body> | ||
<section layout:fragment="content"> | ||
<div id="message-div" class="row"></div> | ||
<div class="row"> | ||
<div class="col-md-3 text-right"> | ||
<form th:action="@{/deployToMarkLogic}" method="post"> | ||
<button type="submit" class="btn btn-secondary">Deploy to MarkLogic</button> | ||
</form> | ||
</div> | ||
</div> | ||
</section> | ||
</body> | ||
</html> |
30 changes: 30 additions & 0 deletions
30
quick-start/src/main/webapp/WEB-INF/pages/templates/base-template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title th:text="#{app.title}"></title> | ||
<link th:href="@{/static/lib/bootstrap-3.3.6-dist/css/bootstrap.min.css}" rel="stylesheet"></link> | ||
<link th:href="@{/static/css/quick-start.css}" rel="stylesheet"></link> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | ||
<script th:src="@{/static/lib/bootstrap-3.3.6-dist/js/bootstrap.min.js}"></script> | ||
<script th:src="@{/static/js/quick-start.js}"></script> | ||
</head> | ||
<body> | ||
<div id="header" class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-xs-8 col-sm-8 col-md-8"><h1 id="sitename" th:text="#{app.title}"></h1></div> | ||
</div> | ||
</div> | ||
<div class="alert alert-error alert-danger" role="alert" th:if="${#fields.hasErrors('*')} " th:each="err : ${#fields.errors('*')}" th:text="${err}"></div> | ||
|
||
<section id="content" class="container-fluid" layout:fragment="content"></section> | ||
|
||
<div id="footer" class="container-fluid"> | ||
<span th:utext="#{app.footer}"></span> | ||
</div> | ||
|
||
<div layout:fragment="page-script" th:remove="tag"></div> | ||
|
||
</body> | ||
</html> |
29 changes: 29 additions & 0 deletions
29
quick-start/src/main/webapp/WEB-INF/static/css/quick-start.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
div#header { | ||
background-color: #404040; | ||
border: 1px solid #909090; | ||
padding: 5px 15px; | ||
color: #ffffff; | ||
} | ||
|
||
#sitename { | ||
color: #ffffff; | ||
font-size: 25px; | ||
font-weight: 400; | ||
margin: 0px; | ||
color: #FFF; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-transform: uppercase; | ||
} | ||
|
||
#content { | ||
min-height: 450px; | ||
padding: 10px; | ||
} | ||
|
||
#footer { | ||
font-size: 12px; | ||
text-align: center; | ||
} | ||
|
Empty file.
Oops, something went wrong.