New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identifying the errors #54
base: master
Are you sure you want to change the base?
Conversation
[#72723708]
Virtual Host looks good, I was trying the previous tried methods in branch2 but It didn't show up.
…-api-72723708 Conflicts: src/main/java/tahrir/api/TahrirRestlet.java
Hey, I have done sample code for /identity and /message uri.. Is this the way we need to proceed? |
public JSONObject toJSON() { | ||
JSONObject jsonobj = new JSONObject(); | ||
try { | ||
jsonobj.put("error", "An error occured"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't it explain the error?
Hello all , I wrote this variation which aims to respond on the type of request made ; If used using browser then it will return in html else if using curl on the type of request either json or html it would respond; But it has no error but on running the server, it just shows the status " Not Found" Restlet Default page; |
Is there a way to check the type of the response which is expected along with the type of request? |
Tejas: for each request, a specific response on expected. what exactly is expected is determined by the API that we wrote. Go check that document, it is king. |
What I meant was for example in class TahrirRestlet in /message we've used if request.getmethod.getName.equals("Get") on the similar lines i was looking for a method similar to this to check for response for what kind of MediaType is expected along with the request. If the response is Html or Json. Presently we set the type of response as part of setEntity(response,Mediatype) |
Well according to the API doc, when we receive a GET in /messages, we must return a JSON that looks like this: { So when we set the response, we just set the Mediatype to JSON. I don't see why we shouldn't do this. There's no method to check what the response should be, the requester doesn't give that to us, it just assumes we've read the API doc and have implemented correctly. |
True!!! I was just trying out new stuffs with REST like chrome extension POSTMAN so was trying new thing with it. The above thing was just a example. Whatever we've done till now is exactly as per the API doc written. I was just exploring new things around the REST and Restlet. |
No description provided.