1. http://techprithibi.com/eprithibi/1059
2. Video tutorial
3. http://www.learn-android.com/2010/01/05/android-layout-tutorial/5/
4. how can I use external jars in an android project
5. json/xml
6. 10 important project tutorial
7. http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data
8. http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/
9. http://malsandroid.blogspot.com/2010/06/accessing-call-logs.html
JSON লেবেলটি সহ পোস্টগুলি দেখানো হচ্ছে৷ সকল পোস্ট দেখান
JSON লেবেলটি সহ পোস্টগুলি দেখানো হচ্ছে৷ সকল পোস্ট দেখান
মঙ্গলবার, ১৩ ডিসেম্বর, ২০১১
মঙ্গলবার, ১৯ জুলাই, ২০১১
Restfull in grails
Restfull for Grails :
grails create-app RestFullTest
cd RestFullTest
grails create-domain-class book
grails create-controller Book

You can add some code this /grails-app/conf/BootStrap.groovy file:

RESTful server
We need to create controller that will be performing base CRUD operations and map its methods to REST style URLs.
Edit /grails-app/conf/UrlMappings.groovy:
Run this code with grails run-app and point your browser to http://localhost:8080/GrailsRestTest/book. You should get following response:
grails create-app RestFullTest
cd RestFullTest
grails create-domain-class book
grails create-controller Book

You can add some code this /grails-app/conf/BootStrap.groovy file:
def init = { servletContext ->Final project structure will be:
new Book(author:"S.M. Mahmudul Hasan",title:"Grails").save()
new Book(author:"Shohan",title:"Restfull").save()
}
or U can insert value in db
or U can insert by programatically

RESTful server
We need to create controller that will be performing base CRUD operations and map its methods to REST style URLs.
Edit /grails-app/conf/UrlMappings.groovy:
class UrlMappings {Entry with /book maps GET and POST HTTP requests to this URL to list and create controller methods. Below we map URLs like /book/$id using default grails REST mapping:
static mappings = {
"/$controller/$action?/$id?" {
constraints {
// apply constraints here
}
}
"/"(view: "/index")
"500"(view: '/error')
"/book"(controller: "book") {
action = [GET: "list", POST: "create"]
}
"/book/$id"(resource: "book")
}
- GET -> show
- PUT -> update
- POST -> save (used when you know ID of item you create - not our case;)
- DELETE -> delete
import grails.converters.*
class BookController {
def list = {
response.setHeader("Cache-Control", "no-store")
render Book.list(params) as JSON
}
def show = {
Book b=Book.get(params.id)
render b as JSON
}
def create = {
def json = JSON.parse(request);
def b = new Book(json)
b.save()
response.status = 201
response.setHeader('Location', '/book/'+b.id)
render b as JSON
}
def delete = {
Book b=Book.get(params.id)
b.delete()
render(status: 200)
}
}
Run this code with grails run-app and point your browser to http://localhost:8080/GrailsRestTest/book. You should get following response:
[{"class":"Book","id":1,"author":"S.M. Mahmudul Hasan","title":"Grails"},{"class":"Book","id":2,"author":"Shohan","title":"Restfull"}]To get particular item try http://localhost:8080/GrailsRestTest/book/1 - response should be:
{"class":"Book","id":1,"author":"S.M. Mahmudul Hasan","title":"Grails"}
এতে সদস্যতা:
পোস্টগুলি (Atom)