Upload
shinpei-ohtani
View
1.819
Download
2
Embed Size (px)
DESCRIPTION
T2 webframework is simple and modernized java webframework for web2.0 environment.This presentaion tells you the new web development situation is coming to us and how we solve by T2 webframework.
Citation preview
T2 frameworkT2 project
http://t-2.googlecode.com/Shinpei Ohtani(shot6)
Agenda
Introduce myself and the teamAn overview of T2 frameworkCurrent web development situationT2 architecture and mechanismDemosConclusion
Introduce myself
Shinpei OhtaniOpen source programmer
Java/ActionScript/JavaScript/C#...
Works at ISI Dentsu, LtdBlog
http://d.hatena.ne.jp/shot6/ (Japanese)
Twitterhttp://twitter.com/shot6/
Introduce the T2 team
The team are:5 committersAll professional programmer, especially
JavaEach of us create both applications and
frameworksThe experiences are the core of creating
T2
Web development situation
The time for web application re-inventedRIA is no more new thing, it is just choice!
Ajax, Flex, Silverlight, there are just choices.
Cloud environment is the matterWeb application needs to deploy to multiple
clouds
HTTP based protocol and format rises upAMF, XMPP, reversehttp, pubsubhubbubOr, legacy SOAP:P
RIP –Rich Internet Platform-
RIA to RIP(Rich Internet Platform)RIP is the platform to support multiple RIA
environment(HTML5, Ajax, Flex, Silverlight…).
HTML5 is the flagship of RIPUnlike HTML4, HTML5 is the platform for RIA.Runtime is the key such as
• WebSockets• WebStorage• WebWorker• CacheManifest• Geolocation API
Cloudability
CloudabilityAbility to work well at cloud environmentWork well means:
Deploy easilyScale easily so be statelessInteroperable to multiple cloud environment
• Not only for GAE, Amazon, or other, do work with all these.
HTTP matters
HTTP/HTTPS it the protocolThe unified protocol for next generation
appsThe format also matters
AMF for Flex, XMPP for jabber, pubsubhubbub for WebHook, so many format rises up!
These formats and mechanism is the key for new interactive web apps
To the next level web apps
Choose good/simple framework that has some features for:RIPCloudabilityHTTP based multiple format
is one of the choice for you.
What is T2 framework
Simple and modernized java web framework for real developerEasy to use and maintain by annotationCurrent version is T2 0.6.1-ga. ASL2
License.http://code.google.com/p/t-2/
The framework for RIP appsOfcourse support classic web application!Extensible and embeddable framework
The big picture
BrowserBrowserHTTPPOST
JavaScript
Client
JavaScript
Client
XmlHttpRequest
Flex/AIRFlex/AIR
AMF
REST-likeClient
REST-likeClient PUT /hoge/foo
POJOPOJO
POJOPOJO
POJOPOJO
Serverside javaapplications
……
……
……
Request format doesn’t effect server side POJO-based model. Request format doesn’t effect server side POJO-based model.
The motivation
The motivationAll of Java webframework is too difficult to
use and maintainAlso mention none of these follow
modernized web clients with one unified modelDoes your framework handle Ajax, AMF, REST
request using one unified programming model? No clean url, no life.No choice of template engine, no life.Less configuration without difficult CoC!
The motivation(cont’d)
Web framework:should be much more simple.should give developer loosely-coupled unified
model.Request type and format doesn’t effect server side.
should handle modernized web request wellAjax, AMF from Flex, REST, POX from Silverlight…
should give you clean beatiful urlshould give you free to choose template engine
The concept
ConceptDo one thing well
T2 just connects between multiple HTTP clients to POJO using url pattern gracefully.Doesn’t do things at all.
Accepts WEB diversity100 ways to make web application with
technology (browser/RIA/CUI…), and we can’t push developer to one way.Do it freely using T2.
Only things for sure is using HTTP and URL.
The target user
Who should use T2?Developers who’d like to:
Develop and control web application easily.Separate clients and server side application
gracefullyDevelop his/her framework based on simple and
extensible framework and control perfectly Develop RIA application quickly using REST like
request, Ajax request, or Flex AMF requestDevelop cloud based application
Programming model
Page modelAll of T2 application uses page modelBasically POJO but annotations enhanced
for class, method, parameterVery unobtrusive model, no one harms for
thisPage is a class to map an url for a pojo.Page has action methods for executing
user request.Action parameter is injected by T2
Programming model(cont’d)
Example: @Page("employee") public class EmployeePage { @Default public Navigation index(WebContext context) { …... } @GET @ActionPath("list/detail") public Navigation detail(WebContext context) { …… } }
Action method design
Funnel-like designPage class is created as you put url and
its parameter from whole to detailSet url for a page Set url for an action method Set parameter whichever you would like to
receive
Action method design(cont’d)
Example: HTTP GET /hoge/foo?bar=2Page class takes /hoge as urlAction method tales /foo as urlMethod args takes bar as String
So it is like:@Page("/hoge”)public YourPage { @GET @ActionPath(“hoge”) public Navigation hoge(@RequestParam("bar") String bar) {
Action parameter design
Action parameter is injected by T2T2 prepared contexts
WebContext/Request/Response…
Servlet spec contextsHttpServletRequest/HttpServletResponse…
Converted POJO from form dataFrom HTTP POST, or from Flex AMF
Useful parametersREST-like some url, or foreach index, upload
file…
Take a look code!
@Page(”sample") public class SamplePage { @Default public Navigation index(WebContext context) {… @Amf public Navigation execute(HogeDto hoge) {… @ActionParam public Navigation submit(@Form FooDto foo) {… @ActionPath(“fuga/{moge}”) public Navigation submit(@Var(“moge”) String s)
{…
Core components
@PageHTTP handling using @GET/@POSTURL pattern matching by @ActionPathRequest data matching by
@ActionParamRequest type matching by @Ajax/@AmfReturn type, NavigationContainerAdapter for integrate with DI
container
@Page
The root annotation for T2 PagePage must have @Page.T2 does not have any configuration
except web.xml and @PageTraverse by class path and finds page
classes
HTTP matching
HTTP matching is the first thing T2 does for action methodsGET, POST, PUT, DELETE, even HEAD.These are distinguished by annotation
like @GET or @POST
URL matching for action method
URL matching for action method@ActionPath is the main role to do@Page(“hoge”) + @ActionPath(“foo”) -
> /hoge/foo is the url to access to the method
Data matching for action method
Data matching for action method@ActionParam is the main role to doMatch submitted request parameter
name.If it’s @ActionParam(“execute”), execute the
action method if request paramete name “execute” exist
Usually it is used to separate user submit action.
• Data update button, cancel button, things like that.
Request type matching
T2 can separate methods for request type.@Ajax
Accept only XmlHttpRequest, not othersDone by “X-Requested-With” header
@AmfAccept only Flex/AIR AMF request, not othersDone by content-type header
Request type is importantThe logic must be different with sync/async.
Default method for a page
Default method is always good to have.At least some odd error does not happenDefault behavior takes over and user
doesn’t feel uncomfortable
@Default is for default methodUsually returns default page transition.Sometimes clear states if application
contains.
Navigation
Navigation is the user interface for:Telling T2 where the transition goesTelling T2 how view will be rendered
Navigation is:Very simple to use.Extensible.Developer can implement
easily.
Default prepared navigations
Default navigationsForward/Redirect/Proceed(Psuedo
redirect)Json(or SecureJson using json-prefixing)Direct(Stream response)AmfResponse(Flex AMF)CacheManifest(Generate HTML5 manifest)In the future:
CVS, PDF, GoogleMaps, or Charts.
ContainerAdapter
Dependency Injection is the defacto technology for easy and maintainable developmentT2 provides adapters for these
containers:Spring/Guice/Seasar2 or our Lucy
It can use by settings using web.xml<init-param> <param-name>t2.container.adapter</param-name> <param-value>org.t2framework.t2.adapter.SpringAdapter</param-value></init-param>
Demos
RIA type demoPureMVC + T2 + Spring + iBatisComplete sample for CRUD
Cloud type demoFlex + GAEJ + T2Using T2 AMF3 implementation
Where is my lovely iPhone? Mushup DemoGeolocation(ajax) + T2 + Yahoo local search
+ iPhone serversman web server
Conclusion
Web development will be re-invented by:RIP, mostly HTML5Cloud environmentMultiple HTTP based formats
T2 framework is the simple framework for working well with these environments.
Resources
Sitehttp://code.google.com/p/t-2/
Downloadhttp://code.google.com/p/t-2/downloads/
list
Maven sitehttp://maven.t2framework.org/maven2/
Resources(cont’d)
Documentshttp://code.google.com/p/t-2/wiki/Index
Mailing listhttp://groups.google.com/group/t2-users-
en
Sourcehttp://code.google.com/p/t-2/source/
checkout
Thanks!!