Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Data Streaming in Java EE

we have a design like this :

enter image description here

our installed service upon tomcat has a method getDatabaseData(String request) (RMI Client) which receive data from database using (RMI Server implementation) existing on the core.

we want to do something that our installed service which is inside tomcat make a xml file and send it to client now :

we have thought about a solution that :

  • first make the whole xml file on our tomcat using the getDatabaseData(String request) & then our user can get a reference using a link to it & start downloading the data.

but this solution is not informative for us because the size of this file is so big and if we want to do this our tomcat server storage will get full so fast & get down, so we're looking for a solution for real time streaming data to user instead of creating the whole file. I mean a way to send the data to user in a xml template when data is receiving from the CORE.

Do you have any idea ?

(by the way the web service upon tomcat has been written using Spring MVC & Spring Security)

like image 388
Mehdi Avatar asked Apr 11 '13 06:04

Mehdi


People also ask

What is data streaming in Java?

Data streams support binary I/O of primitive data type values ( boolean , char , byte , short , int , long , float , and double ) as well as String values. All data streams implement either the DataInput interface or the DataOutput interface.

What is Java EE Web?

Java EE at a Glance. Java Platform, Enterprise Edition (Java EE) is the standard in community-driven enterprise software. Java EE is developed using the Java Community Process, with contributions from industry experts, commercial and open source organizations, Java User Groups, and countless individuals.

What is an example of a data sink in a Java EE web application?

One example of a DataSink is a file writer object that stores the media in a file. A DataSink is created according to the factory mechanism used to create a Player . Adds an event listener for events generated by this DataSink . Closes the connection to the destination described by the output MediaLocator .


1 Answers

I can give you a pice of code from my current project, where we return a file in struts action:

response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
ServletOutputStream out = response.getOutputStream();
out.write(file);

Is this what you are looking for?

like image 63
Mikhail Avatar answered Sep 30 '22 18:09

Mikhail