rest

Junit REST tests?

I am using Struts2, Spring 2 and Junit 4.5. My main question is, whether even to test REST calls? Because, basically this are only calls to business logic and they don't have any logic theirs methods. I have tests for all DAO and BL classes, rest xml and json handler, so I don't know what should I even test in REST calls - result code...

Basic Authentication with Flash

This is *** unbelievable! Flash programmers are familiar with the example: var req:URLRequest = new URLRequest("http://yoursite.com/yourservice.ext"); req.method = URLRequestMethod.POST; req.data = new URLVariables("name=John+Doe"); var encoder:Base64Encoder = new Base64Encoder(); encoder.encode("yourusername:yourpassword"); v...

Debugging RESTful WCF Service

I am attempting to debug a RESTful WCF service I've created using a web browser as my client. Initially things go well however after stopping the debug session and making some changes to my code when I restart it's as if the old code is still being run. My breakpoints are ignored and it's as if a process is not being stopped. I am runni...

How to validate REST request?

Given this service: POST /hotel HTTP/1.1 <hotel> <a>aaa</a> <b>bbb</b> <c>ccc</c> </hotel> HTTP/1.1 201 CREATED Location: /hotel/123 When we process the request on the server we will validate the hotel XML in the request against a DTD. Question is, as a REST best practice should the client refer to the DTD in the request (a...

WCF REST adding data using POST or PUT 400 Bad Request

HI How do i add data using wcf rest architecture. I dont want to use the channelfactory to call my method. Something similar to the webrequest and webresponse used for GET. Something similar to the ajax WebServiceProxy restInvoke Or do i always have to use the Webchannelfactory implementation I am getting a 400 BAD request by using the...

json representation for REST. File or POST form data ?

When I send a JSON representation of my entity to the server, how should the payload be delivered ? As far as I see, there are two options: as an uploaded file as the content of a POST form data The first case cannot be performed via AJAX request, as far as I see, but it seems the "right one". Do you know if there's a preferred "de f...

What is the maximum size of document to return from a REST API?

I am considering creating a RESTful web service which will return a lot of data. What do people think is the maximum size of xml document that should be returned in one get from a web services API? I would estimate the size of the result set to be 100Mb and time to produce this would be about 2h. How much time is a reasonable maximum ...

any good books on scalable web applications (Java/Ajax/REST)?

Are there any good books on the subject worth reading and still up-to-date with current technologies? I'm mostly interested in back-end architecture and things I should consider choosing clustering and database solution as I plan to use GWT for the front-end therefore won't be able to control a lot there. I'm looking for a book which w...

What is the simplest way to return different content types based on the extension in the URL?

I'd like to be able to change the extension of a url and recieve the model in a different format. e.g. if /products/list returns a html page containing a list of products, then /products/list.json would return them in a json list. Note: I like the simplicity of the ASP.NET MVC REST SDK, it only requires about 5 lines of code to hoo...

Unknown Error in Facebook Apps. when get user info.

The problem is.. that when I try to login the user and then get the user info, I get error from Facebook API. with error code: 1 The same code works for one server, but not another one. THe config and everything are the same, except the non-working one is hosted at RackSpace cloud environment. I don't know if that's the cuase. Informa...

Best way to do Spring MVC without JSP?

I wish to use Spring MVC to provide a REST web service. However, running through some books and tutorials, it looks like ModelAndView always returns a parsed JSP file. I guess I could make the JSP build my XML document, but is this the best way to go about things? I thought that perhaps a more structured XML building approach might be ap...

How to design a REStful API for a media analysis engine

I am new to Restful concept and have to design a simple API for a media analysis service I need to set up, to perform various tasks, e.g. face analysis, region detection, etc. on uploaded images and video. Outline of my initial design is as follows: Client POSTs a configuration XML file to http://manalysis.com/facerecognition. This cr...

Why do people want to deliver both Json and XML as output to their REST interfaces?

I understand why "REST framework" vendors want to provide the support for returning both Json based representations and XML based representations, but why do people want to return both from the same service? Is it because you will have client applications that are built on a platform that has no available Json parser? Is it beca...

problem with making Web Request in Silverlight

Hey, I am making restful requests in my silverlight app, I want to get information that might be pushed to the page so i continously make the request to get the updated data, doing something like .... Uri url = new Uri(theUrl);WebClient wc = new WebClient(); wc.DownloadStringCompleted += RetreiveUserMessagesResponse; wc.DownloadStr...

How can I prevent user-agents from presenting a download window for unrecognized mime types?

If you set the Content-Disposition header to attachment, this causes user-agents to always present a download window for that file. I would like to do this opposite of this: force user-agents to always display the response directly. In this particular case, I have an API that's sending JSON. I'd like to serve it as application/json as...

Logging requests/responses in a WCF REST service

I'm looking for a way to log both requests and responses in a WCF REST service. The WCF REST starter kit comes with a RequestInterceptor class which can be used to intercept requests, but there does not seem to be an equivalent for responses. Ideally, I'd like to be able to intercept a response just before it's sent over the wire, e.g. w...

REST WebServices in C#

Hi, I need to develop a Rest Webservice, Where can I find tutorial or complete sample code to build REST WebServices in C#. Please help me with sample Thanks, ...

How to do a RESTful request for an edit form?

I think I have a basic understanding of REST, but something I'm stuck on is how to request an HTML form to edit a resource. To my understanding, if the resource is user/12 And you do a GET on that with content-type "text/html" then you would get some html back that would display the details of that user. What I don't understand i...

Best Practices for REST Shared Secret Value

I am using a REST API that uses oauth for authentication. When registering for the service I was given my API Consumer Key and my API Shared Secret. I've been simply hardcoding the Shared Secret into my Application code and compiling it. Is this the best way to manage a Shared Secret? That is, are there any security implications? Shou...

How to create a REST API for a Ruby application?

I would like to know how to provide a Ruby application with a REST API. I could code something based on Ruby's TCPServer API, but that seems a bit low-level. Do you think it would be a good solution? Or do you recommend a better approach? ...