jersey « mongodb « Java Database Q&A

1. how to do authenticate in REST web service using jersey and java

how to do authentication in REST web service using jersey framework and java? I used NetBean IDE and create Rest web service, the application server is glassfish. I don't use javadb or ...

2. how to generate http response using json in REST web service?

I want to response using json in web service like this :

HTTP/1.1 200 OK
Content-Type: application/
X-CDMI-Specification-Version: 1.0
"objectURI" : "/MyContainer/MyDataObject.txt",
"objectID" : "AABwbQAQb/ENV52Ai8a3MA==",
"parentURI" : "/MyContainer/",
"mimetype" : "text/plain",
"metadata" : {
"cdmi_size" : "17"
"valuerange" : "0-17",
"value" : ...