SlideShare a Scribd company logo
1 of 24
Dropwizard (DW) Guts
=
Jetty
• Webserver and javax.Servlet container
• DW adds InstrumentedHandler
• DW register a Servlet which which wraps
JerseyContainer containing all your
Resources & ResourceMethods
• Wired in AbstractServerFactory
InstrumentedHandler
• Jetty Handler
• Handlers are chained together to process
request, generating a response
• Provides instrumentation around request
types, response code, and inflight status
Jersey Resource & ResourceMethod
Questions?
• What pre & post processing happens before
calling your ResourceMethod?
• How do you define that?
• How are arguments obtained to called your
method?
WebApplicationImpl
Contains a set of resources, each referenced by an absolute URI template
• Maintains a set of tuples <Path, Rule>
• Path matches request, Rule is applied
• Rule has a RequestDispatcher
• Rule has an instance of Resource, or constructs it
(depends on whether resource is added as singleton)
• Rule delegates to RequestDispatcher passing
resource and context
RequestDispatcher
public interface RequestDispatcher {
public void dispatch(Object resource, HttpContext context);
}
RequestDispatcher maybe chained together, “Decorating” functionality
How does DW chain dispatchers?
• Always: OptionalRequestDispatcher (if response == optional.absent -> return 404, else return 200 + body)
• @CacheControl: CacheControlledRequestDispatcher(add caching header)
• Instrumentation
• @Timed: TimedRequestDispatcher (time the rest of dispatch chain)
• @Metered: MeteredRequestDispatcher (meter thruput)
• @ExceptionMetered: ExceptionMeteredRequestDispatcher (meter exceptions)
• Always: *Invoker (extract args from HttpContext, reflectlively call ResourceMethod)
RequestDispatcher
• One root RequestDispatcher per
ResourceMethod
• ResourceMethod created once at initialization
• Every request to a ResourceMethod is
dispatched to the dispatcher, providing an
instance of the resource & HttpContext
TimedRequestDispatcher: @Timed
RequestDispatcher Impls
Metric Registry
• Singleton, per JVM
• All metrics are created and registered here
• Codahale.Metrics
@Timed, @Metered what do I get?
• Registers and captures metrics for your
annotated ResourceMethod
• Metrics collected determined by annotation
• Even without ResourceMethod annotations,
you get JVM and Jetty metrics because of
Dropwizard
@Timed instantaneous view
Metrics over time?
• You need a time series DB (Graphite)
• You need a graphing frontend (Graphite)
• You need to ship your data to the DB, you
have to configure a GraphiteReporter: background
thread periodically sending metrics to graphite
Graphite Sample
Extra: Graphite, Metrics
• Default, Reporter ships all metrics to Graphite
• Metrics are per JVM, Graphite can aggregate
• Custom metrics without annotations
• Graphite has an API, so custom dashboards
What is a Provider?
An interface used by a framework, where
various impls can be plugged in at runtime to
customize your experience
It’s as Jersey as Taylor Ham
Providers
• ResourceMethodDispatchProvider
• InjectableProvider
• InjectableValuesProvider
• MessageBodyReader
• MessageBodyWriter
ResourceMethodDispatchProvider
& Adapter
//Responsibility is creating a RequestDispatcher
public interface ResourceMethodDispatchProvider {
RequestDispatcher create(AbstractResourceMethod abstractResourceMethod);
}
//Responsibility is daisy chaining adapters
public interface ResourceMethodDispatchAdapter {
ResourceMethodDispatchProvider
adapt(ResourceMethodDispatchProvider provider);
}
ResourceMethodDispatchProvider
Default Jersey
ResourceMethodDispatchProviders
ResourceMethodDispatcherFactory, which is a ResourceMethodDispatchProvider
• Set of default ResourceMethodDispatchProviders which are iterated in order, calling create
• Provider can’t create RequestDispatcher, return null
• Continue until non null RequestDispatcher returned: *Invoker
//void return & params
[0] = {com.sun.jersey.server.impl.model.method.dispatch.VoidVoidDispatchProvider@5061}
//void return, params are HttpRequestContext.class, HttpResponseContext.class
[1] = {com.sun.jersey.server.impl.model.method.dispatch.HttpReqResDispatchProvider@5062}
//Consumes mimelist is multipart form-data
[2] = {com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider@5063}
//Non GET, delegates to AbstractResourceMethodDispatchProvider
[3] = {com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider@5064}
//Delegates to AbstractResourceMethodDispatchProvider
[4] = {com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider@5065}
AbstractResourceMethodDispatchProvider
Impls are required to create a InjectableValuesProvider from the
ResourceMethod which will be used to generate the argument list from the
HttpContext
Args are built by the InjectableValuesProvider by using it’s
List<AbstractHttpContextInjectable> to transform to to an array of
objects, by extracting a Typed object from the HttpContext
The a List<AbstractHttpContextInjectable> is generated by examining
each Parameter of the ResourceMethod, for each parameter the list of
InjectableProvider(s) in InjectableProviderFactory are examined
to see if the InjectableProvider can produce an Injectable. The first one
able to produce an Injectable is used
MessageBodyReader/Writer
• JacksonMessageBodyProvider from Jackson
• Enables using Jackson to parse request entities into
objects and generate response entities from objects
• Supports Jackson & JAXB annotations in that order
• Wired in AbstractServerFactory

More Related Content

What's hot

Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Ryan Cuprak
 
Distributed Eventing in OSGi
Distributed Eventing in OSGiDistributed Eventing in OSGi
Distributed Eventing in OSGiCarsten Ziegeler
 
Play + scala + reactive mongo
Play + scala + reactive mongoPlay + scala + reactive mongo
Play + scala + reactive mongoMax Kremer
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introductionSergii Fesenko
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3Zachary Klein
 
Inside Azure Diagnostics
Inside Azure DiagnosticsInside Azure Diagnostics
Inside Azure DiagnosticsMichael Collier
 
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphereAAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphereKevin Sutter
 
Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Andrzej Ludwikowski
 
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Codemotion
 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsJeff Prestes
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL UsersAll Things Open
 

What's hot (20)

Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)Batching and Java EE (jdk.io)
Batching and Java EE (jdk.io)
 
Distributed Eventing in OSGi
Distributed Eventing in OSGiDistributed Eventing in OSGi
Distributed Eventing in OSGi
 
Play + scala + reactive mongo
Play + scala + reactive mongoPlay + scala + reactive mongo
Play + scala + reactive mongo
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introduction
 
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven TomacJavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 
Inside Azure Diagnostics
Inside Azure DiagnosticsInside Azure Diagnostics
Inside Azure Diagnostics
 
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphereAAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?Event Sourcing - what could possibly go wrong?
Event Sourcing - what could possibly go wrong?
 
COScheduler
COSchedulerCOScheduler
COScheduler
 
JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...
JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...
JavaCro'14 - Using WildFly core to build high performance web server – Tomaž ...
 
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All Objects
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless World
 
Airflow and supervisor
Airflow and supervisorAirflow and supervisor
Airflow and supervisor
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL Users
 

Viewers also liked

Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011sullis
 
Java Microservices with DropWizard
Java Microservices with DropWizardJava Microservices with DropWizard
Java Microservices with DropWizardBruno Buger
 
Dropwizard at Yammer
Dropwizard at YammerDropwizard at Yammer
Dropwizard at YammerJamie Furness
 
Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Christopher Batey
 
Dropwizard and Groovy
Dropwizard and GroovyDropwizard and Groovy
Dropwizard and Groovytomaslin
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard IntroductionAnthony Chen
 
Metrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthMetrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthIzzet Mustafaiev
 
Production Ready Web Services with Dropwizard
Production Ready Web Services with DropwizardProduction Ready Web Services with Dropwizard
Production Ready Web Services with Dropwizardsullis
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices ArchitectureIzzet Mustafaiev
 
Simple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and SwaggerSimple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and SwaggerLeanIX GmbH
 
Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite Roberto Franchini
 
DockerCon SF 2015: Enabling Microservices @Orbitz
DockerCon SF 2015: Enabling Microservices @OrbitzDockerCon SF 2015: Enabling Microservices @Orbitz
DockerCon SF 2015: Enabling Microservices @OrbitzDocker, Inc.
 

Viewers also liked (16)

Dropwizard
DropwizardDropwizard
Dropwizard
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Java Microservices with DropWizard
Java Microservices with DropWizardJava Microservices with DropWizard
Java Microservices with DropWizard
 
Dropwizard at Yammer
Dropwizard at YammerDropwizard at Yammer
Dropwizard at Yammer
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014Fault tolerant microservices - LJC Skills Matter 4thNov2014
Fault tolerant microservices - LJC Skills Matter 4thNov2014
 
Microservices/dropwizard
Microservices/dropwizardMicroservices/dropwizard
Microservices/dropwizard
 
Dropwizard and Groovy
Dropwizard and GroovyDropwizard and Groovy
Dropwizard and Groovy
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard Introduction
 
Metrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ healthMetrics by coda hale : to know your app’ health
Metrics by coda hale : to know your app’ health
 
Production Ready Web Services with Dropwizard
Production Ready Web Services with DropwizardProduction Ready Web Services with Dropwizard
Production Ready Web Services with Dropwizard
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Simple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and SwaggerSimple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and Swagger
 
Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite
 
DockerCon SF 2015: Enabling Microservices @Orbitz
DockerCon SF 2015: Enabling Microservices @OrbitzDockerCon SF 2015: Enabling Microservices @Orbitz
DockerCon SF 2015: Enabling Microservices @Orbitz
 
Patterns of resilience
Patterns of resiliencePatterns of resilience
Patterns of resilience
 

Similar to Dropwizard Internals

J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentjoearunraja2
 
Web Technologies -- Servlets 4 unit slides
Web Technologies -- Servlets   4 unit slidesWeb Technologies -- Servlets   4 unit slides
Web Technologies -- Servlets 4 unit slidesSasidhar Kothuru
 
Java Servlets
Java ServletsJava Servlets
Java ServletsEmprovise
 
SCWCD : The servlet model : CHAP : 2
SCWCD  : The servlet model : CHAP : 2SCWCD  : The servlet model : CHAP : 2
SCWCD : The servlet model : CHAP : 2Ben Abdallah Helmi
 
SCWCD : The servlet model CHAP : 2
SCWCD : The servlet model CHAP : 2SCWCD : The servlet model CHAP : 2
SCWCD : The servlet model CHAP : 2Ben Abdallah Helmi
 
Dynamic content generation
Dynamic content generationDynamic content generation
Dynamic content generationEleonora Ciceri
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & MiddlewaresSantosh Wadghule
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteJava Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteTushar B Kute
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.pptkstalin2
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring SessionDavid Gómez García
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4Ben Abdallah Helmi
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentationnrjoshiee
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersKevin Hazzard
 

Similar to Dropwizard Internals (20)

J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environment
 
Web Technologies -- Servlets 4 unit slides
Web Technologies -- Servlets   4 unit slidesWeb Technologies -- Servlets   4 unit slides
Web Technologies -- Servlets 4 unit slides
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
SCWCD : The servlet model : CHAP : 2
SCWCD  : The servlet model : CHAP : 2SCWCD  : The servlet model : CHAP : 2
SCWCD : The servlet model : CHAP : 2
 
Servlets
ServletsServlets
Servlets
 
Node_basics.pptx
Node_basics.pptxNode_basics.pptx
Node_basics.pptx
 
SCWCD : The servlet model CHAP : 2
SCWCD : The servlet model CHAP : 2SCWCD : The servlet model CHAP : 2
SCWCD : The servlet model CHAP : 2
 
Dynamic content generation
Dynamic content generationDynamic content generation
Dynamic content generation
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & Middlewares
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B KuteJava Servlet Programming under Ubuntu Linux by Tushar B Kute
Java Servlet Programming under Ubuntu Linux by Tushar B Kute
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
 
SERVIET
SERVIETSERVIET
SERVIET
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
 
Jdbc presentation
Jdbc presentationJdbc presentation
Jdbc presentation
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Dropwizard Internals

  • 2. Jetty • Webserver and javax.Servlet container • DW adds InstrumentedHandler • DW register a Servlet which which wraps JerseyContainer containing all your Resources & ResourceMethods • Wired in AbstractServerFactory
  • 3. InstrumentedHandler • Jetty Handler • Handlers are chained together to process request, generating a response • Provides instrumentation around request types, response code, and inflight status
  • 4. Jersey Resource & ResourceMethod
  • 5. Questions? • What pre & post processing happens before calling your ResourceMethod? • How do you define that? • How are arguments obtained to called your method?
  • 6. WebApplicationImpl Contains a set of resources, each referenced by an absolute URI template • Maintains a set of tuples <Path, Rule> • Path matches request, Rule is applied • Rule has a RequestDispatcher • Rule has an instance of Resource, or constructs it (depends on whether resource is added as singleton) • Rule delegates to RequestDispatcher passing resource and context
  • 7. RequestDispatcher public interface RequestDispatcher { public void dispatch(Object resource, HttpContext context); } RequestDispatcher maybe chained together, “Decorating” functionality
  • 8. How does DW chain dispatchers? • Always: OptionalRequestDispatcher (if response == optional.absent -> return 404, else return 200 + body) • @CacheControl: CacheControlledRequestDispatcher(add caching header) • Instrumentation • @Timed: TimedRequestDispatcher (time the rest of dispatch chain) • @Metered: MeteredRequestDispatcher (meter thruput) • @ExceptionMetered: ExceptionMeteredRequestDispatcher (meter exceptions) • Always: *Invoker (extract args from HttpContext, reflectlively call ResourceMethod)
  • 9. RequestDispatcher • One root RequestDispatcher per ResourceMethod • ResourceMethod created once at initialization • Every request to a ResourceMethod is dispatched to the dispatcher, providing an instance of the resource & HttpContext
  • 12. Metric Registry • Singleton, per JVM • All metrics are created and registered here • Codahale.Metrics
  • 13. @Timed, @Metered what do I get? • Registers and captures metrics for your annotated ResourceMethod • Metrics collected determined by annotation • Even without ResourceMethod annotations, you get JVM and Jetty metrics because of Dropwizard
  • 15. Metrics over time? • You need a time series DB (Graphite) • You need a graphing frontend (Graphite) • You need to ship your data to the DB, you have to configure a GraphiteReporter: background thread periodically sending metrics to graphite
  • 17. Extra: Graphite, Metrics • Default, Reporter ships all metrics to Graphite • Metrics are per JVM, Graphite can aggregate • Custom metrics without annotations • Graphite has an API, so custom dashboards
  • 18. What is a Provider? An interface used by a framework, where various impls can be plugged in at runtime to customize your experience It’s as Jersey as Taylor Ham
  • 19. Providers • ResourceMethodDispatchProvider • InjectableProvider • InjectableValuesProvider • MessageBodyReader • MessageBodyWriter
  • 20. ResourceMethodDispatchProvider & Adapter //Responsibility is creating a RequestDispatcher public interface ResourceMethodDispatchProvider { RequestDispatcher create(AbstractResourceMethod abstractResourceMethod); } //Responsibility is daisy chaining adapters public interface ResourceMethodDispatchAdapter { ResourceMethodDispatchProvider adapt(ResourceMethodDispatchProvider provider); }
  • 22. Default Jersey ResourceMethodDispatchProviders ResourceMethodDispatcherFactory, which is a ResourceMethodDispatchProvider • Set of default ResourceMethodDispatchProviders which are iterated in order, calling create • Provider can’t create RequestDispatcher, return null • Continue until non null RequestDispatcher returned: *Invoker //void return & params [0] = {com.sun.jersey.server.impl.model.method.dispatch.VoidVoidDispatchProvider@5061} //void return, params are HttpRequestContext.class, HttpResponseContext.class [1] = {com.sun.jersey.server.impl.model.method.dispatch.HttpReqResDispatchProvider@5062} //Consumes mimelist is multipart form-data [2] = {com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider@5063} //Non GET, delegates to AbstractResourceMethodDispatchProvider [3] = {com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider@5064} //Delegates to AbstractResourceMethodDispatchProvider [4] = {com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider@5065}
  • 23. AbstractResourceMethodDispatchProvider Impls are required to create a InjectableValuesProvider from the ResourceMethod which will be used to generate the argument list from the HttpContext Args are built by the InjectableValuesProvider by using it’s List<AbstractHttpContextInjectable> to transform to to an array of objects, by extracting a Typed object from the HttpContext The a List<AbstractHttpContextInjectable> is generated by examining each Parameter of the ResourceMethod, for each parameter the list of InjectableProvider(s) in InjectableProviderFactory are examined to see if the InjectableProvider can produce an Injectable. The first one able to produce an Injectable is used
  • 24. MessageBodyReader/Writer • JacksonMessageBodyProvider from Jackson • Enables using Jackson to parse request entities into objects and generate response entities from objects • Supports Jackson & JAXB annotations in that order • Wired in AbstractServerFactory