Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending only 1mb of files from folder through web service.

 
Shashank Acharya
Greenhorn
Posts: 21
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

My question is that I want to send pdf files through web service with condition that only 1mb of files are taken from that folder containing many files.

Please help me to resolve this question.I am new to web service.
Ask me again if it not clear.
Thanks In Advance.
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write you plain java logic to solve your problem. Expose you code as webservice with the help of java2wsdl.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
It sounds like a RESTful web service could be a good fit for you. I am not entirely sure I have understood all of your requirements, but I'll make an attempt:
Lets assume all your documents are found under the /documents resource.
If a client performs a GET on the /documents resource root, then a list of PDF documents adhering to your size requirement is produced with URIs to each document in the list.
If the client performs a GET on a specific /documents resource, then the appropriate PDF document is downloaded.
Please do not hesitate to ask if I have been unclear!
Best wishes!
 
Shashank Acharya
Greenhorn
Posts: 21
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,shivendra

@shivendra I wrote a plain logic for it & my eclipse ide has made fine wsdl for me.

@Ivan I am using Apache Axis web service for it. My question is that I want to collect files of total 1 mb from specific folder.

Here is my code to retrieve that. I am easily getting that.



Now my question is
1. If the web service is called how can I know that it first call or second call.i.e if when server has started first time the web service is called,if after some time web service is called second time how can I track that.
2. How to track that this many files are send to client & next are remaining.i.e if in first call I send total of 4 files(having 1 mb of size),then in second call I have to send files from 5th file upto my required size.


Can you please help in this.

Please ask me if it not clear.
Thanks for reply.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Since you are already using the file system, you can use lock file(s).
Files can be created atomically using File.createNewFile() and you can use some appropriate naming scheme to be able to make the decisions you need to make.
Best wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic