Seven Stars

Host static files

Is it possible for me to use Talend Runtime container as a way to host "static" content like images/ html/ pdf? 

1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: Host static files

Here is a very basic example that will allow you to do this. The layout of the job is shown in the screenshot below.

mini_blob_20150715-0953.png

The configuration of the tFileInputRaw is below....

mini_blob_20150715-0955.png

The tConvertType component converts the output from the tFileInputRaw from Object to byte[].

The tRestResponse is configured as below...

 

mini_blob_20150715-0956.png

On the Advanced Settings tab you need to set some Response Headers.....

mini_blob_20150715-0957.png

 

When you run the service and call it through a browser, it will return your file.

Rilhia Solutions
4 REPLIES
Fifteen Stars

Re: Host static files

How do you mean "host"? Do you want them to be available via the Runtime in the same way they would be via a Web Server?

Rilhia Solutions
Seven Stars

Re: Host static files

@rhall_2_0. Yes, that is correct. I do not want to spin off a new web server instance just to host a couple of static files.
Fifteen Stars

Re: Host static files

Here is a very basic example that will allow you to do this. The layout of the job is shown in the screenshot below.

mini_blob_20150715-0953.png

The configuration of the tFileInputRaw is below....

mini_blob_20150715-0955.png

The tConvertType component converts the output from the tFileInputRaw from Object to byte[].

The tRestResponse is configured as below...

 

mini_blob_20150715-0956.png

On the Advanced Settings tab you need to set some Response Headers.....

mini_blob_20150715-0957.png

 

When you run the service and call it through a browser, it will return your file.

Rilhia Solutions
Seven Stars

Re: Host static files

Super. This is awesome. Thanks!