What Is New and Noteworthy in Jersey Miroslav Fuksa, Jakub Podlešák Software Developers Oracle, Application Server Group October 1, 2014 Copyright ©

Slides:



Advertisements
Similar presentations
Enhancing Productivity with MySQL 5.6 New Features
Advertisements

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Your customer as a segment of one That changes every second! Hein Van Der Merwe Chief.
Jim Ferrentino Elizabeth West
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer Tips & Tricks Jeff Smith
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
Oracle Cloud Marketplace Neelesh Gurnani Director, Product Development Arif Khan Director, Product Management September 29, 2014 Copyright © 2014, Oracle.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer What’s New in Version 4.1 Jeff Smith
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Advanced Metadata Modeling Modeling for the Oracle Business Intelligence Cloud.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer For the DBA Jeff Smith
First Programming Steps in Oracle ADF: Beyond Drag and Drop Grant Ronald Director of Product Management Mobility and Development Tools October, 2014 Copyright.
The Safe Harbor The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated.
Best Practices for Supporting Oracle Hyperion EPM and Business Intelligence Solutions Mitra Veluri Senior Principal Technical Support Engineer David Valociek.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Title Slide without Picture Subtitle Presenter’s Name Presenter’s Title Organization,
Discover the Latest in Partner Training for Solutions Specialists Ian Reed Sr. Director, Partner Enablement Dana Hutanu Director, Partner Enablement WWA&C.
2 2 The following is intended to outline our general product direction. It is intended for informational purposes only, and may not be incorporated into.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit The Newest JDE Module – Rental Management Joel Sandberg Sales Consultant.
QAD .Net UI: New Enhancements
Getting Started with Oracle Compute Cloud
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit PaaS from an Applications Perspective Charles McGuinness Director,
Oracle Confidential – Internal/Restricted/Highly RestrictedCopyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Identity Management.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Reporting from Contract.
Oracle E-Business Suite Order Management: Presenting the HTML and Mobile User Experience Durgaprasad Bodapati Director, Product Management Bhavana Sharma.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. An Auto-Join Network of Things Wong, H. and Wesson, B. Oracle Confidential – Internal/Restricted/Highly.
Extending ArcGIS for Server
© 2012 Autodesk Implementing Cloud-Based Productivity Solutions with the AutoCAD® ObjectARX® API Ravi Krishnaswamy Senior Software Architect.
Hadoop 2 cluster with Oracle Solaris Zones, ZFS and unified archives Orgad Kimchi - Principal Software Engineer September 29, 2014 Oracle Confidential.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Contract Management.
Learning Oracle ADF Grant Ronald Director of Product Management Mobility and Development Tools September, 2014 Copyright © 2014, Oracle and/or its affiliates.
CON Software-Defined Networking in a Hybrid, Open Data Center Krishna Srinivasan Senior Principal Product Strategy Manager Oracle Virtual Networking.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit Preview the Plans for JD Edwards World A9.4 Release David Greiner,
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit Really Cool Demo Stuff – 2015 Edition!!!!! For demo content, please.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Build Mobile Apps for Oracle E-Business Suite with Oracle Mobile Platform Bruce Bailey Principal Mobile/Social Solutions Consultant Jagadeesh Maira Senior.
RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Planning & Budgeting Cloud Service (PBCS) Overview Business Analytics Product Group.
WebCenter in Education & Research A Transformation in Digital Business Session: CON7709 Golden Gate C3 Room, Marriott Marquis Moderator: Kevin Roebuck,
ICM – API Server & Forms Gary Ratcliffe.
Click to add text © 2012 IBM Corporation 1 InfoSphere Streams Streams Console Applications InfoSphere Streams Version 3.0 Warren Acker InfoSphere Streams.
Industry specific cover image Girish Jashnani What’s new in R12 – A technology perspective Jan 17 th 2007.
Performance/Scalability with JDBC, UCP & Oracle Database 12c
Travel and Transportation General Session and Industry Excellence Awards Vijay Anand, Oracle Sundar Swaminathan, Oracle September 30, 2014 Copyright ©
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 5 Lifehacks for the Apex Development environment Five frameworks you should use.
CON8473 – Oracle Distribution of OpenStack Ronen Kofman Director of Product Management Oracle OpenStack September, 2014 Copyright © 2014, Oracle and/or.
Slide 1. What's New in NetBeans IDE 7.1 Name Title.
Oracle Java Cloud Service Oracle Develop July 2013.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | PeopleSoft Order Management Pricing Managers: Have We Got Tools for You Oracle Confidential.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | What You Need to Know About User Defined Objects (UDOs) With Tools Release 9.2.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Daddy, what's a middle wear? An incredibly oversimplified explanation of what Middleware.
OpenWorld 2018 How to Create Chatbots with OMCe
Flight Recorder in OpenJDK
OpenWorld 2018 How to Combine Data from Source Sites
Charles Phillips screen
JD Edwards Support and Oracle Cloud Infrastructure: A Successful Path to Oracle Cloud
WEB API.
QAD Reporting Framework
Project Helidon Deep Dive
Confidential – Oracle Internal/Restricted/Highly Restricted
Confidential – Oracle Internal/Restricted/Highly Restricted
Office 365 Development.
TechEd /22/2019 9:22 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
1.
Oracle Java SE Subscriptions; Protect Your Investment in Java SE
IXP FilterCheck A New Route Analysis Tool for IXPs
Presentation transcript:

What Is New and Noteworthy in Jersey Miroslav Fuksa, Jakub Podlešák Software Developers Oracle, Application Server Group October 1, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 4

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Goals of The Presentation To demonstrate some lesser-known features To show you new additions to Jersey project 5

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Jersey 2 Primer Jersey 2 provides reference implementation of JAX-RS 2.0 Included in GlassFish 4.x And in WebLogic (Jersey 2 as a shared library) Provides ouf-the-box support for other containers 2.13 is the actual version (released this Monday) 6

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Agenda Async Server-Side Support Reactive/Async Client Security (OAuth 2) Light-weight Container Support Jersey Test Framework (TestNG Support ) Monitoring and Tracing 7

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Async Server-side Support 8

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. When To Go Async on The Server Side? Resource method processing takes a “long time” – Waiting for other backend resources, i/o, disk, db, … – Blocking i/o selector thread that could be utilized by other connections otherwise From a single user perspective, going from sync to async does not change anything! Async is important when concurrent clients compete for I/O threads 9

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Two methods to off-load I/O threads Standard AsyncResponse 10

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. JAX-RS Standard Way ExecutorService exec public void final AsyncResponse final String id) { exec.submit(new Runnable(){ public void run() { response.resume(db.get(id)); } }); } 11

Copyright © 2014, Oracle and/or its affiliates. All public void final AsyncResponse final String id) { response.resume(db.get(id)); } 12

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Reactive/Async Client 13

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Reactive programming 14

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Example Travel agency – Travel to new destinations, get recommendations, forecast and price calculation Orchestration layer with Jersey client 15

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16 Orchestration layer (web app with Jersey client) Visited location Recommended locations Forecast calculation Price calculation Mobile app / Web app

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17 Visited Recommended destination Price calculation Forecast Recommendations Agent Response Request

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Reactive Approach RxJava – Observable Java 8 – CompletionStage and CompletableFuture JSR166e – CompletableFuture (JDK6, JDK7) Guava – ListenableFuture and Futures Libraries 18

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Resources JAX-RS Client API – – Jersey Rx Client – – – – – JAX-RS and Jersey 19

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Resources 3 rd party libraries – – – – Example (JDK7) – Netflix blog post about RxJava – Example and Libraries 20

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth 2 21

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth: introduction username/password Consumer Service Provider Resource owner username/password ?

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth 2: Authorization Code Grant Flow 1 Authorization Request 2 Resource owner authorization 3 Authorization Response 4 Access Token 5 Refreshing Token Consumer Service Provider Resource owner 5, 6, …

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth 2: Authenticated Requests Access Token Consumer Service Provider Resource owner GET /api/students/mfuksa HTTP/1.1 User-Agent: curl/ Host: example-university.com Accept: application/json Authorization: bearer jkr3ljkh3jk

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth support in Jersey OAuth OAuth 1 – Published in 2010 – Signatures added to requests (HMAC-SHA1, RSA-SHA1) based on secret keys OAuth 2 – Published in 2012 – Not backward compatible – Easier for implementation – OpenID connect 25

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth support in Jersey Jersey and OAuth OAuth in Jersey – OAuth 1 (including 2-legged OAuth support) Client Server – OAuth 2 (Authorization Code Grant Flow) Client Server [in progress] 26

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth support in Jersey Jersey client 27 OAuth2ClientSupport OAuth2CodeGrantFlow Authentication Feature String start(); TokenResult finish(); Client Request/Response Filter (Access Token) Registers Access Token User Authorization Authorization Flow tool Authenticated requests No Access Token yet

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. OAuth: demo Consumer Service Provider Resource owner Jersey sample oauth2-client-google-webapp Google APIs Access Token

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Jersey Test Framework 29

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Jersey Test Framework Based on JUnit Support for TestNG available Multiple container support – Grizzly – In memory – Java SE Http Server – Jetty – External container support 30

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. External Test Container You can test any (already running) REST application No need to have Jersey on the other side Use the following parameters: mvn test \ -Djersey.config.test.container.factory=org.glassfish.jersey.test.external.ExternalTestContainerFactory \ -Djersey.test.host=localhost -Djersey.config.test.container.port=

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. TestNG Support Predefined test types – JerseyTestNg.ContainerPerClassTest – JerseyTestNg.ContainerPerMethodTest Extend JerseyTestNg to define your own strategy 32

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Lightweight Container Support 33

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Grizzly HTTP Server Support URI AppURI = URI.create(" HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer( AppURI, new JaxRsApplication()); 34

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Grizzly HTTP Server Support – Thread Pool Config HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(AppURI, new JaxRsApplication(), false); NetworkListener grizzlyListener = httpServer.getListener("grizzly"); grizzlyListener.getTransport().setSelectorRunnersCount(4); grizzlyListener.getTransport().setWorkerThreadPoolConfig( ThreadPoolConfig.defaultConfig().setCorePoolSize(16).setMaxPoolSize(16)); httpServer.start(); 35

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Other supported containers Simple HTTP Server Jetty HTTP Container (Jetty Server Handler) Java SE HTTP Server (HttpHandler) Other containers could be plugged in via org.glassfish.jersey.server.spi.ContainerProvider SPI 36

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring And Tracing 37

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring and Tracing of Jersey applications Default settings – Log level to INFO Jersey does not log exceptions thrown from request processing by default (FINE level) – No tracing – No monitoring 38

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring and Tracing of Jersey applications Logging How to change log level – JDK logging – Add jdk.logging properties – Define path to the logging.properties file as env variable java.util.logging.config.file logging.properties: 39 #All attributes details handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=FINE java.util.logging.SimpleFormatter.format=%4$-7s [%3$s] %5$s%6$s%n #All log level details.level=INFO org.glassfish.jersey.level=FINE org.glassfish.jersey.tracing.level=FINE

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring and Tracing of Jersey applications Tracing Helps to answer questions: – Why my Message Body Writer was not used? – Which Filters and Interceptors were used? – What takes too long in the processing? – Why the resource method was not matched? Levels of tracing – SUMMARY, TRACE, VERBOSE Modes – log file, HTTP response headers 40

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Monitoring and Tracing of Jersey applications Monitoring Event listeners – Application events (start, reload, stop) – Request events (method started, exception mapped, …) Monitoring statistics – Contains time and application statistics – Inject statistics into your resources, providers – Expose statistics as MBeans 41

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Q/A Visit for more details!

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. THANK YOU!