Simple Spring MVC Application

Men at work 😉

<!DOCTYPE html>
<html>
<script type="text/javascript" src="node_modules/angular.min.js"></script>
<script type="text/javascript" src="node_modules/chart.js/Chart.js"></script>
<script type="text/javascript" src="node_modules/angular-chart.js/dist/angular-chart.js"></script>
<script type="text/javascript" src="app.js"></script>



<body ng-app="app">

<canvas id="base" class="chart-bar"
chart-data="data" chart-labels="labels" chart-colors="colors"
chart-dataset-override="datasetOverride">
</canvas>

</body>
</html>



Advertisements
Simple Spring MVC Application

Configure Java web-app to use Https

Steps:

>Create a sample web-app
> It’s all in web.xml

Create a sample web-app using maven, give the following command

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.test -DartifactId=simple-webapp -Dpackage=com.test -DarchetypeVersion=2.23.2

above command will create a simple jersey web project “simple-webapp”,
edit the web.xml under the WEB-INF directory, add the following lines just above </web-app> tag

<security-constraint>
    <web-resource-collection>
        <web-resource-name>jersey</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
Here <web-resource-name>jersey</web-resource-name> is the application context

navigate to simple-webapp directory and build the project using

mvn clean install -Dskiptests

deploy the the a war generated under target on tomcat

check if the browser accepts using

https://localhost:8443/jersey/webapi/myresource

Download the example from here

Add exception when your browser prompts, That’s it!
But above all you are required to configure your tomcat server.xml to accept https protocol, refer to this post

Configure Java web-app to use Https