• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring 3 Rest Web Service Design suggestion

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am planning on a design approach that I want to confirm or seek suggestions. I am new to REST WS. I need to build an application specific REST Web client from where I need to send a zip file and additional data to a REST web service server. This web service (server) is generic to multiple applications and in turn will load the file to a unix server.
The web server service will respond to the rest client with path of file stored and additional data.

I am using Spring framework and JAXRS RestEasy

At Application REST Client:

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.MULTIPART_FORM_DATA)
public Response transferFile(
       @FormDataParam("file") File fileInputStream,
       @FormDataParam("file") FormDataContentDisposition contentDispositionHeader,
 ModelClass1 class1);

@GET    
@Consumes(MediaType.APPLICATION_JSON)
public Response transferStatus(ModelClass2 class2);      
At Generic Web Service

@GET
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response downloadFileonWebServer(
           @FormDataParam("file") File fileInputStream,
           @FormDataParam("file") FormDataContentDisposition   contentDispositionHeader,
 ModelClass1 class1);

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.MULTIPART_FORM_DATA)
public ModelStatus2 uploadFiletoUnix(
       @FormDataParam("file") File fileInputStream,
       @FormDataParam("file") FormDataContentDisposition contentDispositionHeader,
 ModelClass1 class1);    
Also wanted to know:

Pros and Cons to send file as byte[] or zip file in the parameters
Do I need to save the file on the Web service server and then again stream to unix server or any other better suggestion
Do I need Response as return type or can I use VOID
FYI:

@Consumes on Application REST Client is to get data from the generic web service about path of file stored etc
File will be of size 10MB+
ModelClass1 - attributes: Folder name, additional data
ModelClass2 - attributes: path of unix server, additional data
 
Stephen Dsa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephen Dsa wrote:I am planning on a design approach that I want to confirm or seek suggestions. I am new to REST WS. I need to build an application specific REST Web client from where I need to send a zip file and additional data to a REST web service server. This web service (server) is generic to multiple applications and in turn will load the file to a unix server.
The web server service will respond to the rest client with path of file stored and additional data.

I am using Spring framework and JAXRS RestEasy

 
reply
    Bookmark Topic Watch Topic
  • New Topic