servlets made easy. write once and run everywhere
TRANSCRIPT
![Page 1: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/1.jpg)
Let’s serve your dataFrank van der Linden
![Page 2: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/2.jpg)
About me• Freelance Java and front end developer
• Owner of Elstar IT
• Try to do some running and mountain biking
2
![Page 3: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/3.jpg)
Roadmap• Theory
• Prepare
• Set up
• Develop
• Test
• Deploy
3
![Page 4: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/4.jpg)
Theory
![Page 5: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/5.jpg)
What is a servlet• Java program to extends the capabilities of a server
• Servlets provide a component-based, platform-independent method for building Web-based applications
• Servlets run in web containers, Servlet containers
5
![Page 6: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/6.jpg)
Structure and architecture
6
![Page 7: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/7.jpg)
Lifecycle
7
![Page 8: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/8.jpg)
XAgent - a sort of servlet
8
![Page 9: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/9.jpg)
Servlet in NSF• excellent series of Eric McCormick
• https://edm00se.io/servlet-series/
9
![Page 10: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/10.jpg)
Servlet as OSGi plugin• run server wide
• Code can be shared with other processes like DOTS, XPages.
• With small changes, it run also on other Java servers, like Tomcat, WildFly(a.k.a. Boss) and Websphere
10
![Page 11: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/11.jpg)
OSGi architecture
11
![Page 12: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/12.jpg)
Prepare
![Page 13: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/13.jpg)
Prepare• Download IDE e.g. Eclipse JEE
• Set Target platform
• Install PDE Debug plugin
• Create com.ibm.notes.java.api project
13
*See Appendix A for steps to prepare your IDE
![Page 14: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/14.jpg)
Develop
![Page 15: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/15.jpg)
goals• Create a Shared code plugin
• Create a web app plugin which runs on a Java server
• Create a OSGi servlet which run on a Domino server
15
* See Appendix B for setup projects
![Page 16: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/16.jpg)
my goals
16
![Page 17: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/17.jpg)
Shared plugin
17
![Page 18: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/18.jpg)
Domino - Servlet
18
![Page 19: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/19.jpg)
Web app - Servlet
19
![Page 20: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/20.jpg)
show some code
![Page 21: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/21.jpg)
Logging• Build in via java.util.logging.Logger
• Log an error to the console….
21
![Page 22: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/22.jpg)
Logging• ….log to a file, by adding a (File) handler
22
![Page 23: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/23.jpg)
Test
![Page 24: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/24.jpg)
Test
24
![Page 25: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/25.jpg)
Test
25
![Page 26: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/26.jpg)
Test
26
![Page 27: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/27.jpg)
Test
• tell http quit
• load http
27
![Page 28: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/28.jpg)
Warning• After testing remove the pre.launch.ini from your workspace
directory of the Domino server
28
![Page 29: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/29.jpg)
Deploy
![Page 30: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/30.jpg)
Deploy• 2 ways of deployment to Domino
• as deployable jar
• as an update site.
• Add to web server
30
![Page 31: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/31.jpg)
As deployable jar• Export as deployable plugin…
• Put the jar in the correct directory on the server
• tell http quit —> load http
31
![Page 32: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/32.jpg)
As update site• Create Feature project, add plugin projects
• Create Update site project, add Feature project
• Add update site to update site database
• tell http quit —> load http
32
![Page 33: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/33.jpg)
Deploy to web app
33
![Page 34: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/34.jpg)
let’s deploy it
![Page 35: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/35.jpg)
35
![Page 36: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/36.jpg)
Thank you
36
https://bitbucket.org/flinden68/lets-serve-your-data
![Page 37: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/37.jpg)
Appendix A
![Page 38: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/38.jpg)
Target platform
38
![Page 39: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/39.jpg)
Target platform
39
![Page 40: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/40.jpg)
Target platform
40
![Page 41: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/41.jpg)
PDE plugin
41
![Page 42: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/42.jpg)
PDE plugin
42
![Page 43: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/43.jpg)
PDE plugin
43
![Page 44: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/44.jpg)
com.ibm.notes.java.api
44
![Page 45: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/45.jpg)
Appendix B
![Page 46: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/46.jpg)
OSGi Plugin set up
46
![Page 47: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/47.jpg)
OSGi Plugin set up (servlet)
47
![Page 48: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/48.jpg)
OSGi Plugin set up (servlet)
48
![Page 49: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/49.jpg)
OSGi Plugin set up (servlet)
49
![Page 50: Servlets made easy. Write once and run everywhere](https://reader033.vdocument.in/reader033/viewer/2022042723/58e536c81a28abac7e8b643b/html5/thumbnails/50.jpg)
Web app set up
50