javing
javing

Reputation: 12423

Is it a good idea to use REST webservice to upload files?

I am studying REST with JAX-RS, and this doubt just came to my mind:

Since web services are meant to serve inter-operable clients written in different programming languages and the clients just use the URLs to access the services features; what about a web service for uploading files to a common database?

Will it be save? How can the web service avoid being overloaded by spam if he has no control over how do the clients perform validation? The method for upload will look more ore less similar to this:

@Path("/upload/{something}") 
@Consumes("multipart/form-data")
@POST
public void uploadSomething(...) {
//...
}

So my doubt is if uploading is a good thing that REST services can do safely?

Upvotes: 4

Views: 749

Answers (1)

aleroot
aleroot

Reputation: 72646

If you are concerned about safe access why you do not enforce authentication to the client ? You can implement a SecurityContext and use it in your Java code to access the authentication information. Take a look at this article could be helpful.

Upvotes: 5

Related Questions