[{"data":1,"prerenderedAt":1622},["ShallowReactive",2],{"navigation":3,"\u002Fblog\u002F2010-12-15-gwt-and-guice":406,"\u002Fblog\u002F2010-12-15-gwt-and-guice-surround":1612},[4,8,39,52,264,310,319,380,397],{"title":5,"path":6,"stem":7},"Notes","\u002Fnotes","1.notes\u002Findex",{"title":9,"path":10,"stem":11,"children":12,"page":30},"Architecture","\u002Fnotes\u002Farchitecture","1.notes\u002Farchitecture",[13,17,31,35],{"title":14,"path":15,"stem":16},"API Management","\u002Fnotes\u002Farchitecture\u002Fapi-management","1.notes\u002Farchitecture\u002Fapi-management",{"title":18,"path":19,"stem":20,"children":21,"page":30},"Data","\u002Fnotes\u002Farchitecture\u002Fdata","1.notes\u002Farchitecture\u002Fdata",[22,26],{"title":23,"path":24,"stem":25},"ERD","\u002Fnotes\u002Farchitecture\u002Fdata\u002Ferd","1.notes\u002Farchitecture\u002Fdata\u002Ferd",{"title":27,"path":28,"stem":29},"SCWD","\u002Fnotes\u002Farchitecture\u002Fdata\u002Fscwd","1.notes\u002Farchitecture\u002Fdata\u002Fscwd",false,{"title":32,"path":33,"stem":34},"Microservices","\u002Fnotes\u002Farchitecture\u002Fmicroservices","1.notes\u002Farchitecture\u002Fmicroservices",{"title":36,"path":37,"stem":38},"OAuth","\u002Fnotes\u002Farchitecture\u002Foauth","1.notes\u002Farchitecture\u002Foauth",{"title":40,"path":41,"stem":42,"children":43,"page":30},"Archive","\u002Fnotes\u002Farchive","1.notes\u002Farchive",[44,48],{"title":45,"path":46,"stem":47},"Google Web Toolkit","\u002Fnotes\u002Farchive\u002Fgwt","1.notes\u002Farchive\u002Fgwt",{"title":49,"path":50,"stem":51},"Jekyll","\u002Fnotes\u002Farchive\u002Fjekyll","1.notes\u002Farchive\u002Fjekyll",{"title":53,"path":54,"stem":55,"children":56,"page":30},"Development","\u002Fnotes\u002Fdevelopment","1.notes\u002Fdevelopment",[57,74,112,149,226,239,260],{"title":58,"icon":30,"path":59,"stem":60,"children":61,"page":30},"IDE","\u002Fnotes\u002Fdevelopment\u002Fide","1.notes\u002Fdevelopment\u002FIDE",[62,66,70],{"title":63,"path":64,"stem":65},"Jetbrains IDE","\u002Fnotes\u002Fdevelopment\u002Fide\u002Fjetbrains","1.notes\u002Fdevelopment\u002FIDE\u002Fjetbrains",{"title":67,"path":68,"stem":69},"NVIM","\u002Fnotes\u002Fdevelopment\u002Fide\u002Fnvim","1.notes\u002Fdevelopment\u002FIDE\u002Fnvim",{"title":71,"path":72,"stem":73},"tmux","\u002Fnotes\u002Fdevelopment\u002Fide\u002Ftmux","1.notes\u002Fdevelopment\u002FIDE\u002Ftmux",{"title":75,"path":76,"stem":77,"children":78,"page":30},"Algo","\u002Fnotes\u002Fdevelopment\u002Falgo","1.notes\u002Fdevelopment\u002Falgo",[79,83,87,91,95],{"title":80,"path":81,"stem":82},"Algorithms","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Falgorithms","1.notes\u002Fdevelopment\u002Falgo\u002Falgorithms",{"title":84,"path":85,"stem":86},"Data Structures","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fdata_structures","1.notes\u002Fdevelopment\u002Falgo\u002Fdata_structures",{"title":88,"path":89,"stem":90},"Kata","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fkata","1.notes\u002Fdevelopment\u002Falgo\u002Fkata",{"title":92,"path":93,"stem":94},"O-notation","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fo-notation","1.notes\u002Fdevelopment\u002Falgo\u002Fo-notation",{"title":96,"path":97,"stem":98,"children":99,"page":30},"Sorting","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting",[100,104,108],{"title":101,"path":102,"stem":103},"Buble Sort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fbublesort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fbublesort",{"title":105,"path":106,"stem":107},"Merge Sort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fmergesort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fmergesort",{"title":109,"path":110,"stem":111},"Quicksort","\u002Fnotes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fquicksort","1.notes\u002Fdevelopment\u002Falgo\u002Fsorting\u002Fquicksort",{"title":113,"path":114,"stem":115,"children":116,"page":30},"DataStructures","\u002Fnotes\u002Fdevelopment\u002Fdata_structures","1.notes\u002Fdevelopment\u002Fdata_structures",[117,121,125,129,133,137,141,145],{"title":118,"path":119,"stem":120},"ArrayList","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Farray_list","1.notes\u002Fdevelopment\u002Fdata_structures\u002Farray_list",{"title":122,"path":123,"stem":124},"Arrays","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Farrays","1.notes\u002Fdevelopment\u002Fdata_structures\u002Farrays",{"title":126,"path":127,"stem":128},"HashSet","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fhash_set","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fhash_set",{"title":130,"path":131,"stem":132},"LinkedList","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Flinked_list","1.notes\u002Fdevelopment\u002Fdata_structures\u002Flinked_list",{"title":134,"path":135,"stem":136},"PriorityQueue","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fpriority_queue","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fpriority_queue",{"title":138,"path":139,"stem":140},"Stack","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fstack","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fstack",{"title":142,"path":143,"stem":144},"TreeSet","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Ftree_set","1.notes\u002Fdevelopment\u002Fdata_structures\u002Ftree_set",{"title":146,"path":147,"stem":148},"Vector","\u002Fnotes\u002Fdevelopment\u002Fdata_structures\u002Fvector","1.notes\u002Fdevelopment\u002Fdata_structures\u002Fvector",{"title":150,"path":151,"stem":152,"children":153,"page":30},"Java","\u002Fnotes\u002Fdevelopment\u002Fjava","1.notes\u002Fdevelopment\u002Fjava",[154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222],{"title":155,"path":156,"stem":157},"Bit Operations","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fbit-operations","1.notes\u002Fdevelopment\u002Fjava\u002Fbit-operations",{"title":159,"path":160,"stem":161},"Cheatsheet","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fcheatsheet","1.notes\u002Fdevelopment\u002Fjava\u002Fcheatsheet",{"title":163,"path":164,"stem":165},"Clean Code","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fclean-code-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fclean-code-presentation",{"title":167,"path":168,"stem":169},"Java Datasource","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fdata-sources","1.notes\u002Fdevelopment\u002Fjava\u002Fdata-sources",{"title":171,"path":172,"stem":173},"Dependency Injection","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fdependency-injection-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fdependency-injection-presentation",{"title":175,"path":176,"stem":177},"Java SE","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjava-standard-edition","1.notes\u002Fdevelopment\u002Fjava\u002Fjava-standard-edition",{"title":179,"path":180,"stem":181},"Java Memory Model","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjmm","1.notes\u002Fdevelopment\u002Fjava\u002Fjmm",{"title":183,"path":184,"stem":185},"JPA","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fjpa","1.notes\u002Fdevelopment\u002Fjava\u002Fjpa",{"title":187,"path":188,"stem":189},"Keywords","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fkeywords","1.notes\u002Fdevelopment\u002Fjava\u002Fkeywords",{"title":191,"path":192,"stem":193},"Maven","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fmaven","1.notes\u002Fdevelopment\u002Fjava\u002Fmaven",{"title":195,"path":196,"stem":197},"Spring AOP","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-aop-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-aop-presentation",{"title":199,"path":200,"stem":201},"Spring Boot","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-boot","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-boot",{"title":203,"path":204,"stem":205},"Spring Core","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-core-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-core-presentation",{"title":207,"path":208,"stem":209},"Spring Data","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-data","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-data",{"title":211,"path":212,"stem":213},"Spring JDBC","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-jdbc","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-jdbc",{"title":215,"path":216,"stem":217},"Spring MVC","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-mvc-presentation","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-mvc-presentation",{"title":219,"path":220,"stem":221},"Spring Security","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Fspring-security","1.notes\u002Fdevelopment\u002Fjava\u002Fspring-security",{"title":223,"path":224,"stem":225},"Testing","\u002Fnotes\u002Fdevelopment\u002Fjava\u002Ftesting","1.notes\u002Fdevelopment\u002Fjava\u002Ftesting",{"title":227,"path":228,"stem":229,"children":230,"page":30},"Js","\u002Fnotes\u002Fdevelopment\u002Fjs","1.notes\u002Fdevelopment\u002Fjs",[231,235],{"title":232,"path":233,"stem":234},"JavaScript","\u002Fnotes\u002Fdevelopment\u002Fjs\u002Fjava-script","1.notes\u002Fdevelopment\u002Fjs\u002Fjava-script",{"title":236,"path":237,"stem":238},"NodeJS","\u002Fnotes\u002Fdevelopment\u002Fjs\u002Fnode-js","1.notes\u002Fdevelopment\u002Fjs\u002Fnode-js",{"title":240,"path":241,"stem":242,"children":243,"page":30},"PowerPlatform","\u002Fnotes\u002Fdevelopment\u002Fpower_platform","1.notes\u002Fdevelopment\u002Fpower_platform",[244,248,252,256],{"title":245,"path":246,"stem":247},"Power Apps","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-apps","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-apps",{"title":249,"path":250,"stem":251},"Power Automate","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-automate","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-automate",{"title":253,"path":254,"stem":255},"Power BI","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fpower-bi","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fpower-bi",{"title":257,"path":258,"stem":259},"Sharepoint","\u002Fnotes\u002Fdevelopment\u002Fpower_platform\u002Fsharepoint","1.notes\u002Fdevelopment\u002Fpower_platform\u002Fsharepoint",{"title":261,"path":262,"stem":263},"Python","\u002Fnotes\u002Fdevelopment\u002Fpython","1.notes\u002Fdevelopment\u002Fpython",{"title":265,"path":266,"stem":267,"children":268,"page":30},"Devops","\u002Fnotes\u002Fdevops","1.notes\u002Fdevops",[269,273,277,281,285,289,293,297,306],{"title":270,"path":271,"stem":272},"Containers","\u002Fnotes\u002Fdevops\u002Fcontainers","1.notes\u002Fdevops\u002Fcontainers",{"title":274,"path":275,"stem":276},"Curl","\u002Fnotes\u002Fdevops\u002Fcurl","1.notes\u002Fdevops\u002Fcurl",{"title":278,"path":279,"stem":280},"GCP","\u002Fnotes\u002Fdevops\u002Fgcp","1.notes\u002Fdevops\u002Fgcp",{"title":282,"path":283,"stem":284},"GIT","\u002Fnotes\u002Fdevops\u002Fgit","1.notes\u002Fdevops\u002Fgit",{"title":286,"path":287,"stem":288},"Jenkins","\u002Fnotes\u002Fdevops\u002Fjenkins","1.notes\u002Fdevops\u002Fjenkins",{"title":290,"path":291,"stem":292},"Kubernetes","\u002Fnotes\u002Fdevops\u002Fkubernetes","1.notes\u002Fdevops\u002Fkubernetes",{"title":294,"path":295,"stem":296},"Linux","\u002Fnotes\u002Fdevops\u002Flinux","1.notes\u002Fdevops\u002Flinux",{"title":298,"path":299,"stem":300,"children":301,"page":30},"Os","\u002Fnotes\u002Fdevops\u002Fos","1.notes\u002Fdevops\u002Fos",[302],{"title":303,"path":304,"stem":305},"MAC OS","\u002Fnotes\u002Fdevops\u002Fos\u002Fmacos","1.notes\u002Fdevops\u002Fos\u002Fmacos",{"title":307,"path":308,"stem":309},"WSL","\u002Fnotes\u002Fdevops\u002Fwsl","1.notes\u002Fdevops\u002Fwsl",{"title":311,"path":312,"stem":313,"children":314,"page":30},"Hardware","\u002Fnotes\u002Fhardware","1.notes\u002Fhardware",[315],{"title":316,"path":317,"stem":318},"Keyboard","\u002Fnotes\u002Fhardware\u002Fkeyboard","1.notes\u002Fhardware\u002Fkeyboard",{"title":320,"path":321,"stem":322,"children":323,"page":30},"Homelab","\u002Fnotes\u002Fhomelab","1.notes\u002Fhomelab",[324,328,337,350],{"title":325,"path":326,"stem":327},"Proxmox","\u002Fnotes\u002Fhomelab\u002F_-proxmox-1","1.notes\u002Fhomelab\u002F_ proxmox 1",{"title":329,"path":330,"stem":331,"children":332,"page":30},"Cloudflare","\u002Fnotes\u002Fhomelab\u002Fcloudflare","1.notes\u002Fhomelab\u002Fcloudflare",[333],{"title":334,"path":335,"stem":336},"Cloudflare Workers","\u002Fnotes\u002Fhomelab\u002Fcloudflare\u002Fworkers","1.notes\u002Fhomelab\u002Fcloudflare\u002Fworkers",{"title":338,"path":339,"stem":340,"children":341,"page":30},"HomeAssistant","\u002Fnotes\u002Fhomelab\u002Fhome_assistant","1.notes\u002Fhomelab\u002Fhome_assistant",[342,346],{"title":343,"path":344,"stem":345},"EspHome debugger","\u002Fnotes\u002Fhomelab\u002Fhome_assistant\u002Fesphome-debugger","1.notes\u002Fhomelab\u002Fhome_assistant\u002Fesphome-debugger",{"title":347,"path":348,"stem":349},"GIT integration","\u002Fnotes\u002Fhomelab\u002Fhome_assistant\u002Fgit-integration","1.notes\u002Fhomelab\u002Fhome_assistant\u002Fgit-integration",{"title":325,"path":351,"stem":352,"children":353},"\u002Fnotes\u002Fhomelab\u002Fproxmox","1.notes\u002Fhomelab\u002Fproxmox",[354,358,362,365,369,373,377],{"title":355,"path":356,"stem":357},"Issue: TASK ERROR: Device \u002Fdev\u002Fdri\u002Fcard1 does not exist","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fissue_task_error_device_dev_dri_card1_does-not-exist","1.notes\u002Fhomelab\u002Fproxmox\u002FIssue_TASK_ERROR_device_dev_dri_card1_does not exist",{"title":359,"path":360,"stem":361},"Mount USB Drive To LXC Container","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fmount-usb-drive-to-lxc-container","1.notes\u002Fhomelab\u002Fproxmox\u002FMount USB drive to LXC container",{"title":325,"path":363,"stem":364},"\u002Fnotes\u002Fhomelab\u002Fproxmox\u002F_-proxmox","1.notes\u002Fhomelab\u002Fproxmox\u002F_ proxmox",{"title":366,"path":367,"stem":368},"ARR","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Farr","1.notes\u002Fhomelab\u002Fproxmox\u002Farr",{"title":370,"path":371,"stem":372},"Auto login via SSH from Proxmox UI","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fauto_login_via_ssh_from_proxmox_ui","1.notes\u002Fhomelab\u002Fproxmox\u002Fauto_login_via_ssh_from_proxmox_ui",{"title":374,"path":375,"stem":376},"Installation","\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fdokploy","1.notes\u002Fhomelab\u002Fproxmox\u002Fdokploy",{"title":290,"path":378,"stem":379},"\u002Fnotes\u002Fhomelab\u002Fproxmox\u002Fkubernetes","1.notes\u002Fhomelab\u002Fproxmox\u002Fkubernetes",{"title":381,"path":382,"stem":383,"children":384,"page":30},"Leadership","\u002Fnotes\u002Fleadership","1.notes\u002Fleadership",[385,389,393],{"title":386,"path":387,"stem":388},"Leader Toolbox","\u002Fnotes\u002Fleadership\u002Fleader-toolbox","1.notes\u002Fleadership\u002Fleader-toolbox",{"title":390,"path":391,"stem":392},"Enterprise Project Structure","\u002Fnotes\u002Fleadership\u002Fproject-doc-structure","1.notes\u002Fleadership\u002Fproject-doc-structure",{"title":394,"path":395,"stem":396},"Scrum template","\u002Fnotes\u002Fleadership\u002Fscrum-template","1.notes\u002Fleadership\u002Fscrum-template",{"title":398,"path":399,"stem":400,"children":401,"page":30},"Products","\u002Fnotes\u002Fproducts","1.notes\u002Fproducts",[402],{"title":403,"path":404,"stem":405},"BigQuery","\u002Fnotes\u002Fproducts\u002Fgcp-big-query","1.notes\u002Fproducts\u002Fgcp-big-query",{"id":407,"title":408,"authors":409,"badge":409,"body":410,"date":1603,"description":1604,"extension":1605,"image":409,"meta":1606,"navigation":440,"path":1608,"seo":1609,"stem":1610,"__hash__":1611},"posts\u002F2.blog\u002F2010-12-15-gwt-and-guice.md","Google Web Toolkit + Guice",null,{"type":411,"value":412,"toc":1601},"minimark",[413,417,524,527,564,567,586,589,641,644,743,746,755,758,780,783,819,822,870,873,876,921,924,968,971,974,1016,1019,1052,1058,1061,1149,1152,1155,1198,1201,1210,1213,1222,1225,1234,1237,1240,1277,1280,1283,1399,1594,1597],[414,415,416],"p",{},"Guice jest frameworkiem dostarczającym tzn. wstrzykiwania zależności w naszej części serwerowej aplikacji.\nGdybyśmy rozważali aplikację typu desktop poniższa konfiguracja w zupełności by wystarczyła:",[418,419,424],"pre",{"className":420,"code":421,"language":422,"meta":423,"style":423},"language-java shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","package testingguice;\n\nimport com.google.inject.AbstractModule;\nimport com.google.inject.Guice;\nimport com.google.inject.Injector;\n\npublic class Main {\n\n    public static void main(String[] args) {\n        Injector injector = Guice.createInjector(new MyModule());\n        PersonDao personDao = injector.getInstance(PersonDao.class);\n        for (Person person : personDao.getAll()) {\n            System.out.println(\"Person: \"+person);\n        }\n    }\n}\n","java","",[425,426,427,435,442,448,454,460,465,471,476,482,488,494,500,506,512,518],"code",{"__ignoreMap":423},[428,429,432],"span",{"class":430,"line":431},"line",1,[428,433,434],{},"package testingguice;\n",[428,436,438],{"class":430,"line":437},2,[428,439,441],{"emptyLinePlaceholder":440},true,"\n",[428,443,445],{"class":430,"line":444},3,[428,446,447],{},"import com.google.inject.AbstractModule;\n",[428,449,451],{"class":430,"line":450},4,[428,452,453],{},"import com.google.inject.Guice;\n",[428,455,457],{"class":430,"line":456},5,[428,458,459],{},"import com.google.inject.Injector;\n",[428,461,463],{"class":430,"line":462},6,[428,464,441],{"emptyLinePlaceholder":440},[428,466,468],{"class":430,"line":467},7,[428,469,470],{},"public class Main {\n",[428,472,474],{"class":430,"line":473},8,[428,475,441],{"emptyLinePlaceholder":440},[428,477,479],{"class":430,"line":478},9,[428,480,481],{},"    public static void main(String[] args) {\n",[428,483,485],{"class":430,"line":484},10,[428,486,487],{},"        Injector injector = Guice.createInjector(new MyModule());\n",[428,489,491],{"class":430,"line":490},11,[428,492,493],{},"        PersonDao personDao = injector.getInstance(PersonDao.class);\n",[428,495,497],{"class":430,"line":496},12,[428,498,499],{},"        for (Person person : personDao.getAll()) {\n",[428,501,503],{"class":430,"line":502},13,[428,504,505],{},"            System.out.println(\"Person: \"+person);\n",[428,507,509],{"class":430,"line":508},14,[428,510,511],{},"        }\n",[428,513,515],{"class":430,"line":514},15,[428,516,517],{},"    }\n",[428,519,521],{"class":430,"line":520},16,[428,522,523],{},"}\n",[414,525,526],{},"Klasa modułu w rozumieniu IoC:",[418,528,530],{"className":420,"code":529,"language":422,"meta":423,"style":423},"public class MyModule extends AbstractModule {\n\n    @Override\n    protected void configure() {\n        bind(PersonDao.class).to(PersonDaoImpl.class);\n    }\n}\n",[425,531,532,537,541,546,551,556,560],{"__ignoreMap":423},[428,533,534],{"class":430,"line":431},[428,535,536],{},"public class MyModule extends AbstractModule {\n",[428,538,539],{"class":430,"line":437},[428,540,441],{"emptyLinePlaceholder":440},[428,542,543],{"class":430,"line":444},[428,544,545],{},"    @Override\n",[428,547,548],{"class":430,"line":450},[428,549,550],{},"    protected void configure() {\n",[428,552,553],{"class":430,"line":456},[428,554,555],{},"        bind(PersonDao.class).to(PersonDaoImpl.class);\n",[428,557,558],{"class":430,"line":462},[428,559,517],{},[428,561,562],{"class":430,"line":467},[428,563,523],{},[414,565,566],{},"Interfejs przykładowego DAO dla klasy Person:",[418,568,570],{"className":420,"code":569,"language":422,"meta":423,"style":423},"public interface PersonDao {\n    public List\u003CPerson> getAll();\n}\n",[425,571,572,577,582],{"__ignoreMap":423},[428,573,574],{"class":430,"line":431},[428,575,576],{},"public interface PersonDao {\n",[428,578,579],{"class":430,"line":437},[428,580,581],{},"    public List\u003CPerson> getAll();\n",[428,583,584],{"class":430,"line":444},[428,585,523],{},[414,587,588],{},"Implementacja naszego interfejsu, którą dzięki IoC możemy w łatwy sposób podmienić na inną implementującą ten sam interfejs:",[418,590,592],{"className":420,"code":591,"language":422,"meta":423,"style":423},"public class PersonDaoImpl implements PersonDao{\n\n    public List\u003CPerson> getAll() {\n        ArrayList\u003CPerson> list = new ArrayList\u003CPerson>();\n        list.add(new Person(1, \"Jacek\"));\n        list.add(new Person(2, \"Zbyszek\"));\n        list.add(new Person(3, \"Piotrek\"));\n        return list;\n    }\n}\n",[425,593,594,599,603,608,613,618,623,628,633,637],{"__ignoreMap":423},[428,595,596],{"class":430,"line":431},[428,597,598],{},"public class PersonDaoImpl implements PersonDao{\n",[428,600,601],{"class":430,"line":437},[428,602,441],{"emptyLinePlaceholder":440},[428,604,605],{"class":430,"line":444},[428,606,607],{},"    public List\u003CPerson> getAll() {\n",[428,609,610],{"class":430,"line":450},[428,611,612],{},"        ArrayList\u003CPerson> list = new ArrayList\u003CPerson>();\n",[428,614,615],{"class":430,"line":456},[428,616,617],{},"        list.add(new Person(1, \"Jacek\"));\n",[428,619,620],{"class":430,"line":462},[428,621,622],{},"        list.add(new Person(2, \"Zbyszek\"));\n",[428,624,625],{"class":430,"line":467},[428,626,627],{},"        list.add(new Person(3, \"Piotrek\"));\n",[428,629,630],{"class":430,"line":473},[428,631,632],{},"        return list;\n",[428,634,635],{"class":430,"line":478},[428,636,517],{},[428,638,639],{"class":430,"line":484},[428,640,523],{},[414,642,643],{},"Przykładowe POJO wykorzystywane w DAO:",[418,645,647],{"className":420,"code":646,"language":422,"meta":423,"style":423},"public class Person {\n    private int id;\n    private String name;\n\n    public Person() {\n    }\n\n    public Person(int id, String name) {\n        this.id = id;\n        this.name = name;\n    }\n\n    ...\n\n    @Override\n    public String toString() {\n        return \"Person{\" + \"id=\" + id + \",name=\" + name + '}';\n    }\n\n}\n",[425,648,649,654,659,664,668,673,677,681,686,691,696,700,704,709,713,717,722,728,733,738],{"__ignoreMap":423},[428,650,651],{"class":430,"line":431},[428,652,653],{},"public class Person {\n",[428,655,656],{"class":430,"line":437},[428,657,658],{},"    private int id;\n",[428,660,661],{"class":430,"line":444},[428,662,663],{},"    private String name;\n",[428,665,666],{"class":430,"line":450},[428,667,441],{"emptyLinePlaceholder":440},[428,669,670],{"class":430,"line":456},[428,671,672],{},"    public Person() {\n",[428,674,675],{"class":430,"line":462},[428,676,517],{},[428,678,679],{"class":430,"line":467},[428,680,441],{"emptyLinePlaceholder":440},[428,682,683],{"class":430,"line":473},[428,684,685],{},"    public Person(int id, String name) {\n",[428,687,688],{"class":430,"line":478},[428,689,690],{},"        this.id = id;\n",[428,692,693],{"class":430,"line":484},[428,694,695],{},"        this.name = name;\n",[428,697,698],{"class":430,"line":490},[428,699,517],{},[428,701,702],{"class":430,"line":496},[428,703,441],{"emptyLinePlaceholder":440},[428,705,706],{"class":430,"line":502},[428,707,708],{},"    ...\n",[428,710,711],{"class":430,"line":508},[428,712,441],{"emptyLinePlaceholder":440},[428,714,715],{"class":430,"line":514},[428,716,545],{},[428,718,719],{"class":430,"line":520},[428,720,721],{},"    public String toString() {\n",[428,723,725],{"class":430,"line":724},17,[428,726,727],{},"        return \"Person{\" + \"id=\" + id + \",name=\" + name + '}';\n",[428,729,731],{"class":430,"line":730},18,[428,732,517],{},[428,734,736],{"class":430,"line":735},19,[428,737,441],{"emptyLinePlaceholder":440},[428,739,741],{"class":430,"line":740},20,[428,742,523],{},[414,744,745],{},"My jednak korzystamy z aplikacji JEE, z którą nie jest aż tak łatwo. Aplikacja, która jest deployowana na serwer przed pierwszym wywołaniem strony ładującej powinna zostać zainicjonowana, co zostało zrobione w przypadku aplikacji desktopowej tu:",[418,747,749],{"className":420,"code":748,"language":422,"meta":423,"style":423},"Injector injector = Guice.createInjector(new MyModule());\n",[425,750,751],{"__ignoreMap":423},[428,752,753],{"class":430,"line":431},[428,754,748],{},[414,756,757],{},"W aplikacji typu web za pomocą małego wpisu w web.xml:",[418,759,763],{"className":760,"code":761,"language":762,"meta":423,"style":423},"language-xml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003Clistener>\n  \u003Clistener-class>pl.testing.server.GuiceServletConfig\u003C\u002Flistener-class>\n\u003C\u002Flistener>\n","xml",[425,764,765,770,775],{"__ignoreMap":423},[428,766,767],{"class":430,"line":431},[428,768,769],{},"\u003Clistener>\n",[428,771,772],{"class":430,"line":437},[428,773,774],{},"  \u003Clistener-class>pl.testing.server.GuiceServletConfig\u003C\u002Flistener-class>\n",[428,776,777],{"class":430,"line":444},[428,778,779],{},"\u003C\u002Flistener>\n",[414,781,782],{},"sprawiamy, że zaraz po zdeployowaniu aplikacji zostanie od razu wywołana wskazana klasa dziedzicząca po ContextListener. Wykorzystamy ten fakt do zainicjonowania naszego injectora. W tym przypadku będziemy posiłkować się dodatkowo klasą GuiceServletContextListener, która wspomaga nas i odciąża tak, że wszystko co musimy zrobić to zwrócić injector:",[418,784,786],{"className":420,"code":785,"language":422,"meta":423,"style":423},"public class MainGuiceServletContextListener extends GuiceServletContextListener {\n\n    @Override\n    protected Injector getInjector() {\n        return Guice.createInjector(new MainGuiceModule());\n    }\n}\n",[425,787,788,793,797,801,806,811,815],{"__ignoreMap":423},[428,789,790],{"class":430,"line":431},[428,791,792],{},"public class MainGuiceServletContextListener extends GuiceServletContextListener {\n",[428,794,795],{"class":430,"line":437},[428,796,441],{"emptyLinePlaceholder":440},[428,798,799],{"class":430,"line":444},[428,800,545],{},[428,802,803],{"class":430,"line":450},[428,804,805],{},"    protected Injector getInjector() {\n",[428,807,808],{"class":430,"line":456},[428,809,810],{},"        return Guice.createInjector(new MainGuiceModule());\n",[428,812,813],{"class":430,"line":462},[428,814,517],{},[428,816,817],{"class":430,"line":467},[428,818,523],{},[414,820,821],{},"Resztą tzn. pobieraniem instancji z injectora zajmie się specjalnie przygotowany przez nas w web.xml filtr:",[418,823,825],{"className":760,"code":824,"language":762,"meta":423,"style":423},"  \u003Cfilter>\n    \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n    \u003Cfilter-class>com.google.inject.servlet.GuiceFilter\u003C\u002Ffilter-class>\n  \u003C\u002Ffilter>\n\n  \u003Cfilter-mapping>\n    \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n    \u003Curl-pattern>\u002F*\u003C\u002Furl-pattern>\n  \u003C\u002Ffilter-mapping>\n",[425,826,827,832,837,842,847,851,856,860,865],{"__ignoreMap":423},[428,828,829],{"class":430,"line":431},[428,830,831],{},"  \u003Cfilter>\n",[428,833,834],{"class":430,"line":437},[428,835,836],{},"    \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n",[428,838,839],{"class":430,"line":444},[428,840,841],{},"    \u003Cfilter-class>com.google.inject.servlet.GuiceFilter\u003C\u002Ffilter-class>\n",[428,843,844],{"class":430,"line":450},[428,845,846],{},"  \u003C\u002Ffilter>\n",[428,848,849],{"class":430,"line":456},[428,850,441],{"emptyLinePlaceholder":440},[428,852,853],{"class":430,"line":462},[428,854,855],{},"  \u003Cfilter-mapping>\n",[428,857,858],{"class":430,"line":467},[428,859,836],{},[428,861,862],{"class":430,"line":473},[428,863,864],{},"    \u003Curl-pattern>\u002F*\u003C\u002Furl-pattern>\n",[428,866,867],{"class":430,"line":478},[428,868,869],{},"  \u003C\u002Ffilter-mapping>\n",[414,871,872],{},"Jest to następna sztuczka wykorzystywana przez Guice’a. Gdybyśmy nie wykorzystali filtra każdorazowo gdy żądamy zawartości serwleta zostałaby stworzona instancja serwleta uruchomiona i zwrócony efekt jego przetwarzania. Natomiast wykorzystując filtr jesteśmy w stanie do wybranych (najczęściej dla wszystkich) serwletów wstrzyknąć odpowiednie zależności konfiguracyjne.",[414,874,875],{},"Konfigurując moduł w następujący sposób mapujemy wywołanie adresu: \u002Fexamplexmlrpc z ExampleRpcImpl.class:",[418,877,879],{"className":420,"code":878,"language":422,"meta":423,"style":423},"public class GuiceModule extends ServletModule{\n\n    @Override\n    protected void configureServlets() {\n        super.configureServlets();\n        serve(\"\u002Fexamplerpc\").with(ExampleRpcImpl.class);\n\n    }\n}\n",[425,880,881,886,890,894,899,904,909,913,917],{"__ignoreMap":423},[428,882,883],{"class":430,"line":431},[428,884,885],{},"public class GuiceModule extends ServletModule{\n",[428,887,888],{"class":430,"line":437},[428,889,441],{"emptyLinePlaceholder":440},[428,891,892],{"class":430,"line":444},[428,893,545],{},[428,895,896],{"class":430,"line":450},[428,897,898],{},"    protected void configureServlets() {\n",[428,900,901],{"class":430,"line":456},[428,902,903],{},"        super.configureServlets();\n",[428,905,906],{"class":430,"line":462},[428,907,908],{},"        serve(\"\u002Fexamplerpc\").with(ExampleRpcImpl.class);\n",[428,910,911],{"class":430,"line":467},[428,912,441],{"emptyLinePlaceholder":440},[428,914,915],{"class":430,"line":473},[428,916,517],{},[428,918,919],{"class":430,"line":478},[428,920,523],{},[414,922,923],{},"Jest to dokładnie odpowiednik wpisu w web.xml:",[418,925,927],{"className":760,"code":926,"language":762,"meta":423,"style":423},"    \u003Cservlet>\n        \u003Cservlet-name>ExampleRpc\u003C\u002Fservlet-name>\n        \u003Cservlet-class>pl.testing.server.ExampleRpcImpl\u003C\u002Fservlet-class>\n    \u003C\u002Fservlet>\n    \u003Cservlet-mapping>\n        \u003Cservlet-name>ExampleRpc\u003C\u002Fservlet-name>\n        \u003Curl-pattern>\u002Fpl.testing.Main\u002Fexamplerpc\u003C\u002Furl-pattern>\n    \u003C\u002Fservlet-mapping>\n",[425,928,929,934,939,944,949,954,958,963],{"__ignoreMap":423},[428,930,931],{"class":430,"line":431},[428,932,933],{},"    \u003Cservlet>\n",[428,935,936],{"class":430,"line":437},[428,937,938],{},"        \u003Cservlet-name>ExampleRpc\u003C\u002Fservlet-name>\n",[428,940,941],{"class":430,"line":444},[428,942,943],{},"        \u003Cservlet-class>pl.testing.server.ExampleRpcImpl\u003C\u002Fservlet-class>\n",[428,945,946],{"class":430,"line":450},[428,947,948],{},"    \u003C\u002Fservlet>\n",[428,950,951],{"class":430,"line":456},[428,952,953],{},"    \u003Cservlet-mapping>\n",[428,955,956],{"class":430,"line":462},[428,957,938],{},[428,959,960],{"class":430,"line":467},[428,961,962],{},"        \u003Curl-pattern>\u002Fpl.testing.Main\u002Fexamplerpc\u003C\u002Furl-pattern>\n",[428,964,965],{"class":430,"line":473},[428,966,967],{},"    \u003C\u002Fservlet-mapping>\n",[414,969,970],{},"Dzięki powyższemu zastąpieniu uzyskujemy zdecydowanie bardziej przyjazną konfigurację programiście. Dzięki temu rozwiązaniu możemy wykorzystać pełen potencjał naszego IDE i zapisywać bezbłędnie konfigurację przy pomocy autosugestii. W podobny sposób możemy nie tylko mapować serwlety, ale również i filtry. W praktyce większość konfiguracji może zostać przeniesiona z web.xml-a do odpowiednich modułów Guice-a. Na tym jednak nie koniec. Obecny stan wymaga podczas tworzenia połączenia GwtRpc następującego zapisu:",[414,972,973],{},"Część kliencka:",[418,975,977],{"className":420,"code":976,"language":422,"meta":423,"style":423},"@RemoteServiceRelativePath(\"..\u002Fexamplerpc\")\npublic interface ExampleRpc extends RemoteService {\n    public String myMethod(String s);\n}\n\npublic interface ExampleRpcAsync {\n    public void myMethod(String s, AsyncCallback\u003CString> callback);\n}\n",[425,978,979,984,989,994,998,1002,1007,1012],{"__ignoreMap":423},[428,980,981],{"class":430,"line":431},[428,982,983],{},"@RemoteServiceRelativePath(\"..\u002Fexamplerpc\")\n",[428,985,986],{"class":430,"line":437},[428,987,988],{},"public interface ExampleRpc extends RemoteService {\n",[428,990,991],{"class":430,"line":444},[428,992,993],{},"    public String myMethod(String s);\n",[428,995,996],{"class":430,"line":450},[428,997,523],{},[428,999,1000],{"class":430,"line":456},[428,1001,441],{"emptyLinePlaceholder":440},[428,1003,1004],{"class":430,"line":462},[428,1005,1006],{},"public interface ExampleRpcAsync {\n",[428,1008,1009],{"class":430,"line":467},[428,1010,1011],{},"    public void myMethod(String s, AsyncCallback\u003CString> callback);\n",[428,1013,1014],{"class":430,"line":473},[428,1015,523],{},[414,1017,1018],{},"I część serwerowa:",[418,1020,1022],{"className":420,"code":1021,"language":422,"meta":423,"style":423},"@Singleton\npublic class ExampleRpcImpl extends RemoteServiceServlet implements ExampleRpc {\n    public String myMethod(String s) {\n        return \"Server says: \" + s;\n    }\n}\n",[425,1023,1024,1029,1034,1039,1044,1048],{"__ignoreMap":423},[428,1025,1026],{"class":430,"line":431},[428,1027,1028],{},"@Singleton\n",[428,1030,1031],{"class":430,"line":437},[428,1032,1033],{},"public class ExampleRpcImpl extends RemoteServiceServlet implements ExampleRpc {\n",[428,1035,1036],{"class":430,"line":444},[428,1037,1038],{},"    public String myMethod(String s) {\n",[428,1040,1041],{"class":430,"line":450},[428,1042,1043],{},"        return \"Server says: \" + s;\n",[428,1045,1046],{"class":430,"line":456},[428,1047,517],{},[428,1049,1050],{"class":430,"line":462},[428,1051,523],{},[414,1053,1054,1055],{},"Jak widać w synchronicznym interfejsie nadal występuje niebezpieczeństwo pomyłki i konieczności zapamiętywania mapowania:\n",[425,1056,1057],{},"@RemoteServiceRelativePath(“..\u002Fexamplerpc”)",[414,1059,1060],{},"Dzięki kolejnej sztuczce wyeliminujemy i ten “boilerplate code” – kod narażony\u002Fnarażający na pomyłki. Dodajemy w części serwerowej klasę:",[418,1062,1064],{"className":420,"code":1063,"language":422,"meta":423,"style":423},"@Singleton\npublic class GuiceRemoteServiceServlet extends RemoteServiceServlet {\n\n    @Inject\n    private Injector injector;\n\n    @Override\n    public String processCall(String payload) throws SerializationException {\n        try {\n            RPCRequest req = RPC.decodeRequest(payload, null, this);\n            RemoteService service = (RemoteService) injector.getInstance(req.getMethod().getDeclaringClass());\n            return RPC.invokeAndEncodeResponse(service, req.getMethod(), req.getParameters(), req.getSerializationPolicy());\n        } catch (IncompatibleRemoteServiceException ex) {\n            log(\"IncompatibleRemoteServiceException in the processCall(String) method.\", ex);\n            return RPC.encodeResponseForFailure(null, ex);\n        }\n    }\n}\n",[425,1065,1066,1070,1075,1079,1084,1089,1093,1097,1102,1107,1112,1117,1122,1127,1132,1137,1141,1145],{"__ignoreMap":423},[428,1067,1068],{"class":430,"line":431},[428,1069,1028],{},[428,1071,1072],{"class":430,"line":437},[428,1073,1074],{},"public class GuiceRemoteServiceServlet extends RemoteServiceServlet {\n",[428,1076,1077],{"class":430,"line":444},[428,1078,441],{"emptyLinePlaceholder":440},[428,1080,1081],{"class":430,"line":450},[428,1082,1083],{},"    @Inject\n",[428,1085,1086],{"class":430,"line":456},[428,1087,1088],{},"    private Injector injector;\n",[428,1090,1091],{"class":430,"line":462},[428,1092,441],{"emptyLinePlaceholder":440},[428,1094,1095],{"class":430,"line":467},[428,1096,545],{},[428,1098,1099],{"class":430,"line":473},[428,1100,1101],{},"    public String processCall(String payload) throws SerializationException {\n",[428,1103,1104],{"class":430,"line":478},[428,1105,1106],{},"        try {\n",[428,1108,1109],{"class":430,"line":484},[428,1110,1111],{},"            RPCRequest req = RPC.decodeRequest(payload, null, this);\n",[428,1113,1114],{"class":430,"line":490},[428,1115,1116],{},"            RemoteService service = (RemoteService) injector.getInstance(req.getMethod().getDeclaringClass());\n",[428,1118,1119],{"class":430,"line":496},[428,1120,1121],{},"            return RPC.invokeAndEncodeResponse(service, req.getMethod(), req.getParameters(), req.getSerializationPolicy());\n",[428,1123,1124],{"class":430,"line":502},[428,1125,1126],{},"        } catch (IncompatibleRemoteServiceException ex) {\n",[428,1128,1129],{"class":430,"line":508},[428,1130,1131],{},"            log(\"IncompatibleRemoteServiceException in the processCall(String) method.\", ex);\n",[428,1133,1134],{"class":430,"line":514},[428,1135,1136],{},"            return RPC.encodeResponseForFailure(null, ex);\n",[428,1138,1139],{"class":430,"line":520},[428,1140,511],{},[428,1142,1143],{"class":430,"line":724},[428,1144,517],{},[428,1146,1147],{"class":430,"line":730},[428,1148,523],{},[414,1150,1151],{},"Jest to pośredniczący serwlet, dzięki któremu mapowanie urla na klasę serwleta zostanie zastąpione na bardzo dobrze znane i lubiane mapowanie konfiguracyjne tj. interfejsu na jego implementację. Rozwiązanie to zaproponował Eric Burke na łamach swojego bloga, które zdobyło ogromne uznanie wśród developerów GWT. W naszym przypadku osiągnęliśmy bardzo ciekawy efekt, mianowicie mapujemy interfej będący elementem części klienckiej na implementację serwerową.",[414,1153,1154],{},"Nasz plik konfiguracyjny w tym momencie wygląda następująco:",[418,1156,1158],{"className":420,"code":1157,"language":422,"meta":423,"style":423},"public class GuiceModule extends ServletModule{\n\n    @Override\n    protected void configureServlets() {\n        super.configureServlets();\n        serve(\"\u002FGWT.rpc\").with(GuiceRemoteServiceServlet.class);\n        bind(ExampleRpc.class).to(ExampleRpcImpl.class);\n    }\n}\n",[425,1159,1160,1164,1168,1172,1176,1180,1185,1190,1194],{"__ignoreMap":423},[428,1161,1162],{"class":430,"line":431},[428,1163,885],{},[428,1165,1166],{"class":430,"line":437},[428,1167,441],{"emptyLinePlaceholder":440},[428,1169,1170],{"class":430,"line":444},[428,1171,545],{},[428,1173,1174],{"class":430,"line":450},[428,1175,898],{},[428,1177,1178],{"class":430,"line":456},[428,1179,903],{},[428,1181,1182],{"class":430,"line":462},[428,1183,1184],{},"        serve(\"\u002FGWT.rpc\").with(GuiceRemoteServiceServlet.class);\n",[428,1186,1187],{"class":430,"line":467},[428,1188,1189],{},"        bind(ExampleRpc.class).to(ExampleRpcImpl.class);\n",[428,1191,1192],{"class":430,"line":473},[428,1193,517],{},[428,1195,1196],{"class":430,"line":478},[428,1197,523],{},[414,1199,1200],{},"Jak widać obsługujemy “\u002FGWT.rpc” za pomocą GuiceRemoteServiceServlet.class, który jest tak naprawdę naszym dispatcherem, czyli klasą delegującą. Oznacza to, że GuiceRemoteServiceServlet.class kontroluje ruch. Gdy po stronie klienckiej zostanie wywołany serwlet za pomocą urla: “\u002FGWT.rpc” zostanie wywołany właśnie nasz dispatcher. Wywołanie jest dekodowane:",[418,1202,1204],{"className":420,"code":1203,"language":422,"meta":423,"style":423},"RPCRequest req = RPC.decodeRequest(payload, null, this);\n",[425,1205,1206],{"__ignoreMap":423},[428,1207,1208],{"class":430,"line":431},[428,1209,1203],{},[414,1211,1212],{},"a następnie pobierana jest klasa wywołująca servlet:",[418,1214,1216],{"className":420,"code":1215,"language":422,"meta":423,"style":423},"req.getMethod().getDeclaringClass()\n",[425,1217,1218],{"__ignoreMap":423},[428,1219,1220],{"class":430,"line":431},[428,1221,1215],{},[414,1223,1224],{},"na podstawie której poprzez Injector otrzymujemy RemoteService, czyli klasę, z której musi dziedziczyć każdy servlet obsługujący GwtRPC. W naszym przypadku będzie to klasa, którą zbindowaliśmy z klasą wywołującą request. Dalsze linijki polegają na obsłudze samego wywołania oraz na zwróceniu odpowiedzi… ot i cała magia.\nNależy pamiętać, że w części klienckiej będziemy używać teraz za każdym razem adnotacji aby wszystko chodziło jak należy:",[418,1226,1228],{"className":420,"code":1227,"language":422,"meta":423,"style":423},"@RemoteServiceRelativePath(\"..\u002FGWT.rpc\")\n",[425,1229,1230],{"__ignoreMap":423},[428,1231,1232],{"class":430,"line":431},[428,1233,1227],{},[414,1235,1236],{},"Dzięki zastosowaniu powyższej metody otrzymaliśmy mechanizm, który pozwoli na klarowne bo nie w xml-u oraz bezpieczne pisanie konfiguracji w oparciu o autosugestie. Ponadto jest on idealnym wstępem do stworzenia modularnej części serwerowej aplikacji wykorzystującej GWT, ale o tym dowiecie się z przyszłych postów.",[414,1238,1239],{},"Podsumowując konfigurację Guice-a powinniśmy otrzymać przykładowy zestaw klas po stronie klienckiej:",[418,1241,1243],{"className":420,"code":1242,"language":422,"meta":423,"style":423},"@RemoteServiceRelativePath(\"..\u002FGWT.rpc\")\npublic interface ExampleRpc extends RemoteService {\n    public String myMethod(String s);\n}\n\npublic interface ExampleRpcAsync {\n    public void myMethod(String s, AsyncCallback\u003CString> callback);\n}\n",[425,1244,1245,1249,1253,1257,1261,1265,1269,1273],{"__ignoreMap":423},[428,1246,1247],{"class":430,"line":431},[428,1248,1227],{},[428,1250,1251],{"class":430,"line":437},[428,1252,988],{},[428,1254,1255],{"class":430,"line":444},[428,1256,993],{},[428,1258,1259],{"class":430,"line":450},[428,1260,523],{},[428,1262,1263],{"class":430,"line":456},[428,1264,441],{"emptyLinePlaceholder":440},[428,1266,1267],{"class":430,"line":462},[428,1268,1006],{},[428,1270,1271],{"class":430,"line":467},[428,1272,1011],{},[428,1274,1275],{"class":430,"line":473},[428,1276,523],{},[414,1278,1279],{},"oraz zestaw plików po stronie serwerowej:",[414,1281,1282],{},"web.xml:",[418,1284,1286],{"className":760,"code":1285,"language":762,"meta":423,"style":423},"\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003Cweb-app version=\"2.5\" xmlns=\"http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee\" xmlns:xsi=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema-instance\" xsi:schemaLocation=\"http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee\u002Fweb-app_2_5.xsd\">\n    \u003Clistener>\n        \u003Clistener-class>pl.testing.server.GuiceConfig\u003C\u002Flistener-class>\n    \u003C\u002Flistener>\n    \u003Cfilter>\n        \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n        \u003Cfilter-class>com.google.inject.servlet.GuiceFilter\u003C\u002Ffilter-class>\n    \u003C\u002Ffilter>\n    \u003Cfilter-mapping>\n        \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n        \u003Curl-pattern>\u002F*\u003C\u002Furl-pattern>\n    \u003C\u002Ffilter-mapping>\n    \u003Csession-config>\n        \u003Csession-timeout>\n            30\n        \u003C\u002Fsession-timeout>\n    \u003C\u002Fsession-config>\n    \u003Cwelcome-file-list>\n        \u003Cwelcome-file>welcomeGWT.html\u003C\u002Fwelcome-file>\n    \u003C\u002Fwelcome-file-list>\n\u003C\u002Fweb-app>\n",[425,1287,1288,1293,1298,1303,1308,1313,1318,1323,1328,1333,1338,1342,1347,1352,1357,1362,1367,1372,1377,1382,1387,1393],{"__ignoreMap":423},[428,1289,1290],{"class":430,"line":431},[428,1291,1292],{},"\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",[428,1294,1295],{"class":430,"line":437},[428,1296,1297],{},"\u003Cweb-app version=\"2.5\" xmlns=\"http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee\" xmlns:xsi=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema-instance\" xsi:schemaLocation=\"http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee http:\u002F\u002Fjava.sun.com\u002Fxml\u002Fns\u002Fjavaee\u002Fweb-app_2_5.xsd\">\n",[428,1299,1300],{"class":430,"line":444},[428,1301,1302],{},"    \u003Clistener>\n",[428,1304,1305],{"class":430,"line":450},[428,1306,1307],{},"        \u003Clistener-class>pl.testing.server.GuiceConfig\u003C\u002Flistener-class>\n",[428,1309,1310],{"class":430,"line":456},[428,1311,1312],{},"    \u003C\u002Flistener>\n",[428,1314,1315],{"class":430,"line":462},[428,1316,1317],{},"    \u003Cfilter>\n",[428,1319,1320],{"class":430,"line":467},[428,1321,1322],{},"        \u003Cfilter-name>guiceFilter\u003C\u002Ffilter-name>\n",[428,1324,1325],{"class":430,"line":473},[428,1326,1327],{},"        \u003Cfilter-class>com.google.inject.servlet.GuiceFilter\u003C\u002Ffilter-class>\n",[428,1329,1330],{"class":430,"line":478},[428,1331,1332],{},"    \u003C\u002Ffilter>\n",[428,1334,1335],{"class":430,"line":484},[428,1336,1337],{},"    \u003Cfilter-mapping>\n",[428,1339,1340],{"class":430,"line":490},[428,1341,1322],{},[428,1343,1344],{"class":430,"line":496},[428,1345,1346],{},"        \u003Curl-pattern>\u002F*\u003C\u002Furl-pattern>\n",[428,1348,1349],{"class":430,"line":502},[428,1350,1351],{},"    \u003C\u002Ffilter-mapping>\n",[428,1353,1354],{"class":430,"line":508},[428,1355,1356],{},"    \u003Csession-config>\n",[428,1358,1359],{"class":430,"line":514},[428,1360,1361],{},"        \u003Csession-timeout>\n",[428,1363,1364],{"class":430,"line":520},[428,1365,1366],{},"            30\n",[428,1368,1369],{"class":430,"line":724},[428,1370,1371],{},"        \u003C\u002Fsession-timeout>\n",[428,1373,1374],{"class":430,"line":730},[428,1375,1376],{},"    \u003C\u002Fsession-config>\n",[428,1378,1379],{"class":430,"line":735},[428,1380,1381],{},"    \u003Cwelcome-file-list>\n",[428,1383,1384],{"class":430,"line":740},[428,1385,1386],{},"        \u003Cwelcome-file>welcomeGWT.html\u003C\u002Fwelcome-file>\n",[428,1388,1390],{"class":430,"line":1389},21,[428,1391,1392],{},"    \u003C\u002Fwelcome-file-list>\n",[428,1394,1396],{"class":430,"line":1395},22,[428,1397,1398],{},"\u003C\u002Fweb-app>\n",[418,1400,1402],{"className":420,"code":1401,"language":422,"meta":423,"style":423},"public class GuiceConfig extends GuiceServletContextListener {\n\n    @Override\n    protected Injector getInjector() {\n        return Guice.createInjector(new GuiceModule());\n    }\n}\n\npublic class GuiceModule extends ServletModule{\n\n    @Override\n    protected void configureServlets() {\n        super.configureServlets();\n        serve(\"\u002FGWT.rpc\").with(GuiceRemoteServiceServlet.class);\n        bind(ExampleRpc.class).to(ExampleRpcImpl.class);\n    }\n}\n\npublic class ExampleRpcImpl extends RemoteServiceServlet implements ExampleRpc {\n    public String myMethod(String s) {\n        return \"Server says: \" + s;\n    }\n}\n\n@Singleton\npublic class GuiceRemoteServiceServlet extends RemoteServiceServlet {\n\n    @Inject\n    private Injector injector;\n\n    @Override\n    public String processCall(String payload) throws SerializationException {\n        try {\n            RPCRequest req = RPC.decodeRequest(payload, null, this);\n            RemoteService service = (RemoteService) injector.getInstance(req.getMethod().getDeclaringClass());\n            return RPC.invokeAndEncodeResponse(service, req.getMethod(), req.getParameters(), req.getSerializationPolicy());\n        } catch (IncompatibleRemoteServiceException ex) {\n            log(\"IncompatibleRemoteServiceException in the processCall(String) method.\", ex);\n            return RPC.encodeResponseForFailure(null, ex);\n        }\n    }\n}\n",[425,1403,1404,1409,1413,1417,1421,1426,1430,1434,1438,1442,1446,1450,1454,1458,1462,1466,1470,1474,1478,1482,1486,1490,1494,1499,1504,1509,1514,1519,1524,1529,1534,1539,1544,1549,1554,1559,1564,1569,1574,1579,1584,1589],{"__ignoreMap":423},[428,1405,1406],{"class":430,"line":431},[428,1407,1408],{},"public class GuiceConfig extends GuiceServletContextListener {\n",[428,1410,1411],{"class":430,"line":437},[428,1412,441],{"emptyLinePlaceholder":440},[428,1414,1415],{"class":430,"line":444},[428,1416,545],{},[428,1418,1419],{"class":430,"line":450},[428,1420,805],{},[428,1422,1423],{"class":430,"line":456},[428,1424,1425],{},"        return Guice.createInjector(new GuiceModule());\n",[428,1427,1428],{"class":430,"line":462},[428,1429,517],{},[428,1431,1432],{"class":430,"line":467},[428,1433,523],{},[428,1435,1436],{"class":430,"line":473},[428,1437,441],{"emptyLinePlaceholder":440},[428,1439,1440],{"class":430,"line":478},[428,1441,885],{},[428,1443,1444],{"class":430,"line":484},[428,1445,441],{"emptyLinePlaceholder":440},[428,1447,1448],{"class":430,"line":490},[428,1449,545],{},[428,1451,1452],{"class":430,"line":496},[428,1453,898],{},[428,1455,1456],{"class":430,"line":502},[428,1457,903],{},[428,1459,1460],{"class":430,"line":508},[428,1461,1184],{},[428,1463,1464],{"class":430,"line":514},[428,1465,1189],{},[428,1467,1468],{"class":430,"line":520},[428,1469,517],{},[428,1471,1472],{"class":430,"line":724},[428,1473,523],{},[428,1475,1476],{"class":430,"line":730},[428,1477,441],{"emptyLinePlaceholder":440},[428,1479,1480],{"class":430,"line":735},[428,1481,1033],{},[428,1483,1484],{"class":430,"line":740},[428,1485,1038],{},[428,1487,1488],{"class":430,"line":1389},[428,1489,1043],{},[428,1491,1492],{"class":430,"line":1395},[428,1493,517],{},[428,1495,1497],{"class":430,"line":1496},23,[428,1498,523],{},[428,1500,1502],{"class":430,"line":1501},24,[428,1503,441],{"emptyLinePlaceholder":440},[428,1505,1507],{"class":430,"line":1506},25,[428,1508,1028],{},[428,1510,1512],{"class":430,"line":1511},26,[428,1513,1074],{},[428,1515,1517],{"class":430,"line":1516},27,[428,1518,441],{"emptyLinePlaceholder":440},[428,1520,1522],{"class":430,"line":1521},28,[428,1523,1083],{},[428,1525,1527],{"class":430,"line":1526},29,[428,1528,1088],{},[428,1530,1532],{"class":430,"line":1531},30,[428,1533,441],{"emptyLinePlaceholder":440},[428,1535,1537],{"class":430,"line":1536},31,[428,1538,545],{},[428,1540,1542],{"class":430,"line":1541},32,[428,1543,1101],{},[428,1545,1547],{"class":430,"line":1546},33,[428,1548,1106],{},[428,1550,1552],{"class":430,"line":1551},34,[428,1553,1111],{},[428,1555,1557],{"class":430,"line":1556},35,[428,1558,1116],{},[428,1560,1562],{"class":430,"line":1561},36,[428,1563,1121],{},[428,1565,1567],{"class":430,"line":1566},37,[428,1568,1126],{},[428,1570,1572],{"class":430,"line":1571},38,[428,1573,1131],{},[428,1575,1577],{"class":430,"line":1576},39,[428,1578,1136],{},[428,1580,1582],{"class":430,"line":1581},40,[428,1583,511],{},[428,1585,1587],{"class":430,"line":1586},41,[428,1588,517],{},[428,1590,1592],{"class":430,"line":1591},42,[428,1593,523],{},[414,1595,1596],{},"W tym miejscu zakończyliśmy konfigurację Guice-a wraz z GWT. W następnej części zajmiemy się obsługą Hibernate.",[1598,1599,1600],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":423,"searchDepth":437,"depth":437,"links":1602},[],"2010-10-15","Instalacja, konfiguracja oraz zestawienie z Google Web Toolkit (in Polish)","md",{"layout":1607},"post","\u002Fblog\u002F2010-12-15-gwt-and-guice",{"title":408,"description":1604},"2.blog\u002F2010-12-15-gwt-and-guice","jLZT8dfB96shZTFJi08TjTQJjya4l4av4GLdxf8ATsg",[1613,1617],{"title":45,"path":1614,"stem":1615,"description":1616,"children":-1},"\u002Fblog\u002F2010-12-14-gwt-basic-components","2.blog\u002F2010-12-14-gwt-basic-components","Opis i podstawowe elementy (in Polish)",{"title":1618,"path":1619,"stem":1620,"description":1621,"children":-1},"Hibernate + Guice","\u002Fblog\u002F2010-12-16-hiberante-with-guice","2.blog\u002F2010-12-16-hiberante-with-guice","Instalacja, konfiguracja oraz zestawienie z Guicem (in Polish)",1788257054090]