how to delete file from the server after downloading it ?or how can i store the file to client machine directly from output stream? - client

am using liferay custom portlet and in that am using jasper report now my problem is that how can i download the pdf report directly on the client machine
right now am storing the file at server first.then provide url for downloading the pdf to user.but how can i directly store the file to client machine if i have pdf file's outputstream .
ot if i can know some how when user click on the download link and after downloading the file if i want to delete the donlowded file from the server then how can i do it.?if any one can guide me...

I'm not sure what you're asking for is possible, but I would be interested in seeing someone correct that statement though.
Servers really shouldn't be directly storing files on a client machine as that violates the intent of the client server relationship. A client has to make a request for the file and then the client can save that file (eg like a ftp download). Servers just don't manipulate client machines as they see fit.
As far as knowing when a file is downloaded, there isn't anything in a portlet you can do to detect that. You can use ResourceRequest and serveResource method to serve a file, but nothing in the portlet API will inform your portlet that the download is complete or that it wasn't interrupted by something.
As an alternative you might try simply having a cron job that will clean out old files. In this case, make sure to inform users how long they have to successfully download the file.

Related

How to download a CSV from a HTTPS URL to file using Pentaho Data Integration - Spoon (Kettle)?

When googling this question, it seems to have been asked, and partially (and poorly) answered a number of times, mostly for older versions.
Question: How can I download a CSV to a local file, with the below constraints? I'm designing in Spoon.
URL: Will always be the same. https://example.com/data/my.csv . The website prepares the csv and provides it back to the web client as a file download after about 4-5 seconds. In a browser this means it is downloaded as a .csv, and not displayed.
Authentication: The website does not require authentication for access. The data isn't sensitive.
Local file path: The downloaded CSV will overwrite the existing csv. eg: d:\data\my.csv . Ie, I can set this on a timer and have it download the newest csv every hour or so.
Proxy: It is quite likely I will need to traverse a network proxy. eg badproxy.mynetwork.internal:8080 and that proxy requires a username and password. It's far better if I can set this password in a single location so any future things created can reference it. Not really sure on how to approach this either.
The rest of my process focuses on addressing the content of the csv, and already works fine.
The processes I've found on google show using the Http Client component, though it's not particularly straightforward how this translates into a file being saved locally into a known location.
Thanks for any pointers.
PDI v9.0.0.0-423
The HTTP client step needs to be triggered. Use a Row generator step generating e.g. 1 empty row and link that with a hop to the HTTP client step.
for your solution , try this:
Data Grid -->HTTP Client-->CSV File Input->Text file output(extension with csv)

Cannot access files on FTP server from Azure Data Factory

I currently have access to a third party's FTP server which, upon login, automatically redirects me to a directory that does not contain the files I am trying to download.
ftp://ftp.fakehost.com -> ftp://ftp.fakehost.com/uselessDir
My files are in ftp://ftp.fakehost/usefulDir.
This ftp server does not support directory traversal so I cannot get to usefulDir by simply modifying my url. FileZilla works since I can execute specific ftp commands to get to the directory I want.
Can a Data Factory FTP service or dataset be customized to work around this problem since Data Factory cannot access the usefulDir directly ?
Please correct me if I doesn't understand your question correctly. Have you tried create a dataset and manually put the usefulDir in folderPath property directly, instead of using the Authoring UI to navigate to that folder (which is not possible based on your description.)

How to check whether a file downloaded from a ftp location is completed or not using apache camel

I need to check whether the file downloaded from a ftp location using camel is completed, being downloaded or the connection broke. If completed I need to do a certain function else I need to make another call
The FTP component also has the capabilities of File2. If you check the docs you'll see options for preMove, move, and moveFailed. You can change the names of files and/or change the location of files before processing, after successful processing, and after failure.

generate a CSV file in salesforce and transfer this into another server

I have generated a XML file in Salesforce and now my problem is that i want to transfer this file into another server. Can i connect to another server using FTP, or is there any way out to transfer the file to another server.
This is an urgent task.
Any solutions wud be greatfully accepted.
Phaniraj N
You can't FTP out, where do you store the file in Salesforce? What's the server on the other end?
You could serve the file up as a public page over sites, call a custom web service to transfer it, implement a web service to serve up the file, use data loader to extract from Salesforce on a regular basis and then a batch to upload to the other server, the list goes on but we'll need a bit more information on what you're dealing with!

Triggering a file when a file is uploaded in a ftp

i am just wondering is there any such feature available!
When user uploads file to a FTP once the connection is disconnected, FTP server need to trigger a event to start a program, so the program can work on the uploaded files.
Am i asking a features which is already available ?
The FTP program itself cannot execute a application, though you could try checking if the file is infact uploaded and then use PHP to execute the file you want.
I used it once for uploading and compiling a c# program.
Hope this helps, else further explain please.

Resources