I've been searching for hours and I could not find an answer to this: Can you upload files to Oracle Cloud's ObjectStorage using MultiPartUpload via a PreAutheticated Request? I know it's possible in just in one go.
I basically need to allow users to upload large files to Object Storage through a Java client and I would like to do it via PAR's. If it is possible, how would that happen? Meaning, do you call the CreateMultiPartUpload first and the upload the parts via the PAR? Do you call the CreateMultiPartUpload with the PAR?
It is not possible to use multipart uploads with a PAR today, unfortunately. We do hope to make this available very soon, though.
hope you are well!
Related
Can anyone give me a quick rundown on how to send faxes in Java using Fax4J? The tutorial provided by the javadocs is sketchy at best. In particular, it doesn't teach you how to specify which fax modem you are calling; it only says FaxClient faxClient=FaxClientFactory.createFaxClient(); but how does it work?
I downloaded the full fax4j code, and I noticed some files called FaxModem.java in there. How are those used?
For someone who actually authored fax4j, cant agree with the comment about the tutorial because i am not sure you read it.
The factory is explained returns a client which is backed by an engine called spi.
There are many different spi types.
Some would use windows native api, some would run a process, others would send emails and http requests to remote providers and it is all based on your fax4j configuration.
All cofiguration options possible are detailed in the tutorial so for example if you want to send an email to spcific mail server that converts it to fax ypu would set email address and other needed properties in your fax4j.properties file.
So based on the way you are sending requires different config and its all in the tutorial.
However you didnt write how you want to send and of course fax4j doesnt support everything.
I think the main bulk of users use the windows native api spi so they actually dont configure anything for fax4j and instead configure the fax settings in their windows machine and thats it
The BlobStore API is marked as 'superseded' also limited to Limits to 32 MB.
The Google Cloud Storage is a vendor lock-in.
Is there a way to upload blobs with a 3rd part lib
In Google App Engine (not flexible / managed-vms) for example JClouds
And how would one bypass the 60 Seconds request limit that causes DeadlineExceededException?
To enhance the question;
Security is an issue, it would be preferably to run every request trough the application, so also blob uploads. Which makes the 60 seconds an issue.
The seperate uploadUrl is an option, but i do not wish to use BlobStore or Cloud Storage, but is there a generic way to handle things like this in GAE?
32MB is not a limitation of the BlobStore, but rather request playloads that go to your GAE app. You can upload larger files to both Cloud Storage and the BlobStore by creating a temporary URL for the user to submit the file to, which does not go through your ap, but rather goes directly to the storage service. You can find documentation about that for blobstore here. I don't personally use Cloud Storage, so I don't the a documentation link handy.
You can certainly use any other service in a similar way, but I'm afraid I can't explain how other than to say "consult their documentation". I know that's not a great answer to your question, but maybe insight into how it works with Google's products will help you understand how to use a 3rd party as well.
As for the 60 second request limit: since your upload requests cannot go through your server anyway, this is a non-issue. The 60 second limit only applies to requests made directly to your app.
I'm developing a knowledge base java application, where I can store and retrieve annotations with its title, date when the note was created (SQL datetime), content, tags about the annotation, etc.
It can be done easily with a database (I'm using SQL Server 2014), but the main problem is that the server is running on my own PC and it has to be always on and running the SQL Server. Also, I would like to extend the application by storing and retrieving this kind of data on mobile apps for Android and iOS.
Is there any other way to store that type of data in some files so it can be uploaded to some cloud storage like Dropbox ? After storing it on Dropbox, all I would have to do is sync the app with dropbox, get the files and read/write stuff.
UPDATE: Thanks for all the answers they helped me a lot. The best solution for me is to replace SQL Server with SQlite, as Gabe Sechan commented. Now I can make changes on the database without the need of a server running 24/7 and I can use the same database on Android and iOS apps.
You can use just a basic ajax call to pull content from a Dropbox "public" URL.
function(contenturl,intoselector,callback){
if (contentwindow.currenttopic!==contentID){
jQuery.ajax({
type:'GET',
url:'//www.corsproxy.com/'+contenturl,
dataType:'text',
async:true,
success:function(data){
intoselector.html(data);
if (jQuery.type(callback)==="function")
callback();
}
});
}
Notice that this example pulls through corsproxy so that you don't receive any XSS errors, so the url you pass needs to not contain a protocol itself.
If you want to pull a JSON or XML string that is stored in the file, then you might need to play around with the dataType and contenttype options in the ajax call.
This can also be done using Google spreadsheets:
Reading:
Create a spreadsheet and publish it on the web
Use one of the many available Javascript libraries for pulling data from Google spreadsheets:
http://jlord.us/sheetsee.js/ (which uses Tabletop.js)
http://chriszarate.github.io/sheetrock/
Writing:
You can use a Google app script for writing to the spreadsheet (reference) OR
You can create a Google form linked to the spreadsheet and simply fill the form from your mobile app whenever you want to add some data to the sheet (reference)
Of all the cloud services, when it comes to Android, Dropbox's Sync API is one of the easiest to implement. Do you need specific code examples on how to sync with Dropbox?
We have a php setup for our web pages that is secure with HTTPS. The web app talks to a DB but we also want it to talk to a java server we have.
The java server is a standalone java application (not web). We simply want a callback action after the PHP page finished writing to the DB done in the java server. What is a good way for this php page to talk to the java program to get something done?
I usually recommend against quick and dirty but here :
You can dump data in a file if it can be asynchronous. Then a cron job from java, checking for that kind of file at a regular interval, do the specified command.
For example, you can dump the word ExecuteCmd1 in a file. The java thread reads it, interprets it and choose that he must execute the method or class with the same name.
You can do the same thing over to go back to php.
Probably via a TCP/IP connection. If your Java application runs a server, then the PHP script can connect and send a message informing the Java app that the DB has been written to.
Do a quick and dirty JSON RPC from PHP to Java. You could probably get it up and running in one cup of coffee.
Use CURL on php (http://php.net/curl) and json_encode() to POST a json string to your Java server. (scroll down and find the curl wrapper class that someone wrote in the comments. It's easy.)
Use JSON (http://www.json.org/java/) in Java to decode it and use it immediately. Send your response back in JSON too.
I had a similar XML RPC system running in production for years. PHP -> IP -> Java works great.
Google Protocol Buffers Not so much dirty, but works, and works well, regardless of which launguage you use.
You can try the PHP/Java bridge. I used it a while ago to use Java logic inside Typo3, a PHP CMS.
My advice, whether you use the bridge or not: make sure you know where the errors come from if something doesn't work. Check both PHP and Java logs. Be verbose if an exception occurs.
How much data do you need to transfer?
How many requests per second?
Does the Java application have to handle the request immediately, or is it enough to handle the request in a few minutes?
Does the Java application need to return data to the user's browser?
If the answers to questions 3 and 4 are no and no, you could just create a database table for the jobs, have the PHP app insert a new job, and have the Java app poll the job table every minute or so.
Just got a request from my boss for an application I'm working on. Basically we're getting an email address setup for an external client to submit excel files to.
What I need is a way to automatically pick up any email sent to this address, so I can take the attachment, process it and save it to a folder.
Any information of even where to start would be helpful.\
Note: We're using a lotus notes server to do this, but a generic way would be more helpful (If possible).
Email -> mailserver ->[something] -> file-on-disk.
File on disk is pretty easy to parse, use JavaMail.
The [something] could be:
listener for smtp connections (overkill)!
Pop3/imap client
Maildir/Mailbox
Edit: since I first wrote this answer, Wiser has moved and now claims to only be a unit testing tool, so take the answer below with a pinch of salt...
Svrist's answer is good, but if you want to avoid his middle step (the mailserver that writes the mail to disk for later pickup by the Java system) you can use Wiser.
Wiser lets you start an in-Java mailserver:
Wiser wiser = new Wiser();
wiser.setPort(2500);
wiser.start();
Then you can just poll it periodically for mail:
for (WiserMessage message : wiser.getMessages())
{
String envelopeSender = message.getEnvelopeSender();
String envelopeReceiver = message.getEnvelopeReceiver();
MimeMessage mess = message.getMimeMessage();
// mail processing goes here
}
Use a mail in database (your Domino administrator can set that up for you but it's in the help file as well).
In that database, you can create an agent that runs periodically to process all new documents. That agent will use the EmbeddedObjects property of the NotesRichTextItem class and the ExtractFile method of the NotesEmbeddedObject class to get a handle on the file attachment and extract it to the location you specify.
For example, this script goes through all the file attachments, object links, and embedded objects in the Body item of a document. Each time it finds a file attachment, it detaches the file to the SAMPLES directory on the C drive and removes the attachment from the document
Dim doc As NotesDocument
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( "c:\samples\" & o.Source )
Call o.Remove
Call doc.Save( False, True )
End If
End Forall
End If
I've done quite a bit lately with Java agents on Domino servers. The Domino 8.5 server supports Java 6 and its embedded so it won't take someone with a bit of Domino development experience long to put together an agent that runs when new mail arrives. In LotusScript its even easier but that needs more specialised skills which you'd probably need to get a contractor in to provide.
The limitation your likely to encounter concerns the extracted file, you can easily place it on the Domino server's file structure but you may be limited by the OS security from placing it on a different server.
Lotus Notes/Domino stores mail in a Notes database. There are APIs available for getting documents (emails), reading field values (From, Subject), and detaching files.
APIs include
-LotusScript (VB variant, available within the Notes database)
-Java (from within or external to the database)
-C API (external)
-Same API available through COM server
You can create a "scheduled agent" within the database (using LotusScript or Java) that can locate documents created since it last ran, locate the attachments, and extract them. The agent will need to be signed with an ID that has the appropriate permissions on the server, including those required to write to the file system and initiate any other processes.
External to the database, you can use any API except LotusScript to log-in to the server/mail database, and follow a similar process, e.g. extracting the files locally on a client or separate server. C API and COM require a notes client install, but Java applications can be set up to run via CORBA/DIIOP without a full install.
Consult the Domino Designer help (or IBM's website for C API) for more information.
As to a "generic way" to do this, if you are accessing data in Notes and needing to extract attachments, I believe these APIs are your best option. If you envision porting the application to another mail system, consider decoupling the API routines via an "interface" so you only need to add a new implementation of that interface to support a new mail system.
You can access Notes Documents relatively easily using DIIOP, would be a lot easier than going down the C Api road...
Try POP3Client in the Net Commons package; it'll let your Java program check for new mail for a particular account at whatever interval you want (every few minutes? hourly?), and get/delete messages as desired.
SMTP/POP3 can be enabled on the Domino server. Worked with this before and gotten Squirrel Mail running with it. SMTP is a bit resource intensive, but well worth the effort because then you don't have to descend into LotusLand to get things working. Just write a small Java CLI program that will check a specific email box (POP3 or SMTP), and parse through the messages, pulling the attachments and placing them where needed.
Plenty of documentation and examples here:
http://java.sun.com/products/javamail/
The techniques that you develop taking this approach will be more widely applicable in your future career than anything Lotus/Domino specific.
No matter what you do, you'll need an understanding of the Lotus Notes data structures. The good news is that a fully automated solution can be built in Notes very easily.
Your best bet is to have it built within Notes, and it can be set up to run automatically whenever new mail is received. Gary's answer is dead on, but without any experience, it would probably be hard to figure out how to implement it yourself. On the other hand, it really shouldn't take any competent Notes programmer more than an hour or two to set it up.