50
Let’s serve your data Frank van der Linden

Servlets made easy. Write once and run everywhere

Embed Size (px)

Citation preview

Page 1: Servlets made easy. Write once and run everywhere

Let’s serve your dataFrank van der Linden

Page 2: Servlets made easy. Write once and run everywhere

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

Roadmap• Theory

• Prepare

• Set up

• Develop

• Test

• Deploy

3

Page 4: Servlets made easy. Write once and run everywhere

Theory

Page 5: Servlets made easy. Write once and run everywhere

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

Structure and architecture

6

Page 7: Servlets made easy. Write once and run everywhere

Lifecycle

7

Page 8: Servlets made easy. Write once and run everywhere

XAgent - a sort of servlet

8

Page 9: Servlets made easy. Write once and run everywhere

Servlet in NSF• excellent series of Eric McCormick

• https://edm00se.io/servlet-series/

9

Page 10: Servlets made easy. Write once and run everywhere

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

OSGi architecture

11

Page 12: Servlets made easy. Write once and run everywhere

Prepare

Page 13: Servlets made easy. Write once and run everywhere

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

Develop

Page 15: Servlets made easy. Write once and run everywhere

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

my goals

16

Page 17: Servlets made easy. Write once and run everywhere

Shared plugin

17

Page 18: Servlets made easy. Write once and run everywhere

Domino - Servlet

18

Page 19: Servlets made easy. Write once and run everywhere

Web app - Servlet

19

Page 20: Servlets made easy. Write once and run everywhere

show some code

Page 21: Servlets made easy. Write once and run everywhere

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

Logging• ….log to a file, by adding a (File) handler

22

Page 23: Servlets made easy. Write once and run everywhere

Test

Page 24: Servlets made easy. Write once and run everywhere

Test

24

Page 25: Servlets made easy. Write once and run everywhere

Test

25

Page 26: Servlets made easy. Write once and run everywhere

Test

26

Page 27: Servlets made easy. Write once and run everywhere

Test

• tell http quit

• load http

27

Page 28: Servlets made easy. Write once and run everywhere

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

Deploy

Page 30: Servlets made easy. Write once and run everywhere

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

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

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

Deploy to web app

33

Page 34: Servlets made easy. Write once and run everywhere

let’s deploy it

Page 35: Servlets made easy. Write once and run everywhere

35

Page 36: Servlets made easy. Write once and run everywhere

Thank you

36

https://bitbucket.org/flinden68/lets-serve-your-data

Page 37: Servlets made easy. Write once and run everywhere

Appendix A

Page 38: Servlets made easy. Write once and run everywhere

Target platform

38

Page 39: Servlets made easy. Write once and run everywhere

Target platform

39

Page 40: Servlets made easy. Write once and run everywhere

Target platform

40

Page 41: Servlets made easy. Write once and run everywhere

PDE plugin

41

Page 42: Servlets made easy. Write once and run everywhere

PDE plugin

42

Page 43: Servlets made easy. Write once and run everywhere

PDE plugin

43

Page 44: Servlets made easy. Write once and run everywhere

com.ibm.notes.java.api

44

Page 45: Servlets made easy. Write once and run everywhere

Appendix B

Page 46: Servlets made easy. Write once and run everywhere

OSGi Plugin set up

46

Page 47: Servlets made easy. Write once and run everywhere

OSGi Plugin set up (servlet)

47

Page 48: Servlets made easy. Write once and run everywhere

OSGi Plugin set up (servlet)

48

Page 49: Servlets made easy. Write once and run everywhere

OSGi Plugin set up (servlet)

49

Page 50: Servlets made easy. Write once and run everywhere

Web app set up

50