1. The document examines advanced features of JAX-RS, the Java API for RESTful web services.
2. It discusses runtime resource resolution, integration with EJB and CDI, runtime content negotiation, conditional HTTP requests, dealing with type erasure, and pluggable exception handling in JAX-RS.
3. The presentation encourages the use of "Software. Hardware. Complete." as the new corporate tagline to replace "Oracle Is the Information Company."
Servlet architecture comes under a java programming language used to create dynamic web applications. Mainly servlets are used to develop server-side applications. Servlets are very robust and scalable. Before introducing servlets, CGI (common gateway interface) was used.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
JSF 2 Notes with coding examples topics include introduction , managed bean, jsf tags, navigation, jsf life cycle and phase listners,jsf validation and converters, i18n
JSP technology has facilitated the segregation of the work of a Web designer and a Web developer.
A Web designer can design and formulate the layout for the Web page by using HTML.
On the other hand, a Web developer working independently can use java code and other JSP specific tags to code the business logic.
The simultaneous construction of the static and dynamic content facilitates development of quality applications with increased productivity.
Servlet architecture comes under a java programming language used to create dynamic web applications. Mainly servlets are used to develop server-side applications. Servlets are very robust and scalable. Before introducing servlets, CGI (common gateway interface) was used.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
JSF 2 Notes with coding examples topics include introduction , managed bean, jsf tags, navigation, jsf life cycle and phase listners,jsf validation and converters, i18n
JSP technology has facilitated the segregation of the work of a Web designer and a Web developer.
A Web designer can design and formulate the layout for the Web page by using HTML.
On the other hand, a Web developer working independently can use java code and other JSP specific tags to code the business logic.
The simultaneous construction of the static and dynamic content facilitates development of quality applications with increased productivity.
CDI, Seam & RESTEasy: You haven't seen REST yet!Dan Allen
JSR-311 (JAX-RS) is one of the simplest, most elegant of all the Java EE specifications. It enables you to create RESTful web services from POJOs by sprinkling a handful of annotations on them. As of Java EE 6, JAX-RS resources can now tie into the rest of the Java EE platform through the use of the standard contexts and dependency injection.
facility (JSR-299: CDI).
Seam's RESTEasy module takes this a step further by allowing you to use JAX-RS annotations on your existing Seam components, giving your REST resources access to the Seam container, infusing them with enhanced security, persistence management and other Seam portable extensions. You'll also discover that Seam eliminates the configuration required to add JAX-RS to your application and you'll be enthralled by the module's innovative approach to doing CRUD over REST. Using Seam, CDI and JAX-RS together let's you REST like never before.
This presentation gives a high level concepts and more of code to take a stab at developing a simple Restful server. I targeted people who would like to build a simple RESTFul server from scratch and experiment.
The web has changed! Users spend more time on mobile than on desktops and they expect to have an amazing user experience on both platforms. APIs are the heart of the new web as the central point of access data, encapsulating logic and providing the same data and same features for desktops and mobiles.
In this talk, I will show you how in only 45 minutes we can create full REST API, with documentation and admin application build with React.
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...Neo4j
Nicki and Michael have recently been working together on the project to develop/upgrade the Spring Data Neo4j 3 (SDN) library to take advantage of some of the latest Neo4j 2.0 features. This talk takes a look at what can be expected of the new framework, and how it can be used to help model various different use cases with a simple Java domain model backed by a Neo4j database.
Building RESTful applications using Spring MVCIndicThreads
REST is an alternate and simpler approach for implementing WebServices. It is based on the HTTP protocol and hence leverages a lot of existing infrastructures. It uses an uniform interface thus making it easy to build client applications. In this session we will look at the fundamental concepts behind REST (Resource, URI, Stateless Conversation ..) and how to apply it in the context of a real applcation. We will also discuss the pros & cons of RESTful vs Soap based webservices. We will discuss the design of RESTful application and then look at how to implement it using Spring MVC.
Similar to S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010 (20)
5 Skills To Force Multiply Technical Talents.pdfArun Gupta
This talk explains what are non-technical skills, why they are relevant, and what are some of the most important skills to master to force multiply your technical talent.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
4. Architectural Style
• Music styles – baroque, romantic, rap, jazz, etc
– There is no Jazz (music) note
– How you put the notes that makes the style
• Computing styles – client/server, object oriented, etc.
– There is no client/server API
• “... a coordinated set of architectural constraints that
restricts the roles/features of architectural elements
and the allowed relationships among those elements
within any architecture that conforms to that style” -
Dr. Roy Fielding
5. What is REST?
• REpresentation State Transfer
– Architectural Styles and the Design of Network-based
Software Architecture – Roy Fielding PhD thesis
• Major components
– Nouns (resources) are identified by URIs
– A small subset of verbs to manipulate the nouns
– State of the data
– Representation is how you would like to view the state
• Use verbs to exchange application states and
representation
• Hypermedia is the engine for application state
transition
6. REST Example
• HTTP is one of the most RESTful protocol
• Example: the web browser
– The URL is the noun (resource)
– GET (verb) the page from the server
– State of the page is transferred from the server to the browser
• Page maybe static or dynamic
• State of page now exists on the client
– Page may be represented as HTML, RSS, JSON, etc.
– Click on a link in page (hypermedia) the process is repeated
7. What is REST?
Request
GET /music/artists/magnum/recordings HTTP/1.1
Host: media.example.com
Accept: application/xml
Verb Response Noun
HTTP/1.1 200 OK
Date: Tue, 08 May 2007 16:41:58 GMT
Server: Apache/1.3.6
Content-Type: application/xml; charset=UTF-8
State <?xml version="1.0"?>
<recordings xmlns="…">
transfer <recording>…</recording>
… Representation
</recordings>
8. JAX-RS in One Slide
@Path(“/music”)
@Produces(“application/xml”)
public class Music { www.mymusic.com/music
@GET //Returns List<Genre>
public Response getGenreList() {
...
}
@GET @Path(“{genre}”) //Returns List<Song>
public Response getSongs(
@PathParam(“genre”) String genreId) {
...
} www.mymusic.com/music/jazz
}
9. Selected Topics
• Runtime resource resolution
• Integration with EJB and CDI
• Runtime content negotiation
• Conditional HTTP request
• Dealing with type erasure
• Pluggable exception handling
10. Terms
• Root resource
http://server/department/eng
@Path(“department”)
public class Department {
• Sub resource method
– Handles the request
@GET @Path(“{id}”)
public Department get(
@PathParam(“id”) String deptId) {
• Sub resource locator
– Returns an object that will handle the request
@Path(“{id}”)
public Department get(
@PathParam(“id”) String deptId) {
11. Runtime Resource Resolution
@Path(“department”)
public class Department {
@Path(“{id}”)
public Object get(
@PathParam(“id”) String id) {
//Determine department type and return resource
return (new ...);
}
public class Marketing extends Department {
@GET @Path(“{type}”)
public Response get(
@PathParam(“type”) String deptType) { ... }
12. Runtime Resource Resolution
@Path(“department”)
public class Department {
@Path(“{id}”)
public Object get(
@PathParam(“id”) String id) { ... }
GET /department/marketing/tele
public class Marketing extends Department {
@GET @Path(“{type}”)
public Response get(
@PathParam(“type”) String deptType) { ... }
14. More Resource Resolution
• Sub resource locators determines what type of
resource to return dynamically
– Eg. Use JPA to query data and return that as a resource
– Can be used with CDI or EJBs
– All parameters must be annotated
@Path(“department”)
public class Department {
@Path(“{id}”)
public Object get(@PathParam(“id”) String id) {
EntityManager em = ... //Get an instance
Department dept = em.find(Department.class, id);
return (dept);
}
15. Resource Methods and Locators
• Easy to get confuse with sub-resource locator and
sub-resource methods
• Both are annotated with @Path
• Sub-resource methods has resource method
designators
– Eg. @GET
• Sub-resource locator do not have method designators
16. Integration with EJB
• Annotate @Path to convert into a root resource
– Stateless session bean
– Singleton bean
@Path("stateless-bean")
@Stateless
public class StatelessResource { ... }
@Path("singleton-bean")
@Singleton
public class SingletonResource { ... }
17. CDI One Pager
@Stateless public class ShoppingService {
@Inject private Cart myCart;
public void addToCart(Item someItem) {
myCart.add(someItem);
}
…
}
public interface Cart {
public void add(Item item);
}
@ConversationScoped
public class DefaultShoppingCart implements Cart {
@PersistenceContext private EntityManager em;
public void add(Item item) {
…
}
}
18. Using CDI with Root Resources
• Perfect world – use CDI to manage REST resources
– CDI providing lifecycle management, dependency, etc
• Not very well specified
• See http://www.mentby.com/paul-sandoz/jax-rs-on-
glassfish-31-ejb-injection.html
19. JAX-RS/CDI Component Models
• Root resources are managed in the request scope
– Default
• CDI requires “normal” scoped beans to be proxyable
– Annotated with @RequestScoped or @ApplicationScoped
– Unproxyable beans
• No non-private constructor with no argument
• Final class
• Root resources needs to be annotated with CDI
scoped to be managed by CDI
20. Using CDI with JAX-RS
• Request scoped, JAX-RS managed
@Path(“customer/{id}”)
public class Customer {
public Customer(@PathParam(“id”) String id) {
• Application scoped, CDI managed, will fail
@Path(“customer/{id}”) @ApplicationScoped
public class Customer {
@Inject
public Customer(@PathParam(“id”) String id) {
• Application scoped, provide a no-args constructor
– Use resource method to get id
@Path(“customer/{id}”) @ApplicationScoped
public class Customer {
public Customer() { }
22. Representation
Request
GET /music/artists/magnum/recordings HTTP/1.1
Host: media.example.com
Accept: application/xml
Format
Response
HTTP/1.1 200 OK
Date: Tue, 08 May 2007 16:41:58 GMT
Server: Apache/1.3.6
Content-Type: application/xml; charset=UTF-8
<?xml version="1.0"?>
<recordings xmlns="…">
<recording>…</recording>
…
</recordings>
23. Supported Media Types
• Out-of-the-box support for
– */* - byte[], InputStream, DataSource
– text/* - String
– text/xml, application/xml, application/*+xml –
JAXBElement
– application/x-www-form-urlencoded –
MultivalueMap
• Use @Produces or @Consumes to match with HTTP
headers
– Accept, Content-Type
24. Runtime Content Negotiation
• Static content/media type negotiation of
representation supported with @Produces
• Runtime content negotiation of representation
supports 4 dimensions
– Media type, character set, language, encoding
• Each representation has a Variant which is a point
in the 4 dimension space
List<Variant> variant = Variant
.mediaType(MediaType.APPLICATION.JSON
, MediaType.APPLICATION.XML)
.languages(Locale.ENGLISH, Locale.CHINESE);
assert variant.size() == 4
25. Select Most Acceptable Variant
@GET public Response get(@Context Request r) {
List<Variant> vs = ...
Variant v = r.selectVariant(vs);
if (v == null)
return (Response.notAcceptable(vs).build());
else {
Object rep = selectRepresentation(v);
return (Response.ok(rep, v));
}
}
• Selection will compare the list of variants with the
correspond acceptable values in the client request
– Accept, Accept-Langauge, Accept-Encoding, Accept-
Charset
26. Conditional HTTP Request
• Save bandwidth and client processing
– A GET can return a 304 (not modified) if representation has
not changed since previous request
• Avoid the lost update problem
– A PUT can return 412 (precondition failed) if the resource state
has been modified since previous request
• A date and/or entity tag can be used
– Last-Modified and Etag headers
– HTTP dates have granularity of 1 second
– Etags are better for use with PUT
28. Dealing with Type Erasure – 1
• Resources can return an entity
@GET List<Customer> getCustomers() { ...
• Type information is lost when returning Response
@GET Response getCustomers() {
List<Customer> list = ...
return (Response.ok(list).build());
• MessageBodyWriter support for List<Customer>
will not work when type information is lost
– Converts Java object to stream
29. Dealing with Type Erasure – 2
• Use GenericEntity to preserve type information at
runtime
@GET Response getCustomers() {
List<Customer> list = ...
GenericEntity<List<Customer>> ge =
new GenericEntity<List<Customer>>(list){};
return (Response.ok(list).build());
30.
31. Pluggable Exception Handling
• Propagation on unmapped exceptions to web
container
– A runtime exception thrown by the JAX-RS container or
application is propagated as is
– A checked exception is thrown by the application is
propagated as the cause of a ServletException
– Propagated exceptions can be mapped to error pages
• Runtime/checked exceptions can be “caught” and
mapped to Response using ExceptionMapper
32. Exception Classes
Class A extends RuntimeException { … }
Class B extends A { … }
Class C extends B { … }
33. Exception Mapper
@Provider
public class AMapper
implements ExceptionMapper<A> {
public Response toResponse(A a) { … }
}
@Provider
public class BMapper
implements ExceptionMapper<B> {
public Response toResponse(B b) { … }
}
34. Throwing Exceptions
// throwing A maps to Response of AMapper
@GET public String a() throws A { ... }
// throwing B maps to Response of BMapper
@GET public String b() throws B { ... }
// throwing C maps to Response of BMapper
@GET public String c() throws C { ... }
35. ExceptionMapper
• ExceptionMapper “closest” to exception class is
selected to map exception
• Can map Throwable
@Provider public class CatchAll
implements ExceptionMapper<Throwable> {
public Response toResponse(Throwable t) {
// Internal Server Error
return Response.status(500).build();
}
}
• Inject @Provider to delegate
– Map the cause of the exception
36. We encourage you to use the newly minted corporate tagline
“Software. Hardware. Complete.” at the end of all your presentations.
This message should replace any reference to our previous corporate
tagline “Oracle Is the Information Company.”