Magno C
Magno C

Reputation: 2196

How can I send an R file through the web server using java?

I have a Java web application running.

Now, I have this R sample script:

zz <- file(outputTarget, "w")  
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
cat("One more line\n", file = zz)
close(zz)

When "outputTarget" = D://R-Stuff//dataOut.txt the file is created fine.

Now, I need to send this file to my web server.

The only thing that comes to my mind is to change "outputTarget" to http://myhost:8080/myapplication/mystrutsaction/dataOut.txt but I'm sure this will not work because Struts cannot handle this.

What I need to do (in generic way, how can I handle a file saved to URL in Java Web application)?

Upvotes: 0

Views: 67

Answers (1)

Oncaphillis
Oncaphillis

Reputation: 1908

If I get you right you are trying to send a file from R to a web service. So R has to generate a POST request. May be POST request using RCurl is the answer

Upvotes: 1

Related Questions