Skip to content

Instantly share code, notes, and snippets.

@zankard
Last active October 5, 2016 14:41
Show Gist options
  • Save zankard/306bc5a54ba1c5ac3f460b5a6f5c74f3 to your computer and use it in GitHub Desktop.
Save zankard/306bc5a54ba1c5ac3f460b5a6f5c74f3 to your computer and use it in GitHub Desktop.
servlet&jsp puml
@startdot
digraph foo {
container [shape=box]
servlet [fillcolor=grey, style="filled", shape=hexagon]
clientA [shape=box, color=gray58, style="filled"]
clientB [shape=box, color=gray58, style="filled"]
threadA [shape=ellipse, color=gray90, style="filled"]
threadB [shape=ellipse, color=gray90, style="filled"]
response1 [shape=point]
request1 [shape=point]
request2 [shape=point]
response2 [shape=point]
clientA -> container
clientB -> container
clientA -> servlet [style=invis]
clientB -> servlet [style=invis]
container -> servlet
servlet -> threadA
servlet -> threadB
threadA -> response1 [arrowhead="none", headlabel="response"]
response1 -> clientA [style="dashed", arrowhead="vee"]
threadA -> request1 [arrowhead="none", headlabel="request"]
threadB -> request2 [arrowhead="none", headlabel="request"]
threadB -> response2 [arrowhead="none", headlabel="response"]
response2 -> clientB [style="dashed", arrowhead="vee"]
overlap=false
}
@enddot
@startuml
skinparam state {
StartColor MediumBlue
EndColor Red
BackgroundColor<<1>> Olive
BorderColor Gray
}
state "does not exist" as NotExist <<1>>
state "initialized" as Initialized <<1>>
[*] --> NotExist
NotExist --> [*]
NotExist -> Initialized : constructor init()
Initialized -> Initialized : service
Initialized -> NotExist : destory
@enduml
@startuml
hide footbox
participant "Web Container" as container
participant "Servlet Class" as class
participant "Servlet Object" as object
create class
container -> class : Load class
create object
container -> object : Instantiate servlet(constructor runs)
container -> object : init()
note right: called only once
container -> object : service()
note right: handle client requests
container -> object : destroy()
@enduml
@startuml
namespace javax.servlet {
interface Servlet
abstract class GenericServlet
Servlet <|-- GenericServlet
interface ServletRequest
interface ServletResponse
}
namespace javax.servlet.http {
abstract class HttpServlet {
#void service(HttpServletRequest request, HttpServletResponse response)
}
javax.servlet.GenericServlet <|-- HttpServlet
interface HttpServletRequest
javax.servlet.ServletRequest <|- HttpServletRequest
interface HttpServletResponse
javax.servlet.ServletResponse <|- HttpServletResponse
interface HttpSession
class Cookie
}
@enduml
@startuml
namespace javax.servlet {
interface Servlet {
void init(ServletConfig config)
void service(ServletRequest request, ServletResponse response)
void destroy()
}
abstract class GenericServlet
Servlet <|-- GenericServlet
interface ServletRequest
interface ServletResponse
interface SerlvetContext
interface ServletConfig
interface RequestDispatcher
interface Filter
}
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment