Java Building Web Apps with Spring Rob Harrop, Interface21 Ltd.



Similar documents
Expert Spring MVC and Web Flow

Dragan Juričić, PBZ May 2015

Enterprise Application Development In Java with AJAX and ORM

Spring 3.1 to 3.2 in a Nutshell. Sam Brannen Senior Software Consultant

What s new in Spring 3.1?

SPRING INTERVIEW QUESTIONS

Rapid Application Development. and Application Generation Tools. Walter Knesel

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

Glassbox: Open Source and Automated Application Troubleshooting. Ron Bodkin Glassbox Project Leader

CrownPeak Java Web Hosting. Version 0.20

SSC - Web development Model-View-Controller for Java web application development

Operations and Monitoring with Spring

Apache Sling A REST-based Web Application Framework Carsten Ziegeler cziegeler@apache.org ApacheCon NA 2014

Aspect Weaving for OSGi. Martin Lippert (akquinet it-agile GmbH)

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Complete Java Web Development

Module Title: : Cloud Application Development

JAVA/J2EE DEVELOPER RESUME

Integration in Practice

Simplify Your Web App Development Using the Spring MVC Framework

Practical Android Projects Lucas Jordan Pieter Greyling

Continuous Delivery for Alfresco Solutions. Satisfied customers and happy developers with!! Continuous Delivery!

Java EE Web Development Course Program

Agile Best Practices and Patterns for Success on an Agile Software development project.

<Insert Picture Here> Hudson Security Architecture. Winston Prakash. Click to edit Master subtitle style

Java EE 6 development with Eclipse, Netbeans, IntelliJ and GlassFish. Ludovic Champenois Oracle Corporation

Developing ASP.NET MVC 4 Web Applications MOC 20486

Developing modular Java applications

Web Applications and Struts 2

Core Java+ J2EE+Struts+Hibernate+Spring

APAC WebLogic Suite Workshop Oracle Parcel Service Overview. Jeffrey West Application Grid Product Management

Esigate Module Documentation

Model-View-Controller. and. Struts 2

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

Developing Android Apps with the ArcGIS Runtime SDK for Android. Dan

Introduction (Apps and the Android platform)

Framework Adoption for Java Enterprise Application Development

OpenShift is FanPaaStic For Java EE. By Shekhar Gulati Promo Code JUDCON.IN

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

WebSphere Server Administration Course

Web Frameworks and WebWork

Developing ASP.NET MVC 4 Web Applications

IBM WebSphere Server Administration

Spring Web Flow Reference Guide

Oracle Identity Analytics Architecture. An Oracle White Paper July 2010

Building Web Applications, Servlets, JSP and JDBC

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Proposal for DSpace Web MVC

1. Spring Batch Admin User Guide

Research Article. ISSN (Print) *Corresponding author Lili Wang

Developing a highly dynamic web application for a large bank using rules-based technology

EAI and Spring Integration. Josh Long Architect, Software Engineer JoshLong.com

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

Cross-domain Identity Management System for Cloud Environment

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

The Oracle Fusion Development Platform

X Cart Module Banner Pro Version 0.1

Customize Mobile Apps with MicroStrategy SDK: Custom Security, Plugins, and Extensions

MS Enterprise Library 5.0 (Logging Application Block)

Building Web Services with Apache Axis2

Spring Security SAML module

Java Mission Control

GlassFish. Developing an Application Server in Open Source

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 5

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

APM for Java. AppDynamics Pro Documentation. Version 4.0.x. Page 1

<Insert Picture Here> Betting Big on JavaServer Faces: Components, Tools, and Tricks

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

How To Write A Web Framework In Java

Web Application Access Control with Java SE Security

The Spring Framework: An Open Source Java Platform for Developing Robust Java Applications

Aspect Oriented Programming. with. Spring

Comparing Application Security Tools

JBoss Portlet Container. User Guide. Release 2.0

Improving Software Quality with the Continuous Integration Server Hudson. Dr. Ullrich Hafner Avaloq Evolution AG 8911

Agile Development with Groovy and Grails. Christopher M. Judd. President/Consultant Judd Solutions, LLC

REAL TERRACOTTA. Real-world scalability patterns with Terracotta. SERGIO BOSSA Pro-Netics / Sourcesense

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

Tutorial: Building a Web Application with Struts

Using SAPUI5 to Enhance LSO Manager Capabilities Rob Becker & Steve Sweeney Lockheed Martin SESSION CODE: AD124

Java/J2EE or Web Developer. Formal Education. Technical knowledge. Spoken Languages

ARM-BASED PERFORMANCE MONITORING FOR THE ECLIPSE PLATFORM

Web Development with the Eclipse Platform

Specialized Programme on Web Application Development using Open Source Tools

Continuous Integration and Delivery. manage development build deploy / release

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

Portals, Portlets & Liferay Platform

Kohsuke Kawaguchi Sun Microsystems, Inc. hk2.dev.java.net, glassfish.dev.java.net. Session ID

Beginning POJOs. From Novice to Professional. Brian Sam-Bodden

Course Name: Course in JSP Course Code: P5

How To Write A Composition Engine In A Microsoft Ip System

T320 E-business technologies: foundations and practice

Transcription:

Java Building Web Apps with Spring Rob Harrop, Interface21 Ltd.

Contact me at rharrop@interface21.com About the Speaker VP at Interface21 Core Developer on Spring Founder of Spring Modules JMX 2.0 Expert Group Member Author of Pro Spring

Agenda Tools for Web Development Getting Started Basic User Interactions Handling Site Formatting User Conversations with Web Flow Adding Security Handling Exceptions Interception and Filtering

Tools for Web Development Get a good IDE: IntelliJ IDEA Eclipse with WTP NetBeans Consider using Jetty for development Rapid turn around Easy to edit view files, flow definitions etc Maven is a good tool for managing Jetty

Tools for Web Development Spring and Spring Web Flow Site Formatting SiteMesh Tiles CSS Framework ContentWithStyle.co.uk

Getting Started 1.Create basic web application skeleton 1.Consider Maven as a kick start 2.Configure Spring's DispatcherServlet 3.Create a Spring Web Application config file 4.Configure ContextLoaderListener and middle tier configuration files as needed

DEMO: Basic Web Application Configuration

Basic User Interactions Logic encapsulated in Controllers Implement Controller directly Extend AbstractController, MultiActionController or SimpleFormController

Basic User Interactions Controllers return a ModelAndView which describes: The view to render Data for that view

View Resolution Typically views are represented as String names Decoupled from the actual view implementation Easy to test

View Resolution These names are mapped to concrete views using a ViewResolver: InternalResourceViewResolver BeanNameViewResolver VelocityViewResolver Many applications have multiple ViewResolvers configured in a chain

Mapping Controllers to URIs Controllers are configured as beans in the web application config file Can have injected dependencies Declarative services

Mapping Controllers to URIs These Controller beans are mapped to URIs using a HandlerMapping: SimpleUrlHandlerMapping BeanNameHandlerMapping HandlerMappings are also configured in the web application config file

DEMO: Creating and Configuring a Controller

Site-Wide Formatting Most web applications require consistent formatting across the site Headers Navigation Footers Ads Adding this by hand can be painful and error-prone

Handling Site-Wide Formatting Site-wide formatting can be applied automatically Do not cut and paste across pages! Use a pre-built tool SiteMesh and Tiles are good candidates Couple this with a strong CSS-based layout I use a pre-built CSS framework from ContentWithStyle

Site-Wide Formatting with SiteMesh 1. Configure the SiteMesh filter 2. Create a decorators.xml file 1. Define your page decorators 3. Create your decorator(s)

DEMO: SiteMesh in Action

User Conversations with Web Flow Web Flow provides a sophisticated mechanism for controlling long running user interactions Conversations are mapped as fa low using standard state machines concepts

User Conversations with Web Flow Web Flow is integrated with Spring MVC View resolution works the same way Exception resolution works the same way

Web Flow Concepts State A single stage in the execution of a flow Action A piece of logic that can be executed a various points during the flow

Web Flow Concepts Event A user or action initiated event such as submit or process Transition A movement from one state to another in response to some event

Web Flow Concepts View State A state that constitutes a pause in the flow execution and renders a view for the user Action State A state type that executes one or more Actions before proceeding to another State

Web Flow Concepts Flow Executor Manages flow execution. Resumes and pauses flows as they proceed Flow Repository Store in-progress flow execution state Simple and continuation-based implementations provided

Flow Registry Web Flow Concepts Registry of flow definitions

Getting Started with Web Flow 1.Configure Flow Registry 2.Configure Flow Executor 3.Optionally configure Flow Repository 4.Create Flow Definition 5.Configure a FlowController for your flow

Configuring Web Flow Configure the FlowExecutor and FlowRegistry <flow:executor id="flowexecutor" registry-ref="flowregistry"/> <flow:registry id="flowregistry"> <flow:location path="/web-inf/flows/**.xml"/> </flow:registry> Flows are XML files stored in /WEB-INF/flows

Configuring a FlowController <bean name="/checkout.html" class="o.s.w.ex.mvc.flowcontroller"> <property name="flowexecutor" ref="flowexecutor"/> <property name="defaultflowid" value="checkout"/> </bean>

DEMO: Order Process with Spring Web Flow

Handling Exceptions Exceptions that cannot be handled should be allowed to propagate These can be handled by some last-ditch process Servlet error pages Spring HandlerExceptionResolvers

Handling Exceptions HandlerExceptionResolver allows for: Last ditch processing Same contract as a Controller Access to thrown Exception Auto detected from the ApplicationContext

Handling Exceptions Spring provides SimpleMappingExceptionResolver Configurable mapping of Exception type to error view name

DEMO: Configuring a HandlerExceptionResolver

Interception and Filtering Spring web applications have three options for interception: Servlet Filters Spring HandlerInterceptors AOP

Interception and Filtering All three options can be treated as normal Spring beans: Dependency Injection Remote/JMX exposure

Uses for Interception and Filtering Conditional request processing Maintenance mode Redirect based on user type Tracing and profiling Thread local management

DEMO: Filtering and Interception in Action

Further Information Blog - http://blog.interface21.com/ SiteMesh - http://www.opensymphony.com/sitemes h ContentWithStyle - http://www.contentwithstyle.co.uk

Q&A