How to use or load flash file exists on different server - java

I want to use flash file stored on another server or repository. I am using below code in xsl to add flash file.
https://www.***.com/docs/swf/Spreadsheet.swf
The problem is I am unabele to create swfObject because that flash file is not getting loaded properly on browser. My xslt application is on another server which is trying to access .swf file using above code. I guess there might be domain related issue. I read somewhere about cross domain.xml file.
Is it really required in above scenario? If yes then where to keep that cross domain.xml file? The flash file that I want to access is on another repository which is not on any web server. So can anyone provide me solutions on this?

Related

How to set-up Persistent Storage for eclipse-tomcat for backup and streaming (not using database)?

I am working on a Java Web-Application project using servlets, eclipse, and tomcat.
I would like to be able to dynamically store/create persistent files from servlets and allow the user to access the files using a link, without storing the files in the database.
I have read that getServletContext().getRealPath("/") is volatile and gets reset every time the server is restarted.
I have also read that creating a directory like "$HOME/.ourapp" would solve this. Although, I cannot seem to find how to set-up tomcat to allow the user to access the files using a link, using the eclipse-tomcat.
Question : How to set-up eclipse-tomcat so that the link to the website "http://localhost/" and the file "http://localhost/temp-xx.txt" is the same, while also allowing to dynamically create persistent data "temp-xx.txt" is generated by a servlet and allow the user to access it and does not get deleted when the server is restarted.
This gets complicated, because Tomcat can server files using DefaultServlet (it just sends files back to the client, exactly as you'd expect from a web server), but it caches files internally, so modifying the file system underneath it can have some surprising behavior.
You can disable caching for the DefaultServlet but I've seen reports that it still behaves in surprising ways. The only fool-proof solution I've seen is to write your own servlet that streams the files from wherever they are stored.
But writing your own streaming servlet isn't as simple as you might think. If you want it to be high-performance, you'll want to enable all the nice HTTP features like range-requests, eTags, If-Modified-Since and all that stuff that the DefaultServlet already provides. Perhaps you should start with using the DefaultServlet and see how far it will get you.
The configuration is actually really easy: just add a <Resources> element to your META-INF/context.xml file and use a postResources attribute. You can find the documentation in the Tomcat users' guide for resources.

How to implement folder upload in a Spring web app?

I'd like to implement in my web application a file/directory upload similar to Google Drive style (I think it's the best example to explain what I want).
So I would like to upload:
a single file
multiple selected files
a selected folder (all files contained in it)
On client side I suppose I have to use HTML5, am I wrong? But How to handle this on server side controller. I'm using Spring MVC 3.2.9
Can you suggest me the best approach?
The hard part is the client side upload of folders. According to this other answer on SO about Does HTML5 allow drag-drop upload of folders or a folder tree?, The HTML5 spec does NOT say that when selecting a folder for upload, the browser should upload all contained files recursively.
Of course it is possible, but HTML5 is not enough and you will have to use Javascript to (recursively) find all files in the folder.
As said by conFusl, you can find a nice example on viralpatel.net Spring MVC Multiple File Upload tutorial. Spring Multiple File upload example. The princips are :
on client side generate (via javascript) a form with one <input> tag per file to upload, and give them names like files[i]
on server side, you then get a form containing a List<MultipartFile> that you can process as usual.

java + google web toolkit (google apps engine)

I need to upload image to the server, where SmartGWT webapplication is running... after trying this solution ( Basic File upload in GWT - first answer), when I have created independent http servlet with mapping in web.xml, I'm able to receive uploaded file on server side (in linked solution - "out" is ByteArrayOutoutStream), so it is in server RAM... Problem is, how to save file to server file system storage.
When I tried to create FileOutputStream instead of ByteArrayOutoutStream, an exception has been thrown that it is restricted class in Google Apps Engine.
Any ideas, how to store file to server, when it is restricted in GAE? Or how can I tell, that I don't want the FileUploading servlet to run under GAE? Thanks for any ideas...
You have no write permissions. You may, however, store the image as a blob or by using the distributed datastore.
From TFA:
Writing to local files is not supported in App Engine due to the
distributed nature of your application. Instead, data which must be
persisted should be stored in the distributed datastore. For more
information see the documentation on the runtime sandbox.

Can anyone recommend an existing java file repository

that will allow my users to edit word documents locally in Word and have them saved back to the server when finished.
The project will be Grails based and I'm looking at things like WebDav but I would need security features that won't allow one user to access another users documents.
And unfortunately the test I ran opening a word document via a WebDav URL first downloaded the file rather than opening directly. So when saved, for example it just saved to c:\download\mydoc.doc.
So I'm looking for alternative ideas if anyone has any thoughts..
Look at this list http://java-source.net/open-source/content-managment-systems
Take a look on Alfresco.
Update
Enabled access protocols are listed in documentation and wikipedia.
CIFS/SMB
FTP
WebDAV
CMIS

Deploying my flex application

I am doing some trial testing awith Amazon ec2 boxes, deploying flex apps running on top of restlet powered webservices. I have this problem - Everytime i deploy the app to the cloud, I'm having to hardcode the IP address of the server into the ActionScript/MXML files (http://72.93.48.39:8080/xxx/abc/) and for certain reasons, i am forced to choose a different IP everytime. and i think its really not the right way to deploy the application.
I would like to know what other people do in such scenarios?
On thinking about it, i thought i could make it pickup values from the HTMLVars of the HTML wrapper. but that again has to be edited everytime again and again.
will it be possible to be able to supply these values : server's ip address, server's port number(in case its not 8080 on some machine) at build time? if so can anyone give me a barbones sample build.xml just as an example?
After much research I (think) have finally found a way to do this. the solution is ant's build.xml file based
the solution is to use EnvGen ant Task to generate a "config.xml" file of sorts. The EnvGen task works on the FreeMarker model - so it takes data and a template to generate files. Data is to be supplied via a CSV file. Template is to be specified using the Freemarker Template .ftl file. Depending on the template EnvGen generates XML files too. the link to EnvGen Task is here - http://www.basilv.com/psd/software-files/EnvGen/index.html#InstallEnvGen
And finally, we program the Flex app to pick up the server end point values from the config.xml file.
Hope this helps someone who is looking for this answer

Categories