├── webapps └── .gitkeep ├── src └── main │ ├── java │ ├── .gitkeep │ └── com │ │ └── getbookmarks │ │ ├── repository │ │ └── StoryRepository.java │ │ ├── rest │ │ ├── StoryNotFoundException.java │ │ ├── PingResource.java │ │ └── StoryResource.java │ │ ├── config │ │ ├── WebMvcConfig.java │ │ ├── GetBookmarksWebApplicationInitializer.java │ │ └── ApplicationConfig.java │ │ └── domain │ │ └── Story.java │ ├── resources │ ├── .gitkeep │ └── logback.xml │ └── webapp │ ├── img │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png │ ├── views │ └── stories │ │ ├── detail.html │ │ ├── list.html │ │ └── create.html │ ├── js │ ├── app.js │ ├── toastr.js │ ├── angular-resource.js │ └── bootstrap.js │ ├── index.html │ └── css │ └── toastr.css ├── .openshift ├── config │ ├── .gitkeep │ ├── settings.base.xml │ ├── postgresql_module.xml │ ├── settings.prod.xml │ ├── settings.stg.xml │ ├── settings.rhcloud.xml │ ├── tomcat-users.xml │ ├── context.xml │ ├── logging.properties │ ├── catalina.properties │ ├── server.xml │ └── catalina.policy ├── markers │ ├── .gitkeep │ ├── java7 │ └── hot_deploy ├── cron │ ├── daily │ │ └── .gitignore │ ├── hourly │ │ └── .gitignore │ ├── minutely │ │ └── .gitignore │ ├── monthly │ │ └── .gitignore │ ├── weekly │ │ ├── chrono.dat │ │ ├── chronograph │ │ ├── jobs.deny │ │ ├── jobs.allow │ │ └── README │ └── README.cron └── action_hooks │ └── README.md ├── .gitignore ├── README.md └── pom.xml /webapps/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/java/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/config/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/markers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/markers/java7: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/cron/daily/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/cron/hourly/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/markers/hot_deploy: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/cron/minutely/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/cron/monthly/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.openshift/config/settings.base.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/chrono.dat: -------------------------------------------------------------------------------- 1 | Time And Relative D...n In Execution (Open)Shift! 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | target 3 | .settings/* 4 | !.settings/.jsdtscope 5 | .project 6 | .classpath 7 | -------------------------------------------------------------------------------- /.openshift/cron/weekly/chronograph: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "`date`: `cat $(dirname \"$0\")/chrono.dat`" 4 | -------------------------------------------------------------------------------- /src/main/webapp/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/day22-spring-angularjs-demo-app/HEAD/src/main/webapp/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /src/main/webapp/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekhargulati/day22-spring-angularjs-demo-app/HEAD/src/main/webapp/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /.openshift/cron/weekly/jobs.deny: -------------------------------------------------------------------------------- 1 | # 2 | # Any script or job files listed in here (one entry per line) will NOT be 3 | # executed (read as ignored by run-parts). 4 | # 5 | 6 | README 7 | 8 | -------------------------------------------------------------------------------- /.openshift/action_hooks/README.md: -------------------------------------------------------------------------------- 1 | For information about action hooks supported by OpenShift, consult the documentation: 2 | 3 | http://openshift.github.io/documentation/oo_user_guide.html#the-openshift-directory 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Day 22 Demo Application## 2 | 3 | To run it on OpenShift, execute the following command. 4 | 5 | ``` 6 | $ rhc create-app getbookmarks tomcat-7 mongodb-2 --from-code https://github.com/shekhargulati/day22-spring-angularjs-demo-app.git 7 | ``` -------------------------------------------------------------------------------- /src/main/webapp/views/stories/detail.html: -------------------------------------------------------------------------------- 1 |
7 | {{story.text}} 8 |
87 | var User = $resource('/user/:userId', {userId:'@id'}); 88 | var user = User.get({userId:123}, function() { 89 | user.abc = true; 90 | user.$save(); 91 | }); 92 |
115 | // Define CreditCard class 116 | var CreditCard = $resource('/user/:userId/card/:cardId', 117 | {userId:123, cardId:'@id'}, { 118 | charge: {method:'POST', params:{charge:true}} 119 | }); 120 | 121 | // We can retrieve a collection from the server 122 | var cards = CreditCard.query(function() { 123 | // GET: /user/123/card 124 | // server returns: [ {id:456, number:'1234', name:'Smith'} ]; 125 | 126 | var card = cards[0]; 127 | // each item is an instance of CreditCard 128 | expect(card instanceof CreditCard).toEqual(true); 129 | card.name = "J. Smith"; 130 | // non GET methods are mapped onto the instances 131 | card.$save(); 132 | // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'} 133 | // server returns: {id:456, number:'1234', name: 'J. Smith'}; 134 | 135 | // our custom method is mapped as well. 136 | card.$charge({amount:9.99}); 137 | // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'} 138 | }); 139 | 140 | // we can create an instance as well 141 | var newCard = new CreditCard({number:'0123'}); 142 | newCard.name = "Mike Smith"; 143 | newCard.$save(); 144 | // POST: /user/123/card {number:'0123', name:'Mike Smith'} 145 | // server returns: {id:789, number:'01234', name: 'Mike Smith'}; 146 | expect(newCard.id).toEqual(789); 147 | *
158 | var User = $resource('/user/:userId', {userId:'@id'}); 159 | var user = User.get({userId:123}, function() { 160 | user.abc = true; 161 | user.$save(); 162 | }); 163 |
170 | var User = $resource('/user/:userId', {userId:'@id'}); 171 | User.get({userId:123}, function(u, getResponseHeaders){ 172 | u.abc = true; 173 | u.$save(function(u, putResponseHeaders) { 174 | //u => saved user object 175 | //putResponseHeaders => $http header getter 176 | }); 177 | }); 178 |