SlideShare una empresa de Scribd logo
1 de 36
IEEE Day 2013
01 October 2013, Qafqaz University
Ziya Askerov
Java Software Developer
Cybernet LLC
ziyaaskerov@gmail.com
Build modern,
sophisticated and
robust Groovy web
applications in record
time !
Ziya Askerov
http://www.professionals.az
Contents
 Java Web Technologies Overview
 Groovy Scripting Language
 Grails Framework
 Convention Over Configuration
 GORM (Grails Object Relational Mapping)
 GSP (Groovy Server Pages)
 Grails Tags
 Web Layer
 Grails Plugins
 Spring Security
 Configuration
JAVA WEB TECHNOLOGIES
What is Groovy ?
 Is an agile and dynamic language for the Java Virtual Machine
 Makes modern programming features available to Java developers
with almost-zero learning curve
 Increases developer productivity
 Compiles straight to Java bytecode so you can use it anywhere you
can use Java
 Seamlessly integrates with all existing Java classes and libraries
What is Grails?
 Full stack MVC framework for web apps
 Exploits the awesome power of Groovy
 Leverages proven staples
– Hibernate
– Spring
– Sitemesh
 Works on JVM
GRAILS ARCHITECTURE
Why GRAILS?
 Java web development as it stands today is
dramatically more complicated than it needs
to be
 Most modern web frameworks in the Java
space are over complicated and don't
embrace the Don't Repeat Yourself (DRY)
principles.
Why GRAILS?
- An easy to use Object Relational Mapping (ORM)
layer built on Hibernate
- An expressive view technology called Groovy Server
Pages (GSP)
- A controller layer built on Spring MVC
- A transactional service layer built on Spring's
transaction abstraction
Why GRAILS?
 Based on battle tested and proven Java frameworks (Spring,
Hibernate, SiteMesh, Quartz, etc) 
 Based on Groovy language
 GORM(Grails Object Relational Mapping)
 Doesn’t stop you from using the power of underlying frameworks
 Easy to set-up and get started
 Minimal server restart required while development
 Convention over Configuration / No painful XML configuration &
XML Management
 Tag Lib Authoring mechanism
 Tons of available plugins
Convention Over Configuration
 Grails uses "convention over configuration" to configure itself
 This typically means that the name and location of files is used 
instead of explicit configuration
 No config files
 No action mappings
GRAILS AND SECURITY
 All standard database access via GORM domain objects is 
automatically SQL escaped to prevent SQL injection attacks
 Grails link creating tags (link, form, createLink, createLinkTo and 
others) all use appropriate escaping mechanisms to prevent code 
injection
 Grails provides codecs to let you trivially escape data when rendered 
as HTML, JavaScript and URLs to prevent injection attacks here.
 XSRF attacks prevention with useToken
GORM
 GORM is Grails' object relational mapping 
(ORM) implementation.
 Under the hood it uses Hibernate  (a very 
popular and flexible open source ORM 
solution)  
GRAILS ARCHITECTURE
GORM
 Domain Modelling in GORM
 Persistence Basics
 Querying with GORM
 Saving and Updating
 Dynamic Finders
 Eager and Lazy Fetching
  
GORM DOMAIN MODELING
CONSTRAINTS
blank
creditCard
email
inList
matches
max
maxSize
min
minSize
notEqual
nullable
range
scale
size
unique
url
SAVING AND UPDATING
def p = Person.get(1) 
p.save()
def p = Person.get(1)
p.save(flush: true)
def p = Person.get(1)
p.delete(flush: true)
Querying With GORM
def books = Book.list()
def books = Book.list(offset:10, max:20)
def books = Book.list(sort:"title", order:"asc")
def book = Book.get(23)
def books = Book.getAll(23, 93, 81)
Dynamic Finders
def book = Book.findByTitle("The Stand")
book = Book.findByTitleLike("Harry Pot%")
book = Book.findByReleaseDateBetween(firstDate, secondDate)
book = Book.findByReleaseDateGreaterThan(someDate)
Hibernate's Criteria API
GRAILS AND MVC
Controllers, Services
Dependency Injection
TAGS
 <g:form name="myForm" action="myaction" id="1">...</g:form>
 <select onchange="${remoteFunction(action: 'bookByName', update: [success:
'great', failure: 'ohno'], params: ''bookName=' + this.value')}">
<option>first</option>
<option>second</option>
</select>
 <g:render template="bookTemplate" />
 <g:paginate controller="book" action="list" total="${bookCount}" />
 <g:if test="${name == 'fred'}"> Hello ${name}! </g:if>
 <g:include controller="book" action="list" />
GRAILS PLUGINS
 Spring Security Core Plugin
 Spring Security UI Plugin
 Quartz Plugin
 Quartz Monitor Plugin
 Mail Plugin
 XSS sanitizer Plugin
SPRING SECURITY ANNOTATIONS
SPRING SECURITY ANNOTATIONS
Spring Security TagLib
<sec:ifLoggedIn> Welcome Back! </sec:ifLoggedIn>
<sec:ifAllGranted roles="ROLE_ADMIN,ROLE_SUPERVISOR">secure
stuff here</sec:ifAllGranted>
<sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_SUPERVISOR">secure
stuff here</sec:ifAnyGranted>
Welcome Back <sec:loggedInUserInfo field="fullName"/>
Spring Security Utils
 authoritiesToRoles()
 getPrincipalAuthorities()
 parseAuthoritiesString()
 ifAllGranted()
 ifNotGranted()
 ifAnyGranted()
 getSecurityConfig()
 loadSecondaryConfig()
 reloadSecurityConfig()
 isAjax()
Configuration
 BootStrap.groovy
 BuildConfig.groovy
 Config.groovy
 DataSource.groovy
 UrlMappings.groovy
Config.groovy
BuildConfig.groovy
DataSource.groovy
UrlMappings.groovy
class UrlMappings {
static mappings = {
}
}
"/profile"(controller:"userProfile“,action:"userProfile")
"/newsfeed"(controller:"userProfile“,action:"homePage")
"/company"(controller:"company“,action:"companyProfile")
GRAILS TOOL (GGTS)
Download from : http://spring.io/tools/ggts
SITES USING GRAILS

Más contenido relacionado

La actualidad más candente

Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
Rasheed Waraich
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
Kevingo Tsai
 

La actualidad más candente (20)

A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
A First Look at Windows Presentation Foundation Everywhere (WPF/E): a Cross …
 
Frameworks in java
Frameworks in javaFrameworks in java
Frameworks in java
 
JavaScript와 TypeScript의 으리 있는 만남
JavaScript와 TypeScript의 으리 있는 만남JavaScript와 TypeScript의 으리 있는 만남
JavaScript와 TypeScript의 으리 있는 만남
 
Spring Mvc,Java, Spring
Spring Mvc,Java, SpringSpring Mvc,Java, Spring
Spring Mvc,Java, Spring
 
Building Massive AngularJS Apps
Building Massive AngularJS AppsBuilding Massive AngularJS Apps
Building Massive AngularJS Apps
 
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
Scaling AngularJS: Enterprise SOA on the MEAN Stack (Responsive Web & Mobile)
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
 
5 best Java Frameworks
5 best Java Frameworks5 best Java Frameworks
5 best Java Frameworks
 
Azure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみたAzure Web PubSub Serviceを触ってみた
Azure Web PubSub Serviceを触ってみた
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Ppt of java and java script
Ppt of java and java scriptPpt of java and java script
Ppt of java and java script
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
 
Azure Artifactsを触ってみよう
Azure Artifactsを触ってみようAzure Artifactsを触ってみよう
Azure Artifactsを触ってみよう
 
Node js
Node jsNode js
Node js
 
Introduce Angular2 & render & firebase flow
Introduce Angular2 & render & firebase flowIntroduce Angular2 & render & firebase flow
Introduce Angular2 & render & firebase flow
 
Pre-render Blazor WebAssembly on static web hosting at publishing time
Pre-render Blazor WebAssembly on static web hosting at publishing timePre-render Blazor WebAssembly on static web hosting at publishing time
Pre-render Blazor WebAssembly on static web hosting at publishing time
 
Introduction to MERN
Introduction to MERNIntroduction to MERN
Introduction to MERN
 
.NET Overview & Roadmap
.NET Overview & Roadmap.NET Overview & Roadmap
.NET Overview & Roadmap
 
Morden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web AppsMorden F2E Education - Think of Progressive Web Apps
Morden F2E Education - Think of Progressive Web Apps
 

Similar a GROOVY ON GRAILS

Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
Best-Practices-Web-Usability
Best-Practices-Web-UsabilityBest-Practices-Web-Usability
Best-Practices-Web-Usability
Larry Wilson
 

Similar a GROOVY ON GRAILS (20)

intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
 
Architecture of Professionals.az
Architecture of Professionals.azArchitecture of Professionals.az
Architecture of Professionals.az
 
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on railsACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
ACADGILD:: FRONTEND LESSON -Ruby on rails vs groovy on rails
 
Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
Groovy Finesse
Groovy FinesseGroovy Finesse
Groovy Finesse
 
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyGriffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019
 
List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019  List of 7 popular java frameworks for 2019
List of 7 popular java frameworks for 2019
 
Aswin
AswinAswin
Aswin
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
 
Architecture of Professionals.az
Architecture of Professionals.azArchitecture of Professionals.az
Architecture of Professionals.az
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
 
5 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 20225 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 2022
 
Flex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application DevelopmentFlex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application Development
 
December 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig PresentationDecember 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig Presentation
 
Grails
GrailsGrails
Grails
 
Best-Practices-Web-Usability
Best-Practices-Web-UsabilityBest-Practices-Web-Usability
Best-Practices-Web-Usability
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

GROOVY ON GRAILS