How to transfer media files using Worklight - adapter

What's the correct way of transferring media (photos or movies) using Worklight Adapters?
I sent a photo via the adapter and got the error: form too large, exceed the maximum size...
I read I need to change the form size through the Jetty
but the server I'll deploy the app won't be a jetty so what shell i do?
Thanks!

Please see topic Uploading large (and binary) files to Worklight adapter.
Basically, Worklight does not have the equivalent to an HTTP POST mechanism that allows you to transfer arbitrarily large chunked data. For large files of unknown sizes (photos, video, audio) you'll need to upload the file to the server outside the Worklight adapter framework. For example you could simply post it to a web server you have configured. In my case (in the above referenced answer) I needed to create an entire client-server mechanism to negotiate a port and key, start listening on that port, then accept requests and ensure the posting client passes the key as authorization to transfer the secure data.
Hopefully IBM will provide a formal service for this in a future release.

Adapters do not work with html forms, they work with data.
You will need to convert your image to base64 and submit as a adapter invocation parameter.
Having more information regarding what exactly you're trying to achieve might be helpful.

Related

How to create an upload (large, ie ~400MB) bytestream service in Vaadin?

In an earlier post from a few minutes ago, I asked a "general" question regarding creating general webservices in vaadin: How can one create webservices in Vaadin 12?
However, one specific unique case that I mainly need to support is the uploading via https of large (eg ~400MB) bytestream objects that would presumably be sent to Vaadin via an https "post" command (with the paylod being provided I presume in raw binary format as a bytestream.) I saw that Vaadin has built-in support for uploading files (which is essentially a post command of a bytestream, I presume?) and then I saw a reference to StreamReceiver here: https://vaadin.com/docs/v12/flow/advanced/tutorial-stream-resources.html
which seems to sound like a custom file importer, but I couldn't find any (simple & more-or-less complete) examples on how to use it. Ideally, a quick few lines of Java to show the "receiving" of the bytestream and a few quick lines (ideally in Java) which "posts" to the receivestream's url would be all that's needed to show how this manual upload of bytes can be accomplished in Vaadin. (In DropWizard & Jersey, I can find such examples reasonably easily, but I'm not sure how to gain that level of control in Vaadin.)
(Very very minor bonus: is there a size limit to the post command? eg, can a bytestream of over say ~4GB be sent and received?)
In Vaadin the Upload API is optimised for streaming into File (unlike handling the stream as in Servlet and JAX-RS API). One way is to first stream to a temp file and then when the file is fully on the server side, handle the data from temp file.
Alternatively you can use Flow Viritin add-on and a helper class UploadFileHandler, which give you and API where you read the contents from InputStream, in same way as with Servlet API. See a usage example is in this test.
This isn't a first time this is asked and I actually have a more verbose blog draft about this subject. I'll add a link to that once I get that published.

Is there any limitations to send data with help of webservices from iphone app?

I am working on xamarin ios. I am using webservices to get the data and post the data. When I am trying to upload large data nothing happens. In that case service call never reach on server. If I upload few data then it works fine.
So I just want to confirm is there any limitation to upload data from Iphone app with help of webservices? If not then what may be the cause that in case of large data my service call never reach on server?
For RESTful service:
There is no limit for POST & PUT type of request, while sending data
with web service. But if you use, GET type of request, then there is
limit of data with request.
For GET, limit of data size, depends on type of server.
- For Tomcat - default is 2MB (Upgradable**)
- For PHP - default is 2MB (Upgradable**)
- For Apache - default is 2MB (Upgradable**)
**Upgradable: For more details, click on links.
Oracle - Web service development guideline
Note:
If you are uploading large size of files, then use Multipart Upload method/technique to send your data to web server.
Check request time out interval set with web service request. Large size data require more time than normal request.
Use asynchronous requests, that works in background state for application, for better data transmission, without interrupting user interaction with content of application UI elements.

Controlling IIS BITS uploads

I'm running an IIS web site (built using ASP.NET/MVC) that among other things collects files from multiple agents that anonymously upload the files via BITS.
I need to make sure that only files uploaded from known sources as well as matching certain predefined file name pattern will be accepted by IIS. All other BITS upload attempts must be cancelled.
As I understand, BITS uses an ad hoc protocol over HTTP 1.1 using "BITS_POST" verb. So, ideally, I'd like to hook into IIS, analyze a BITS_POST request info and if it does not satisfy my pre-conditions, drop the request.
I've tried to create and register a filter implementing IActionFilter.OnActionExecuting, but it seems that my filter does not receive BITS_POST requests.
I'd be glad to hear if somebody have implemented similar BITS related solutions and how this was done. Anyway, other ideas are welcome too.
Regards,
Natan
I have never worked with BITS, frankly i dont know what is it.
What i usually do is such situations is implement an HTTP module. On its begin request event, you can iterate through incoming HTTP request data and decide to stop processing the request if data is not complying with requirements. You have full access to HttpContext.Current.Request object from HTTP module code.
With HTTP modules, you can execute .NET code even before entering the ASP.NET pipeline.

Delphi how to avoid sniffers

I'm developing a project with Delphi 2010, at some point this project connects to internet and send some data to a php file via POST/IDHTTP, those parameters encrypted with aes and as you know there is no way to get source code of php files via browser. But when i use sniffer on my project sniffer software shows full path of php file and parameters. I was wondering is there any chance to hide path and parameters with IDHTTP. For example when i try on Skype sniffer only shows decimal characters on skype's transmission. Is it possible to do same or totally hide the traffic ?
Thanks in advance.
You can use HTTPS, it is supposed to be standard way to transmit HTTP traffic through SSL-protected channel. Example of code you can find for example here.
In addition to Andrei's answer, you can consider encrypting your traffic on-top of using HTTPS.
In other words,
1) Use HTTPS protocol.
2) Add your own layer of encryption to encrypt all data coming to and from your server.
In addition to HTTPs and encrypted data, you can also add security by using client certificates. See https://security.stackexchange.com/questions/3605/certificate-based-authentication-vs-username-and-password-authentication
The answers explain the advantages of using CBA, one of them is
certificate usage never involves revealing any secret data to the
peer, so an attacker impersonating the server cannot learn anything of
value that way

Best way for uploading or downloading images in ios . FTP vs HTTP

Best way for upload or download images in ios?
in ios I can upload images and upload images on server by via ftp. I also saw many person use HTTP post methods for upload or download image in shape of NSData.
so which method is fast and secure?
HTTP is the better choice because port 80 is almost always open while port 21 is often closed in business settings.
Neither are faster or more secure for your IOS app. In general FTP is not the most secure technology to be running on your server (sFTP is better), so many people prefer not to run FTP servers, and therefore have to use HTTP for uploads (as Zaph says, on many firewalls, FTP is not even allowed by default for this reason).
But using HTTP for uploads that requires code on your server to handle HTTP POST and put the files in the correct location. The fact that you are writing this code potentially makes it safer: you can validate the incoming data, make sure it is the right size and filetype and take account of any user bandwidth or storage limits.
You don't use HTTP post to download images, but HTTP GET. That doesn't require you to use anything special on the server, and HTTP server can serve it.
Unless you have a good reason not to, I'd suggest using HTTP. A good reason might be that you're integrating your app with an existing FTP service.

Resources