I need to scrape information from a web page and put it into my application, but I can't figure out how to download the file into my application in the first place. Anyone have any ideas?
You can use my simple page scraping code. You'll also want to use Versatile Monkey's networking helper class to open the HTTP connection using the best path on a BlackBerry.
Related
How to make images slider (carousel) in Java Spring MVC.
I have admin panel which upload the images to local drive.
I would like to display images from local drive to JSP page in carousel.
Please guide.
Also I tried one example from the link https://blog.e-zest.com/dynamic-carousel-built-using-javascript/ but I am getting javascript error.
Thanks,
Bhavin
First you need to be able to serve your files to web browser. You can serve files from local drive using tomcat or web server (nginx, Apache httpd etc) built-in features without writing Java code or write a Spring controller to read files form drive and serve them if you need custom logic.
Then you could use one of javascript carousel plugins like Slick or another - there is a great choice of those.
Add needed scripts and css to your page and follow selected plugin instructions to create needed HTML with your JSP page.
I'm looking for a java-framework which enables me to easily communicate with a website.
What I'd like to do is for example:
log into a website
open various pages
read information
submit information into forms
send ajax-requests
read ajax-response
What I'm not looking for is a browser automation plugin like selenium. I'm trying to have my application directly communicate with the website.
That's the general outline. If you can think of a better solution for the following problem, I'm more than willing to follow your advice (:
We're working with an webapplication with an gruesome GUI. Unfortunatley we've got no means to tinker with said application or request changes to it. What I'd ike to do is to build is a client which logs into said application, fetches the data and displays them in a more appropriate manner with additional information based on that data while also providing tools to process this data and submit it back to that web-application.
Thanks in advance.
Selenium does come for JAVA. You can download it from here. http://www.seleniumhq.org/download/
Here is a tutorial:
https://www.airpair.com/selenium/posts/selenium-tutorial-with-java
How Selenium web driver works
Selenium web driver (firefox web driver) will open a web browser(firefox) for you and you can actually see what's going on. The choice of opening a browser window may not be the requirement for you. Then you can use:
HTMLUnitWebDriver
PhantomJSDriverService
Take a look at
http://hc.apache.org/httpcomponents-client-ga/quickstart.html
Its not a framework but a library but should provide you the needed methods to interact with your web application
We a have jboss server running and have a basic web setup using Spring but now I would like to stream video into the browser. I am trying to use xuggle but then I read on their website that you can't put it into an Applet or use it with java webstart, so I'm assuming that means I can stream to a browser, is this assumption correct? If so does anyone else know any libraries or how I should go about doing this? If you need any more info or have questions I'll be happy to answer although I'm very new to streaming video and relatively knew to Spring.
UPDATE: So I'm able to generate a video using xuggle, and then I can embed that video in my html code... but I can't generate and stream at the same time. Does anyone have any ideas how to make xuggle push date out to my tomcat server?
You may want to look at Red5 media server.
Since you are doing jsp, just have your code write out the HTML 5 video element. That will provide basic video functionality. This will work in all HTML 5 compliant browsers as well as all mobile devices.
I am writing a java client-server application where some clients have the right to put html files to serve as login pages on the server and the server will provide those pages to the rest of the users when they try to log. To this purpose I have added a preview button , that allows the admin set of clients to visualize the page when they upload it or afterwords . The problem I need to figure it out is how to open the browser to preview the file when the resource is not locally (it was uploaded by another admin and therefore it is remote).
Any suggestion and reference will be greatly appreciated !
Depends on the client; my first choice would be to use the Desktop class to make things simple, if you can guarantee Java 6.
If not, the Bare Bones Browser Launch plays some games on JRE < 6.
See this SO post for a bit more info.
If neither of those suits your purposes, you may need to provide some more info.
Here's I want to do, I want to upload a file that will be processed by a servlet. I would use Apache Commons - File Upload to handle the file to be uploaded.
I've seen the gmail-like AJAX file upload, where there would be a hidden iframe that would later be populated with a javascript to stop showing the upload image or displaying a message that the upload is succesful. However, this uses PHP, where the php file to handle the file upload would include the javascript inside the iframe.
My question is, how would I do this in Java using servlets, without resorting to JSP and imitating the above implementation on PHP. I don't even know if this is possible, so please guide me on a good implementation (without external libraries except for commons fileupload).
Note: I am aware that there are libraries out there that could do this easily, but I first want to know how this happens, how this is possible, and to dirty my hands and learn this.
Edit: Just to add, I would use the streaming API of Apache-Commons FileUpload
It is exactly the same.
The client makes an HTTP request to the server (by submitting a form).
The server responds with some HTML (which links to or embeds some JavaScript).
Switching from PHP to Java is just a drop in replacement. You don't need to change any of the JavaScript. The user guide tells you how to set it up.
http://oreilly.com/pub/a/javascript/2002/02/08/iframe.html is the best idea to file-upload. i done file upload using hidden iframe. Please consult with attached link.