├── .classpath
├── .gitignore
├── .project
├── Dockerfile
├── Jenkinsfile
├── Jenkinsfile_1.0
├── Jenkinsfile_Docker_Local
├── Jenkinsfile_Docker_Remote
├── README.md
├── pom.xml
└── src
└── main
├── java
└── com
│ └── ranjitswain
│ └── HelloWorldBacking.java
├── log4j
└── log4j.properties
└── webapp
├── WEB-INF
├── examples-config.xml
└── web.xml
├── helloWorld.xhtml
├── index.jsp
├── page2.xhtml
└── template.xhtml
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .git
2 | .settings
3 | target/
4 | *.war
5 | *.ini
6 | *.cnf
7 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | devOpsWeb
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.common.project.facet.core.builder
15 |
16 |
17 |
18 |
19 | org.eclipse.wst.validation.validationbuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.m2e.core.maven2Builder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.jem.workbench.JavaEMFNature
31 | org.eclipse.wst.common.modulecore.ModuleCoreNature
32 | org.eclipse.jdt.core.javanature
33 | org.eclipse.m2e.core.maven2Nature
34 | org.eclipse.wst.common.project.facet.core.nature
35 | org.eclipse.wst.jsdt.core.jsNature
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM tomcat:8.0
2 |
3 | ADD ./target/*.war /usr/local/tomcat/webapps/
4 |
5 | EXPOSE 8080
6 |
7 | WORKDIR /usr/local/tomcat/webapps/
8 |
9 | CMD ["catalina.sh", "run"]
10 |
11 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline {
2 | agent any
3 |
4 | tools {
5 | maven 'local_maven'
6 | }
7 | parameters {
8 | string(name: 'staging_server', defaultValue: '13.232.37.20', description: 'Remote Staging Server')
9 | }
10 |
11 | stages{
12 | stage('Build'){
13 | steps {
14 | sh 'mvn clean package'
15 | }
16 | post {
17 | success {
18 | echo 'Archiving the artifacts'
19 | archiveArtifacts artifacts: '**/target/*.war'
20 | }
21 | }
22 | }
23 |
24 | stage ('Deployments'){
25 | parallel{
26 | stage ("Deploy to Staging"){
27 | steps {
28 | sh "scp -v -o StrictHostKeyChecking=no **/*.war root@${params.staging_server}:/opt/tomcat/webapps/"
29 | }
30 | }
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Jenkinsfile_1.0:
--------------------------------------------------------------------------------
1 | pipeline {
2 | agent any
3 |
4 | tools {
5 | maven 'localMaven'
6 | }
7 | parameters {
8 | string(name: 'tomcat_stag', defaultValue: '13.59.108.184', description: 'Node1-Remote Staging Server')
9 | string(name: 'tomcat_prod', defaultValue: '18.219.228.98', description: 'Node2-Remote Production Server')
10 | }
11 |
12 | triggers {
13 | pollSCM('* * * * *')
14 | }
15 |
16 | stages{
17 | stage('Build'){
18 | steps {
19 | sh 'mvn clean package'
20 | }
21 | post {
22 | success {
23 | echo 'Archiving the artifacts'
24 | archiveArtifacts artifacts: '**/target/*.war'
25 | }
26 | }
27 | }
28 |
29 | stage ('Deployments'){
30 | parallel{
31 | stage ('Deploy to Staging'){
32 | steps {
33 | sh "scp **/*.war jenkins@${params.tomcat_stag}:/usr/share/tomcat/webapps/"
34 | }
35 | }
36 |
37 | stage ("Deploy to Production"){
38 | steps {
39 | sh "scp **/*.war jenkins@${params.tomcat_prod}:/usr/share/tomcat/webapps/"
40 | }
41 | }
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Jenkinsfile_Docker_Local:
--------------------------------------------------------------------------------
1 | pipeline{
2 | agent any
3 | tools {
4 | maven 'localMaven'
5 | }
6 | stages{
7 | stage('Build'){
8 | steps{
9 | sh 'mvn clean package'
10 | sh "docker build . -t tomcatwebapp:${env.BUILD_ID}"
11 | }
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Jenkinsfile_Docker_Remote:
--------------------------------------------------------------------------------
1 | pipeline{
2 | agent any
3 | tools {
4 | maven 'localMaven'
5 | }
6 | stages{
7 | stage('Build'){
8 | steps{
9 | sh 'mvn clean package'
10 | sh 'scp Dockerfile centos@3.17.61.170'
11 | sh 'ssh centos@3.17.61.170 "docker build . -t tomcatwebapp:${env.BUILD_ID}"'
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Instructions
2 | This JAVA application supports Java 1.8 version
3 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 | 4.0.0
7 | com.ranjitswain
8 | devOpsWeb
9 | war
10 | 1.0-SNAPSHOT
11 | A custom project using myfaces 1.2 and facelets
12 | http://www.myorganization.org
13 |
14 |
15 | 1.2.10
16 | 1.2_15
17 | 6.1.22
18 | 1.2.13
19 | UTF-8
20 | UTF-8
21 |
22 |
23 |
24 |
25 | org.apache.maven.plugins
26 | maven-jxr-plugin
27 | 2.3
28 |
29 |
30 |
31 |
32 | devOpsWeb
33 |
34 |
35 |
36 | org.mortbay.jetty
37 | maven-jetty-plugin
38 | ${maven.jetty.plugin.version}
39 |
40 | 10
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | myfaces
49 |
50 |
51 | !jsf
52 |
53 |
54 |
55 |
56 | org.apache.myfaces.core
57 | myfaces-api
58 | ${jsf-myfaces.version}
59 | compile
60 |
61 |
62 | org.apache.myfaces.core
63 | myfaces-impl
64 | ${jsf-myfaces.version}
65 | runtime
66 |
67 |
68 |
69 |
70 |
71 | jsf-ri
72 |
73 |
74 | jsf
75 | ri
76 |
77 |
78 |
79 |
80 | javax.faces
81 | jsf-api
82 | ${jsf-ri.version}
83 | compile
84 |
85 |
86 | javax.faces
87 | jsf-impl
88 | ${jsf-ri.version}
89 | runtime
90 |
91 |
92 |
93 |
94 | java.net
95 | http://download.java.net/maven/1
96 | legacy
97 |
98 |
99 |
100 |
101 |
102 |
104 | jettyConfig
105 |
106 |
107 |
108 | src/main/resources
109 |
110 |
111 | src/main/log4j
112 |
113 |
114 |
115 |
116 |
117 | org.mortbay.jetty
118 | maven-jetty-plugin
119 | ${maven.jetty.plugin.version}
120 |
121 | 10
122 |
123 |
124 | org.apache.commons.logging.Log
125 | org.apache.commons.logging.impl.Log4JLogger
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | log4j
135 | log4j
136 | ${log4j.version}
137 | jar
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | org.apache.myfaces.tomahawk
148 | tomahawk12
149 | 1.1.9
150 | runtime
151 |
152 |
153 |
154 | javax.servlet
155 | jstl
156 | 1.2
157 | runtime
158 |
159 |
160 |
161 | com.sun.facelets
162 | jsf-facelets
163 | 1.1.14
164 |
165 |
166 | junit
167 | junit
168 | 4.0
169 | test
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/src/main/java/com/ranjitswain/HelloWorldBacking.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ranjitswain;
20 |
21 | /**
22 | * A typical simple backing bean, that is backed to devOps.jsp
23 | *
24 | * @author Matthias We�endorf
25 | */
26 | public class HelloWorldBacking
27 | {
28 |
29 | //properties
30 | private String name;
31 |
32 | /**
33 | * default empty constructor
34 | */
35 | public HelloWorldBacking()
36 | {
37 | }
38 |
39 | //-------------------getter & setter
40 | public String getName()
41 | {
42 | return name;
43 | }
44 |
45 | public void setName(String name)
46 | {
47 | this.name = name;
48 | }
49 |
50 | /**
51 | * Method that is backed to a submit button of a form.
52 | */
53 | public String send()
54 | {
55 | //do real logic
56 | return ("success");
57 | }
58 | }
--------------------------------------------------------------------------------
/src/main/log4j/log4j.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one or more
2 | # contributor license agreements. See the NOTICE file distributed with
3 | # this work for additional information regarding copyright ownership.
4 | # The ASF licenses this file to You under the Apache License, Version 2.0
5 | # (the "License"); you may not use this file except in compliance with
6 | # the License. You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | log4j.rootLogger=INFO, A1, A2
17 | log4j.appender.A1=org.apache.log4j.ConsoleAppender
18 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout
19 |
20 | #log on a file on target too, to make easier check it
21 | log4j.appender.A2=org.apache.log4j.RollingFileAppender
22 | log4j.appender.A2.File=target/log4j.log
23 | log4j.appender.A2.MaxFileSize=1000KB
24 | # Keep one backup file
25 | log4j.appender.A2.MaxBackupIndex=1
26 | log4j.appender.A2.layout=org.apache.log4j.PatternLayout
27 | log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n
28 |
29 | # Log level for myfaces libraries
30 | log4j.logger.org.apache.commons=INFO
31 | log4j.logger.org.apache.myfaces=TRACE
32 | log4j.logger.javax.faces=TRACE
33 |
34 | # Print the date in ISO 8601 format
35 | log4j.appender.A1.layout.ConversionPattern=%5p [%t] (%F\:%L) - %m%n
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/examples-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 | com.sun.facelets.FaceletViewHandler
11 |
12 |
13 |
14 |
15 | helloWorldBacking
16 |
17 | com.ranjitswain.HelloWorldBacking
18 |
19 | request
20 |
21 |
22 |
23 |
24 | /helloWorld.xhtml
25 |
26 | success
27 | /page2.xhtml
28 |
29 |
30 |
31 |
32 |
33 | /page2.xhtml
34 |
35 | back
36 | /helloWorld.xhtml
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
24 |
25 | MyProject web.xml
26 |
27 |
28 |
29 | org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
30 |
31 | true
32 |
33 |
34 |
35 |
36 | javax.faces.DEFAULT_SUFFIX
37 | .xhtml
38 |
39 |
40 |
41 |
42 | facelets.DEVELOPMENT
43 | true
44 |
45 |
46 |
47 |
48 | Comma separated list of URIs of (additional) faces config
49 | files. (e.g. /WEB-INF/my-config.xml) See JSF 1.0 PRD2,
50 | 10.3.2 Attention: You do not need to put
51 | /WEB-INF/faces-config.xml in here.
52 |
53 | javax.faces.CONFIG_FILES
54 | /WEB-INF/examples-config.xml
55 |
56 |
57 |
58 | State saving method: "client" or "server" (= default) See
59 | JSF Specification 2.5.3
60 |
61 | javax.faces.STATE_SAVING_METHOD
62 | client
63 |
64 |
65 |
66 | Only applicable if state saving method is "server" (=
67 | default). Defines the amount (default = 20) of the latest
68 | views are stored in session.
69 |
70 |
71 | org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
72 |
73 | 20
74 |
75 |
76 |
77 | Only applicable if state saving method is "server" (=
78 | default). If true (default) the state will be serialized to
79 | a byte stream before it is written to the session. If false
80 | the state will not be serialized to a byte stream.
81 |
82 |
83 | org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
84 |
85 | true
86 |
87 |
88 |
89 | Only applicable if state saving method is "server" (=
90 | default) and if
91 | org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (=
92 | default) If true (default) the serialized state will be
93 | compressed before it is written to the session. If false the
94 | state will not be compressed.
95 |
96 |
97 | org.apache.myfaces.COMPRESS_STATE_IN_SESSION
98 |
99 | true
100 |
101 |
102 |
103 | This parameter tells MyFaces if javascript code should be
104 | allowed in the rendered HTML output. If javascript is
105 | allowed, command_link anchors will have javascript code that
106 | submits the corresponding form. If javascript is not
107 | allowed, the state saving info and nested parameters will be
108 | added as url parameters. Default: "true"
109 |
110 | org.apache.myfaces.ALLOW_JAVASCRIPT
111 | true
112 |
113 |
114 | org.apache.myfaces.DETECT_JAVASCRIPT
115 | false
116 |
117 |
118 |
119 | If true, rendered HTML code will be formatted, so that it is
120 | "human readable". i.e. additional line separators and
121 | whitespace will be written, that do not influence the HTML
122 | code. Default: "true"
123 |
124 | org.apache.myfaces.PRETTY_HTML
125 | true
126 |
127 |
128 |
129 | If true, a javascript function will be rendered that is able
130 | to restore the former vertical scroll on every request.
131 | Convenient feature if you have pages with long lists and you
132 | do not want the browser page to always jump to the top if
133 | you trigger a link or button action that stays on the same
134 | page. Default: "false"
135 |
136 | org.apache.myfaces.AUTO_SCROLL
137 | true
138 |
139 |
140 |
141 |
142 | Used for encrypting view state. Only relevant for client
143 | side state saving. See MyFaces wiki/web site documentation
144 | for instructions on how to configure an application for
145 | diffenent encryption strengths.
146 |
147 | org.apache.myfaces.SECRET
148 | NzY1NDMyMTA=
149 |
150 |
151 |
152 |
153 | Validate managed beans, navigation rules and ensure that
154 | forms are not nested.
155 |
156 | org.apache.myfaces.VALIDATE
157 | true
158 |
159 |
160 |
161 |
162 | Treat readonly same as if disabled attribute was set for
163 | select elements.
164 |
165 |
166 | org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS
167 |
168 | true
169 |
170 |
171 |
172 |
173 | Use the defined class as the class which will be called when
174 | a resource is added to the ExtensionFilter handling. Using
175 | StreamingAddResource here helps with performance. If you
176 | want to add custom components and want to use the
177 | ExtensionFilter, you need to provide your custom
178 | implementation here.
179 |
180 | org.apache.myfaces.ADD_RESOURCE_CLASS
181 |
182 | org.apache.myfaces.renderkit.html.util.DefaultAddResource
183 |
184 |
185 |
186 |
187 |
188 | Virtual path in the URL which triggers loading of resources
189 | for the MyFaces extended components in the ExtensionFilter.
190 |
191 |
192 | org.apache.myfaces.RESOURCE_VIRTUAL_PATH
193 |
194 | /faces/myFacesExtensionResource
195 |
196 |
197 |
198 |
199 | Check if the extensions-filter has been properly configured.
200 |
201 |
202 | org.apache.myfaces.CHECK_EXTENSIONS_FILTER
203 |
204 | true
205 |
206 |
207 |
208 |
209 | Define partial state saving as true/false.
210 |
211 | javax.faces.PARTIAL_STATE_SAVING_METHOD
212 | false
213 |
214 |
215 |
216 |
217 | extensionsFilter
218 |
219 | org.apache.myfaces.webapp.filter.ExtensionsFilter
220 |
221 |
222 |
223 | Set the size limit for uploaded files. Format: 10 - 10
224 | bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
225 |
226 | uploadMaxFileSize
227 | 100m
228 |
229 |
230 |
231 | Set the threshold size - files below this limit are
232 | stored in memory, files above this limit are stored on
233 | disk.
234 |
235 | Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
236 |
237 | uploadThresholdSize
238 | 100k
239 |
240 |
241 |
242 |
243 | extensionsFilter
244 | *.jsf
245 |
246 |
247 | extensionsFilter
248 | /faces/*
249 |
250 |
251 |
252 |
253 | Faces Servlet
254 | javax.faces.webapp.FacesServlet
255 | 1
256 |
257 |
258 |
259 |
260 | Faces Servlet
261 | *.jsf
262 |
263 |
264 |
265 |
266 | index.jsp
267 | index.html
268 |
269 |
270 |
271 |
--------------------------------------------------------------------------------
/src/main/webapp/helloWorld.xhtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 | DevOps Class
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page session="false"%>
2 | <%
3 | response.sendRedirect("helloWorld.jsf");
4 | %>
--------------------------------------------------------------------------------
/src/main/webapp/page2.xhtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 | DevOps Class
9 |
10 |
11 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/webapp/template.xhtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 | App for DevOps Class
10 |
11 |
12 |
13 | DevOps class - Ranjit Swain - Version: 2.7.2 - Batch7
14 | Just an example! - Webhook
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------