If you find that FireFox users can't download files, try using Self.GotoURL and pass True for the InNewWindow parameter as well as having the user disable popup blockers. Set ForceDownload to True to instead ensure these types of files are downloaded instead. For example, most web browsers will try to display simple text files and many will display PDF files inline. When True, the browser will always download the file rather than try to display it. Indicates whether the browser will always download the file instead of trying to display it (depending on the MIMEType). URL ) // This causes the file to be downloaded ForceDownload = True // If False, the browser may try to display the file instead of download it TextFile. TextFile = New WebFile // TextFile is a property of the web page TextFile. Reporting bugs and making feature requests.Using Xojo Web to create complete web apps and solutions means not having to learn a bunch of interpreted languages and dozens of ever-changing frameworks. I’m looking at you: HTML, CSS (is that even a language?), JavaScript, PHP, et al. Of course, Xojo Web not only makes it possible to create your own web apps, but it also acts as the perfect middleware that your desktop and iOS apps can communicate with. Learn about APIs and web services with Xojo in the tutorial blog post. In this two part tutorial you will see how easy it is to create a basic web service using Xojo Web. In the second part, we will create a Desktop client to talk with the web service (you may want to add iOS to the list).īefore we start, let me point out that this tutorial leaves out some details related to error checking, validation, data sanitizing and other specifics related to inputs and outputs in order to focus on the central topic. In addition, if you want to follow and reproduce the steps of this tutorial, then you need to download the Chinook Database, named “test.sqlite” in this tutorial. Let’s start creating a web service! Open the Xojo IDE, create a new Web project, and name it WebService. The first thing you’ll notice is that Xojo adds a web page to the project by default – even when our web service does not display a UI. The good part is that you can mix both worlds, adding the webservice part to your regular Web app!. In fact this tutorial will put all the logic in the App object. Start by adding a new property in charge of the reference to our SQLite database (of course, it will work also with PostgreSQL or MySQL engines). With the new property selected, go to the Inspector to set the name, type and scope using these values: Select the App object from the Navigator (the left panel in the Xojo IDE), choosing the Insert > Property option from the contextual menu. Now is time to create a new SQLiteDatabase instance and assign it to this property, so it will point to the SQLite database file when the app is running. Write the following code in the resulting Code Editor: dim f as FolderItem = ("test.sqlite") For that, make sure the App object is selected and add the Open Event Handler to it using the Insert > Event option. If database.Error then MsgBox "Error connecting to the database"Īs you can see, it is pretty much the same code we already use when creating SQLiteDatabase instances in our Desktop apps, linking to our SQLite database file and stablishing the connection so we can operate with the database engine from our app. Xojo Web projects offer two ways to handle the request received. This is the one that fires every time a client app (it may be a Web Browser, desktop or mobile app) connects to the URL associated with the IP address and port combination that is listening for incoming requests. If we were writing a Web App, then this would be the event we would use to attend, process and send the requested web pages, for example. However, for web services we need to add the HandleSpecialURLevent to our project. The main difference is that, in this case, we can use typical URL signatures when its about talk with web APIs, where the methods (i.e, the requested action by the clients or API consumers) is part of the URL itself. In addition, this is the event that will allow our Web apps to attend and process the callbacks from other external web services, as could be PayPal, for example.įor example, a valid URL that can be trapped and processed by HandleSpecialURL is: The unique consideration is that these URL need to include the word Special or API as part of their URL path. Where getCustimers is in this case one of our API methods.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |