开发者

How to transfer a File from Java client to Java sever?

开发者 https://www.devze.com 2023-03-17 09:15 出处:网络
I need to give to a java client a way to send files to another application running in an Application Server. I don\'t need to process the file, but do some actions when the file is received.

I need to give to a java client a way to send files to another application running in an Application Server. I don't need to process the file, but do some actions when the file is received.

What good ways to implement this communication are there?

I can think about EJB, but I'm not sure this to be the best option since i don't need the picture in memory, the same for WebServices...

Another option co开发者_运维知识库uld be to open an FTP server but I wonder if there is a good alternative to do this with Java.

Any ocurrences or suggestions? Thanks!


You could upload the file to a Servlet, e.g. using the MultiPartEntity of Apache HTTPClient in a POST request.


I strongly recommend Netty The documentation is great, it's simple to implement, and you can send anything through your own custom pipe that you need. Plus they have pre-built helper classes to just send files and do some pre/post processing work on both the client and server.


If you use EJBs, you're using RMI. You could try using RMIIO to stream the data. I've never used it, but it claims to do exactly what you want. It's pretty old, but then RMI is stable, so it should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消