I've inherited a Java web app that actually uses a Silverlight XAP for one small section of functionality, which allows users to upload large batches (1+) of images to a directory on the server.
The business requirements are provided in more detail below, but can be summarized as follows:
Users must be able to upload multiple images at the same time - if the user has 500 images to upload they shouldn't have to click a button, select the next file, and click "upload" 500 times; they should be able to select all 500 files from the local file system and upload them as a single "batch"
The file upload component must be AJAX or AJAX-like (does not require a page redirect/refresh)
The developer who chose Silverlight did so because:
He knew C# and used to be a Silverlight developer ;-)
Silverlight does meet those requirements
Silverlight has (according to him) better browser coverage than our JS technology (jQuery)
When management found out that Silverlight was chosen (which they only did during this hand-off!), they flipped out because Microsoft/Silverlight is not a part of our standards/platform.
I've been asked to research what it would take to re-write this in something that isn't Silverlight and is standards-compliant. We're a Java camp, and have been given the following acceptable candidates for technology selection:
Any Java view technology that could satisfy these requirements (GWT, maybe even JSF?!?) - this would be my preference
JavaScript/jQuery/QooxDoo/etc.
Applets (ehhh...)
Flash (I have no experience developing Flash/Flex and prefer this the least but will entertain the idea for the company's sake)
Of course, developer skill sets weigh-in heavily. The project has been handed to me and one other developer. Both of us have decent JS experience, strong Java and JSP background, but zero Flash.
The most important thing here is that a user can have the following experience:
They click a button (which would be a part of this component) that reads "Select Images"
A modal dialog pops up (modality is my personal "requirement", but not mandatory though)
Dialog allows them to pick a folder on their local file system, and select 1+ image files from inside that folder
Dialog has an "Upload Now" button, once user clicks it the dialog disappears and the component shows a progress bar of each photo being uploaded, sequentially
I've spent all afternoon researching GWT, JSF, ICEFaces and jQuery, and they all seem like they could handle these requirements, but I have not seen anything that assures me.
My question is: is there a Java solution that can accomplish this, and if so, what (GWT, JSF, RichFaces, etc.)?
If not, then can jQuery or any other JS lib do this?
If not, do I have any other options besides applets or Flash (and, of course, Silverlight)?
I would honestly rather consider pitching a new technology to our Enterprise Architecture committee than to do an applet (which is the anethma of Java development) or Flash (which I would have to learn from scratch).
Thanks in advance for any nudges in the right direction!
Edit
I know many of you may be tempted to answer by suggesting completely different alternative solutions. Please see my comment to #GolezTol's answer, but basically these constraints are hard-bounded and beyond my control.
Java must be installed and available too. But if a use should be able to upload 500 files, I would choose to give them an FTP account, or upload the files in a compressed format like a zip file, which I think any OS can create natively. Java, Flash, Silverlight.. All of those are components that are not always available. And I don't think a web interface is the most suitable for uploading so many images.
Related
I'm using IntelliJ IDEA, I have coded a frame which I want to put into an HTML file so I can run it in my browser, how do I do this now that I cannot use JApplet? I have found this documentation: http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html and this http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html but I am new to programming and find this difficult to follow. I don't know for instance how I would go about putting my class files and the image that I used in a separate directory nor do I know how I go about signing my application so that it will run in a browser.
I want to put into an HTML file so I can run it in my browser,
You can use the Desktop class. This class allows you to access default applications from your desktop.
Read the section from the Swing tutorial o How to Integrate With the Desktop class for more information and working examples.
See Java Plugin support deprecated and Moving to a Plugin-Free Web.
Note that is one of my 'copy/paste comments' that does not explicitly mention JFrame based apps., however the links are still relevant in that Oracle & browser makers would not be phasing out support for applets if they wanted programmers to keep trying to shove rich client apps (e.g. Swing GUIs) into thin client web pages.
OTOH you can offer a JFrame (or a JApplet) to be launched from a link in a web page to end up free floating on the desktop of the user by using Java Web Start.
Even then, it is not a simple matter for the programmer or the end user. The programmer needs to ensure the app is digitally signed using a code signing certificate issued by a CA (usually they are expensive). The end user used to just be able to click the link, 'OK' the prompts produced by the Java virtual machine, and see the app appear on-screen. But now most browsers will download the launch file to the local file system rather than directly hand it to the JVM to be launched. So the user faces an extra step in explicitly finding the downloaded launch file and double clicking it.
This is all due to security concerns related to bugs in the plug-ins that run things in web pages. So if you were to find a way around all these hoops, please let us know. It is a security bug that requires urgent fixing.
I have a Google App Engine Application, and as part of that Application I have my standard HTML pages, Home, ContactUs, Testimonials, Pricing ETC ETC, when users click on "login" or go to a specific URL eg (www.diarybooker.com/demo) it loads the actual application.
All these standard HTML files are fairly static files though, with analytics and SEO etc in them, however in order to update these currently I need to release a new version of my application every time.
Can anyone offer any advice as to how I can JUST update the HTML without having to release a new version of my application (especially if I am in the middle of a development cycle and don't want to branch just to update a contact number or fix an SEO issue etc)
It is entirely possible that I am actually using the system incorrectly and that I should be re-wiring things better/differently, but I cant find any information about how this SHOULD be setup, and Im not even sure what to search for either, so if anyone can at least point me in the direction of some information on this, I would be very greatful!!
By way of an alternative example, I have a friend who is running www.wineathome.org.uk and if you click on "attend a tasting" it moves off into http://wineathomeuk.appspot.com. Clearly this is not very clean and is also not the way to make it work, I could embed the application in an iframe, but is that really the way to go?!
You have your application code in source control, right? I'd suggest that you create a deployment directory and clone into it the version of the application that you want to have running on AppEngine. Then, copy into the deployment directory the versions of the HTML files that you want updated. Deploy away.
That is the only strategy that's going to work for you. The GAE deployment tool only deals with your application as a whole.
Looks like you have a couple of issues going on.
On the first issue as #AdamCrossland states you can use source control. I use git and create branches for my application at different versions. If you do that you can merge your updated HTML back into an older branch then update your application from that branch. That way your only changing the HTML files and leaving the application in it's current state. App Engine deploy is intelligent and will only upload the modified files. Doing this from Eclipse is a bit more difficult than from the CLI IMO, but YMMV.
The other issue of a friend clicking on attend a tasting routing the url to appspot is a bit harder to deal with unless some code is provided. I would think it is because the code is doing a redirect to a hard coded URL. I have several application mapped to a domains and none of them route to appspot unless I forced it to in order to use some functionality like HTTPS which only works on appspot.com. I personally try to avoid iframes it opens up an avenue for exploits.
I am looking for an addition for our "livestream and podcast" solution, which uses a camera to film speeches in our house.
It has been requested to view the slides of our speakers directly as a image in the webbrowser instead of the video stream. We don't want/can not install software on the speakers laptop, so I thought about a Java applet, which the speaker can just run via a webbrowser.
So what I need is technically this:
[speakers laptop] -> [Screencapture every N seconds via applet on a webpage] -> [Displaying the screen of the speaker on a different webpage for the external viewers]
I know there are Java applications which do record the screen, but save the file output locally. I need something that does the same, but sends the image to the server. On the server side I thought about a websocket.js accepting and displaying the image (other suggestions are welcome).
It would be great if somebody could help me out here. Btw, I never programmed in Java, so telling me which frameworks I need won't really help me.
Thanks!!
I was recently asked to evaluate possibilities for live screen-cast via applet. Most video APIs do not support codecs that have high enough compression (e.g. JMF). Some APIs can do advanced formats (JFFMPEG, Xuggle) but also use natives. While natives are normally no problem for an app. launched (free floating) using Java Web Start or a Plug-In 2 applet, the makers of Xuggle identify 'the order of loading natives' as a problem (e.g. won't work) for both JWS and applets.
It is a pity that more than a decade into its development, Java has no reasonable API for video capture/processing that can be deployed for a wide use (applet/JWS based - for the 'general public') GUI.
Perhaps you can find a solution using Flash.
Update 1
In fact, I do not need the screen to be recorded as a video.
In fact, you mentioned much of that in your initial question, but I focused on just a few keywords before drafting a reply. My bad. :P
OK.
Getting an image is relatively easy. An applet would need to be trusted in order to get a screenshot, but once trusted, it is just a few lines of code to get the image.
Encoding the image to JPEG of particular quality/compression setting (in memory) is also doable.
Sending the image to the server would depend on the size in bytes and connection speed, but one image with a high compression, every 10 seconds, should be doable. The server would need to implement functionality to accept the image.
As far as displaying the image on the client, it seems you already have some ideas based around JS. If you can make that work that would be optimal, since it can then be viewed in browsers with no Java.
I would still recommend you deploy the app. to the 'speaker' using Java Web Start, rather than embed an applet. A JWS app. will give you less deployment & maintenance troubles, and the JWS launch is ..nicer. Further, a free floating frame launched using JWS can minimize itself (or in later JREs, become transparent), during the action of taking a screen image - thereby capturing everything on the screen except itself.
Update 2
I actually found this code here.
That is ..horrible. Not the code, the site. When I visited it I got a message saying a pop-up had been suppressed (fair enough). Then there was the irritating 'vibrating dialog' hovering in the middle of the page (and following the scroll). You click the little x to see - another tab opened with yet another floating dialog, saying some other rubbish about how "You've won.." - with sound loud enough to drown out my high volume trance/dance playlist.
Then after closing that the hell out of my FF, I go back to the original page, close the damn 'dialog', scroll down & see.. a red background to the code (shudder). That is as far as I could manage. I closed the page with the code.
Try this code instead, for a single screen-shot.
Would it be possible to use this on the client side..
Yes.
.. and receive it with javascript on the server side?
Not really. Unless you mean an IIS based server running Microsoft's JScript. JavaScript is a client side technology.
For security reasons, servers need to protect themselves. E.G. From:
Someone creating a slavebot that uploads all the 1000s of docs on the slave machine's to the site - to make it crash.
People high-jacking your server for storing and serving bestiality porn (or worse).
Because of things like that (bad people have lots of imagination), while servers can easily accept uploads, they are generally not configured by default to allow them.
.. (I don't want Java on my server ;-)
It can be done using PHP, ASP, CGI etc. It does not need Java specifically, but it does need some active involvement from the server, if only to check the size of what is being uploaded and abort if it gets too large!
..Will take a look at the link you posted, but as I said, I can't program in Java, though I can understand some of it. Thanks!
It sounds like you'll need some help getting the server-side of it ready, as well. It is trivial for someone that knows how (not me), but a potential security nightmare for the inexperienced.
Update 3
where do I add the function to send the picture?
Sorry. I've not tried to implement that - you'd want to want to encode it to JPEG before sending, to reduce the size. See this code for how to provide an adjustable compression/quality where the user can see the effect.
There are various ways to get an image to a server. E.G. sockets, HTTP, FTP.. AFAIU it would depend on how the server is accepting it. I am unfamiliar with the specific term 'websocket' or the node.js script. Can you link to what you mean?
..the old code added to pastebin, so it's readable
Smart thinking. I notice it uses sockets, it was in the back of my mind that sockets would be best for this, since they have low overhead and short wait times.
Im trying to resolve following dilemma. I have to develop whole webpage system(with user friendly content management, it should look like very simple Drupal or Joomla) as a project to school. The webpage should have function of adding and removing articles, editing menus, editing whole webpage layout(header position, menu position etc).
Im in phase of deciding which system would be the best for this purpose. I wrote several applications in GWT. It's very quick to develop something, it works on Tomcat etc. So it could be very good adept for this task. But recently I got an idea of writing whole webpage system in JavaFX 2.0 (webpage would open inside the browser).
What is your opinion about this fact ? Should I use JavaFX or GWT? I'm not sure if whole webpage will be quick enough in JavaFX. If the users that will be visiting this page wont have problems with launching this page etc. I havent found any information about this on the internet.
Thanks for your answers :)
Go for GWT (also consider using Vaadin or SmartGWT). It does not require a Java Virtual Machine to be installed on the client. Also, GWT allows the client to download only small pieces of the application, and not the whole thing.
You cited two Content Management Systems like Drupal and Joomla that are written in PHP, so maybe the best solution for you is a CMS written in java like Alfresco or Magnolia.
do you want to do a web page or an applicatin for one plugin ? GWT of course.
GWT
GWT follows a most innovative approach: you write the entire application in Java. But it’s executed in Javascript. A good portion of your code is cross-compiled to Javascript and uploaded to the client.
Judging from the presentations I’ve seen, this approach works surprisingly good. In former times the GWT compiler used to be slow, but today, they seem to have solved (or at least alleviated) the problem. As far as I can see, GWT is an excellent choice
javafx
JavaFX 2.0 is a pretty new GUI framework. So expect a few glitches. The good news is that it’s likely to improve over the years. And I suppose people will start to write JavaFX component frameworks if JavaFX is going to be popular.
There’s a video showing the domain of JavaFX very clearly.
Container terminal monitoring with 3D JavaFX
Source
OK so, let's say I have a Java applet that takes a while to load (~5 secs). It's getting the mysql-connector.jar and it's loading. Well.. instead of the gray box with the coffee logo... can I make it have a simple progress bar with the percent?
Thanks.
If you need the mysql-connector it seems like your application is fairly complex, and that you should, at least consider, using java webstart. From the faq:
How does Java Web Start relate to Java Plug-in Technology (applets)?
The two approaches are very similar. The key difference is in the user experience. If the Java application/applet needs to interact with a web page and be tightly bound to a web browser, then applets may be the solution. On the other hand, if browser independence is important, then Java Web Start is the deployment platform of choice.
If you really want to do the progress bar, this page describes a solution, but it's not trivial by any mean.