Spring, petclinic, Do you want to save this file, or find a program online to open it? - spring

I downloaded the spring mvc petclinic, when I run it, and clicked in the link :
Display all vitiranians
I got a pop up dilog box saying :
Do you want to save this file, or find a program online to open it ?
in the controller that link is defined like this :
#RequestMapping("/vets")
public ModelMap vetsHandler() {
Vets vets = new Vets();
vets.getVetList().addAll(this.clinic.getVets());
return new ModelMap(vets);
}
My question is :
why it does not dsplay vitiranians and just propmpt me withat dialog box ?
any idea or help will be appreciated.
thanks

The application to be used to open a content of a certain type can be customized in some browsers (I know only for Mozilla and Opera):
Mozilla Firefox users
Open Mozilla Firefox
Click Tools and then Options
Within the Options window click Applications
Select the Content Type you wish to adjust. For example, if you want
to change how a .PDF file opens in Firefox, select Adobe Acrobat Document.
In the Action section, change the action to how you wish to open the
file. If you want to download .PDF files instead of opening them,
select Save file.
Opera users
Open Opera
Click Tools and then Preferences
In the Advanced tab click Downloads
Locate and highlight the file extension you wish to adjust. For
example, pdf (or application/pdf). Tip: You can sort these columns.
Once highlighted, click the Edit button.
Within the file type window, specify how you wish for the file to be
handled.

Related

Microsoft Windows7 show thumbnails conflicting with open with a default program

I wrote a windows shell extension to show 3D files' thumbnail image, so user can search quickly. It works when users don't change default open program. However, if a user right click on a 3D file, then select open with to change default open program. It will block explorer to call my shell extension. Does anyone could help me with this?

How to access Print dialog's 'Open PDF in Preview' in os x programmatically

I am building a Delphi application which opens an image and its metadata and prints it. For the Windows version I build a form to generate the PrintPreview, but in Mac I can use the Print Dialog's 'Open PDF in Preview' instead. When I click on it, a PDF file is generated and I can see it, its OK. The problem is I want to access this option directly from a button, so when the button is clicked, the PDF in Preview is opened and the user does not have to open the Print Dialog, then click the 'PDF' and then select 'Open PDF in Preview'. How can I do this?
I read about using Automator, apple scripts etc, but I still can't find it.
Is there any path this generated PDF Preview is stored, so maybe I can open it from there?...
TIA
Possible duplicate of Using Automator or Applescript or both to recursively print documents to PDF but I'll answer anyways.
To answer your question directly see the question I linked to. Basically you need to use System Events from applescript to accomplish that exactly
However, there's a quicker solution using /usr/sbin/cupsfilter. Check the man page for more.
You can call cupsfilter <an-image-file> and you'll get a PDF on stdout, courtesy of OSX's printing daemon. It looks quite configurable but I just learned about it a while ago.
If you want this to open for the user you can save it in a nice place or you can do it the one-shot way and do cupsfilter <your-image> | open -f -a "Preview" to open the PDF right up.

How to open mutiple tabs within a browser using Capybara?

I need to open multiple tabs within a single browser and i need switch over all the tabs.
Give me your suggestions. Thanks in advance.
I'm not so strong in capybara. so, i'm giving solution to switch over between tabs using selenium.
For a instance you clicks a button in a web page and it will open a new page.
The new page may open in a new tab in the same browser window or in a new browser window. That is not controlled by selenium. It will control by the browser which you using.
For a instance take firefox, goto tools->ptions-> tabs-> open new windows in a new tab instead check the option. For example, if you clicks a button it will opens a page only in the new tab of a same browser window. For a sake if you unchecked mean it will open a page in the new browser window. Likewise every browser has its own settings.
Try this code:
new Actions(driver)
.sendKeys(driver.findElement(By.tagName("html")), Keys.CONTROL)
.sendKeys(driver.findElement(By.tagName("html")), Keys.NUMPAD2)
.build().perform();
In above Keys.NUMPAD2 refers that you are gonna move to the second tab in the session.
You can move to Third, Fourth, etc... by giving NUMPAD3, NUMPAD4, etc... respectively. Here i am using windows OS, if you are in some other OS use their shortcuts.
I hope this will help you.
You can use this exact function in Ruby:
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)

No control to new browser window while swiched to it

In my automation, I have to click on a button which opens a new browser instance with search results, and from that window, I have to select a video to upload. I switched to the window using:
driver.switch_to_window( "File Upload" )
In order to upload a video, I have to select the video from that window, but I can't, as there is no way to access that window. Is there any way in selenium webdriver with Ruby or some other plugin or tool I can achieve this?
The file upload windows are usually system windows and selenium/webdriver cannot be used to interact with it. In Java, sendkeys is used to type the link to the file being uploaded. You can try using an equivalent function (something that you use to type data in any textfield etc function) to directly give the link to your video file.
Hope it helps..

firefox open local link to directory with explorer

On a Website for our internal use i show links to local files and folders. the links are like this:
href="file://C:/example/"
href="file://C:/example/test.odt"
The Problem is now that the link to the directory does open in firefox itself with a useless directory listing. Useless because you can just see the files or open them but not copy, insert, delete...
The link to the file work normal and the file is opend by OpenOffice.
By changing the configuration of firefox and setting the following key to false I can open the directory in with explorer.exe but for the file I have to choose the right application.
network.protocol-handler.expose.file
Does someone know a way to get both to work like i want? Means that the Directory is shown by explorer.exe and all files are opened by the right application.
This can be by configuring Firefox or windows, changing the links, or even by writing a small program which opens all the file protocol correctly and will be used as protocol handler for the file protocol in firefox.
Thanks
Raffael
I did the above with small changes in Firefox 14.0.1, which works for me:
Create new boolean value network.protocol-handler.expose.file and set it to false
Create new boolean value network.protocol-handler.external.file and set it to true
Click on a link to a local folder.
In the following prompt, link to the explorer.exe in: C:\Windows\explorer.exe
Files are now open with the default application, folders are open with the Windows Explorer!
I know this is not quite what you want, but you might take a look at the "launchy" addon for firefox:
https://addons.mozilla.org/en-US/firefox/addon/81/
Using this addon you can right click on a file link, go to "launchy" sub-menu, and tell it to open in explorer. This will browse directly to the folder as you want.
I want the same feature you want, however this "works" for now. I have asked the author of launchy to allow it to override the left-click behavior for certain protocols (so it would launch explorer with one click), but I don't have a response yet.
edit: Years later, I will post the solution I started using instead of Launchy:
https://addons.mozilla.org/en-us/firefox/addon/local-filesystem-links/
https://github.com/feinstaub/firefox_addon_local_filesystem_links
This scans for file:// links and makes them clickable. It does inject some HTML which can mess with formatting if you aren't careful, but it does the job.
In about:config You need to add a boolean value with the name network.protocol-handler.expose.file and set it to false and also create a string value with the name capability.policy.default.checkloaduri.enabled and set it to allAccess.
Now you will be able to choose C:\Windows\explorer.exe to open file links.
Tested in FF 19.0.2 in Windows 7.
Try this:
Create new boolean value with the name
network.protocol-handler.expose.file and set it to false
Create new boolean value with the name
network.protocol-handler.external.file and set it to true
Open link to a local directory and on the now appearing box, register the "file"-protocol permanently with the "file"-programm (1st entry).
There should now open the windows explorer.
You can deassociate the type "file" in the Firefox-settings (applications-tab).
After that, a link to a document (i.e. file:///x:\dir\file.doc) worked automatically for me (FF8.0).
Or You can use the Plugin "Local Filesystem Links" (DE version of the page) now.
--
edit:
Link for EN version: https://addons.mozilla.org/en-US/firefox/addon/local-filesystem-links/?src=search

Resources