Felix HTTP
Paving the road to the future
 and Jan Willem Janssen Marcel Offermans
SSID: Felix
Password: felixdemo
Browse to: http://10.61.0.161:8080/
Jan Willem
Janssen
Software architect at Luminis Technologies
Currently working on PulseOn and Amdatu
Committer and PMC member at Apache Felix and Apache ACE
Marcel
Offermans
Director at Luminis Technologies, Fellow at Luminis
Currently working on Amdatu
Apache Member, Committer and PMC member at Apache ACE and
Apache Felix
Agenda
Modular Web Applications
Current State
Available Extensions
The New Specification
New extensions
Future Work
Wrap Up
Modular Web
Applications
Modular
Architectures
High Cohesion, Low Coupling
Separation of Concerns
Maintainable Code
Reusable, Composable
Deployments
Compose modules into different deployments
Low bandwidth by just sending changed modules
Fast deployments by being able to update running applications
Current State
Explicit
RegistrationpublicinterfaceHttpService{
voidregisterServlet(Stringalias,Servletservlet,
DictionaryinitParams,HttpContexthttpContext);
voidregisterResources(Stringalias,Stringname,
HttpContexthttpContext);
voidunregister(Stringalias);
HttpContextcreateDefaultHttpContext();
}
Servlets
httpService.registerServlet("/hello",newHttpServlet(){
@Override
publicvoiddoGet(HttpServletRequestreq,HttpServletResponseresp){
resp.setContentType("text/plain");
resp.getWriter().write("HelloApacheConworld!");
}
},null/*initParams*/,null/*httpContext*/);
invoke the /hello servlet
...
ResourceshttpService.registerResources("/site","/resources",null/*httpContext*/);
$catresources/hello
HelloApacheConworld,I'mastaticresource!
request a static resource called hello
...
HttpContext
Provides secure access to servlets and resources.
Layer of abstraction for resource loading.
publicinterfaceHttpContext{
booleanhandleSecurity(HttpServletRequestrequest,
HttpServletResponseresponse);
URLgetResource(Stringname);
StringgetMimeType(Stringname);
}
Web Application
Specification
Part of the OSGi Enterprise Specification, chapter 128.
Web Application Bundle (WAB) are extended Java EE WAR files.
They have optional JSP support.
Integration with OSGi BundleContextand service registry.
Available
Extensions
Whiteboard
don't call us, we'll call you!
Register your Servletin the service registry and add a property called
aliascontaining its endpoint.
For more information:
http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf
Filters
Just like Servlets, these can be registered whiteboard style
or use explicit registration:
the ExtHttpServiceservice from Felix HTTP
the WebContainerservice from PAX Web
Amdatu Web
Resources
of the open source project (Apache Licensed).Part Amdatu.org
X-Web-Resource-Version:1.1
X-Web-Resource:/amdatu-resources;resources
X-Web-Resource-Default-Page:index.html,/doc=javadoc.html
Include-Resource:resources=resources/basic
Demo
request a static resource called /amdatu‑resources
...
Amdatu Web
REST
Extensive support for based on industry standards.REST endpoints
JAX-RS based annotation support.
Includes support for Jackson mappings.
Self-documenting endpoints with Swagger.
Demo@Path("/rest")
@Description("ProvidesademoRESTendpoint")
publicclassDemoRestEndpoint{
privateStringm_response="HelloWorld!";
@GET@Produces(MediaType.TEXT_PLAIN)
@Description("Givesaplaintextresponse")
publicStringgetPlainResponse(){
returnm_response;
}
@POST@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Description("Allowsonetosettheresponsetoreturn")
publicvoidsetResponse(
@FormParam("response")@DefaultValue("Defaultresponse")StringnewResponse){
m_response=newResponse;
}
}
Self-
documenting
Endpoints
Swagger is a library that creates documentation for endpoints based on
JAX-RS annotations plus some extras.
Go to Swagger documentation
The new
specification
Whiteboard
No longer an extension
No explicit registration
Specify HttpService to be used
Example
Dictionaryprops=newHashtable();
props.put("osgi.http.whiteboard.servlet.pattern","/slidemgr");
props.put("osgi.http.whiteboard.target","(http.service=demo)");
context.registerService(Servlet.class.getName(),newSlideManager(),props);
(A)synchronous
Servlets
Servlet 3.0 API
Support wildcard one or more patterns
Process work outside the servlet lifecycle
Example code
classWorkerServletextendsHttpServlet{
protectedvoiddoGet(HttpServletRequestreq,HttpServletResponseresp){
finalAsyncContextasyncContext=req.startAsync(req,resp);
asyncContext.start(newDeepThought(asyncContext));
}
}
//
classDeepThoughtimplementsRunnable{
privateAsyncContextm_context=//...
publicvoidrun(){
//...dosomehardwork...
TimeUnit.DAYS.sleep(356L*7500000L);
HttpServletResponseresponse=(HttpServletResponse)asyncContext.getResponse();
response.setStatus(SC_OK);
response.getWriter().printf("42");
asyncContext.complete();
}
}
Example registration
Dictionaryprops=newHashtable();
props.put("osgi.http.whiteboard.servlet.pattern","/worker/*");
props.put("osgi.http.whiteboard.servlet.asyncSupported","true");
context.registerService(Servlet.class.getName(),newWorkerServlet(),props);
Filters
Full support
Example
Dictionaryprops=newHashtable();
props.put("osgi.http.whiteboard.filter.pattern","/*");
props.put("osgi.http.whiteboard.filter.dispatcher",
newString[]{"REQUEST","INCLUDE","FORWARD"});
context.registerService(Filter.class.getName(),newSecurityFilter(),props);
Listeners
Full support
All events
Example
finalCountDownLatchlatch=newCountDownLatch(1);
ServletContextListenercontextListener=newServletContextListener(){
publicvoidcontextDestroyed(ServletContextEventevent){}
publicvoidcontextInitialized(ServletContextEventevent){
latch.countDown();
}
};
Dictionaryprops=newHashtable();
props.put("osgi.http.whiteboard.context.select","DEFAULT");
context.registerService(ServletContextListener.class.getName(),contextListener,props);
assertTrue("HttpServicenotreadyintime?!",latch.await(5,TimeUnit.SECONDS));
//continuewithyouritest...
Custom Error
Pages
By error code
By exception
Example
Dictionaryprops=newHashtable();
props.put("osgi.http.whiteboard.servlet.errorPage",
newString[]{"500","java.io.IOException"});
context.registerService(Servlet.class.getName(),newMyErrorHandlingServlet(),props);
New extensions
WebSockets
“Real-time”
Binary or text-based
Two-way communication
RFC 6455
Example
//Client-side
varwsConn=newWebSocket("ws://"+window.location.host+"/servlet",["my-protocol"]);
wsConn.onmessage=function(event){
vardata=event.data;
//dosomethingwithdata
}
//Server-side,registeredat"/servlet"
classMyWebSocketServletextendsWebSocketServlet{
publicWebSocketdoWebSocketConnect(HttpServletRequestrequest,Stringprotocol){
if("my-protocol".equals(protocol)){
returnnewWebSocket.OnTextMessage(){
publicvoidonOpen(Connectionconn){}
publicvoidonClose(intcode,Stringreason){}
publicvoidonMessage(Stringdata){}
};
}
returnnull;
}
}
Demo
Multi-user Etch A Sketch
SPDY
Let's make the web faster
Session layer on top of SSL
Reduce bandwidth & lower latency
Push multiple resources in a request
Basis of HTTP 2.0
Application
Session
Presentation
Transport
How SPDY fits in the OSI layer model.
SPDY vs WebSockets
SPDY WebSockets
Goal optimize HTTP 2-way communication
Upgradeability transparent needs works
Secure? ✔ (mandatory) ✔ (if needed)
Two-way? ✔ / ✘ ✔
Multiplexed ✔ ✘
Prioritized ✔ ✘
Demo
HTTP vs SPDY
Future Work
Finalize support for new HttpService specification
Upgrade to Jetty 9
Allow “new style” WebSockets (JSR 356) to be used
Improved support for SPDY
Wrap Up
New/updated specifications
New features, functionality & improvements
Available extensions
Build modular web applications
Questions?
Links
felix.apache.org
luminis-technologies.com
bndtools.org
amdatu.org
bitbucket.org/marrs/apachecon2014-felix-http

More Related Content

PDF
Whats New in the Http Service Specification - Felix Meschberger
PDF
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
PDF
Service oriented web development with OSGi
PDF
Service Oriented Web Development with OSGi - C Ziegeler
ODP
Declarative Services - Dependency Injection OSGi Style
PPTX
ASP.NET Web API
PPTX
An introduction to consuming remote APIs with Drupal 7
PPTX
REST in Peace
Whats New in the Http Service Specification - Felix Meschberger
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
Service oriented web development with OSGi
Service Oriented Web Development with OSGi - C Ziegeler
Declarative Services - Dependency Injection OSGi Style
ASP.NET Web API
An introduction to consuming remote APIs with Drupal 7
REST in Peace

What's hot (20)

PDF
Oracle API Gateway Installation
PDF
PDF
What's cool in the new and updated OSGi Specs (EclipseCon 2014)
PPT
Web Deployment With Visual Studio 2010
PDF
Retrofit
PPTX
The Full Power of ASP.NET Web API
PDF
OSGi Cloud Ecosystems (EclipseCon 2013)
PDF
Extending Retrofit for fun and profit
PDF
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
PDF
Guzzle in Drupal 8 and as a REST client - Артем Мирошник
PDF
PPTX
Alfresco devcon 2019: How to track user activities without using the audit fu...
PDF
Spring 4 - A&BP CC
PPTX
ASP.NET WEB API
PPT
Jsp/Servlet
ODP
Running ms sql stored procedures in mule
PPTX
PPT
JAVA Servlets
PDF
Brief Intro To Jax Rs
ODP
Oredev 2009 JAX-RS
Oracle API Gateway Installation
What's cool in the new and updated OSGi Specs (EclipseCon 2014)
Web Deployment With Visual Studio 2010
Retrofit
The Full Power of ASP.NET Web API
OSGi Cloud Ecosystems (EclipseCon 2013)
Extending Retrofit for fun and profit
AAI 2236-Using the New Java Concurrency Utilities with IBM WebSphere
Guzzle in Drupal 8 and as a REST client - Артем Мирошник
Alfresco devcon 2019: How to track user activities without using the audit fu...
Spring 4 - A&BP CC
ASP.NET WEB API
Jsp/Servlet
Running ms sql stored procedures in mule
JAVA Servlets
Brief Intro To Jax Rs
Oredev 2009 JAX-RS
Ad

Similar to Felix HTTP - Paving the road to the future (20)

PDF
May 2010 - RestEasy
PPTX
Overview of RESTful web services
PDF
Native REST Web Services with Oracle 11g
PPTX
JAX-RS 2.0 and OData
PDF
CDI, Seam & RESTEasy: You haven't seen REST yet!
ODP
Interoperable Web Services with JAX-WS and WSIT
PPT
Mashups
PPT
An Introduction to Websphere sMash for PHP Programmers
PDF
JavaEE6 my way
PDF
SOA with C, C++, PHP and more
PDF
Play Framework: async I/O with Java and Scala
PDF
Java servlet technology
PPTX
WSO2 Middleware on DC_OS-1
PPTX
Soap Component
PPTX
Web API or WCF - An Architectural Comparison
PPT
nodejs_at_a_glance.ppt
PDF
Sofea and SOUI - Web future without web frameworks
PPTX
How to use soap component
PPTX
Understanding ASP.NET Under The Cover - Miguel A. Castro
PPTX
ASP.NET Web API and HTTP Fundamentals
May 2010 - RestEasy
Overview of RESTful web services
Native REST Web Services with Oracle 11g
JAX-RS 2.0 and OData
CDI, Seam & RESTEasy: You haven't seen REST yet!
Interoperable Web Services with JAX-WS and WSIT
Mashups
An Introduction to Websphere sMash for PHP Programmers
JavaEE6 my way
SOA with C, C++, PHP and more
Play Framework: async I/O with Java and Scala
Java servlet technology
WSO2 Middleware on DC_OS-1
Soap Component
Web API or WCF - An Architectural Comparison
nodejs_at_a_glance.ppt
Sofea and SOUI - Web future without web frameworks
How to use soap component
Understanding ASP.NET Under The Cover - Miguel A. Castro
ASP.NET Web API and HTTP Fundamentals
Ad

More from Marcel Offermans (7)

PDF
De leukste Bug
PDF
Building Secure OSGi Applications
PDF
OSGi on Google Android using Apache Felix
PDF
Component-based ontwikkelen met OSGi: van embedded tot enterprise
PDF
Dependencies, dependencies, dependencies
PDF
Modular Architectures using Micro Services
PDF
Dynamic Deployment With Apache Felix
De leukste Bug
Building Secure OSGi Applications
OSGi on Google Android using Apache Felix
Component-based ontwikkelen met OSGi: van embedded tot enterprise
Dependencies, dependencies, dependencies
Modular Architectures using Micro Services
Dynamic Deployment With Apache Felix

Recently uploaded (20)

PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
Website Design Services for Small Businesses.pdf
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PPTX
Computer Software - Technology and Livelihood Education
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
assetexplorer- product-overview - presentation
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Autodesk AutoCAD Crack Free Download 2025
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Designing Intelligence for the Shop Floor.pdf
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Website Design Services for Small Businesses.pdf
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Tech Workshop Escape Room Tech Workshop
Advanced SystemCare Ultimate Crack + Portable (2025)
Topaz Photo AI Crack New Download (Latest 2025)
Wondershare Recoverit Full Crack New Version (Latest 2025)
iTop VPN Crack Latest Version Full Key 2025
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Weekly report ppt - harsh dattuprasad patel.pptx
Computer Software - Technology and Livelihood Education
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Computer Software and OS of computer science of grade 11.pptx
assetexplorer- product-overview - presentation
Why Generative AI is the Future of Content, Code & Creativity?
Multiverse AI Review 2025: Access All TOP AI Model-Versions!

Felix HTTP - Paving the road to the future