简体   繁体   English

如何为现有的Web应用程序创建桌面应用程序?

[英]How to create a desktop app for the existing web application?

Well, I've tried to do some researches before creating a question but only a little has been found. 好吧,我尝试在提出问题之前做一些研究,但只发现了一点。

Basically, I have got a Spring-based web application. 基本上,我有一个基于Spring的Web应用程序。 Apparently, you can navigate through web application using HTTP requests and URLs. 显然,您可以使用HTTP请求和URL在Web应用程序中导航。 If you want to edit a user you do a GET request /users/edit/{id} and a new page appears. 如果要编辑用户,请执行GET请求/users/edit/{id}然后会出现一个新页面。 Then you make some changes to the user and do a POST request /users/edit/{id} and let's say the main page appears. 然后,您对用户进行一些更改,并执行POST请求/users/edit/{id} ,假设出现了主页。

So, now I need to create a desktop application which can do the same things. 因此,现在我需要创建一个可以执行相同操作的桌面应用程序。 Do I need to rewrite the whole app to port it on the desktop? 我需要重写整个应用程序以将其移植到桌面上吗? Is it possible somehow to do sort of HTTP requests from the desktop app to the server, then get a response and process it? 是否可以通过某种方式执行从桌面应用程序到服务器的HTTP请求,然后获得响应并进行处理? Or perhaps there is a proper way to do it? 也许有适当的方法可以做到?

I feel like it's a big topic but I only need you to point me in the right direction as I'm lacking experience in creating both desktop and web applications together (I'd say, I have never ported app from web to desktop and vice verse) . 我觉得这是个大话题,但我只需要指出正确的方向,因为我缺乏同时创建桌面和Web应用程序的经验(我想说,我从未将应用程序从Web移植到桌面,反之亦然诗)

Earlier I created a few apps using JavaFX and I want to use it again as my GUI platform for the desktop app. 之前,我使用JavaFX创建了一些应用程序,我想再次将其用作桌面应用程序的GUI平台。

You can go for a solution like, Electron . 您可以寻求类似Electron的解决方案。

It's a framework for creating native applications with web technologies like JavaScript , HTML , and CSS . 这是一个使用JavaScriptHTMLCSS等网络技术创建本机应用程序的框架。 It uses Chromium and Node.js . 它使用ChromiumNode.js You can develop your desktop GUI applications using front and back end components originally developed for your web application. 您可以使用最初为Web应用程序开发的前端和后端组件来开发桌面GUI应用程序。

I'm just pointing you a way. 我只是为您指出一种方法。 You can look in to this solution and it's also open-source. 您可以查看此解决方案,它也是开源的。

If you were about to develop the frontend from scratch I'd recommend you to use something like Ionic Framework where in the latest beta 4 allows you to write once run everywhere (web, PWA, desktop with Electron, and build native build for iOS and Android). 如果您要从头开始开发前端,我建议您使用Ionic Framework ,在最新的beta 4中,您可以编写一次随处运行的内容(Web,PWA,使用Electron的桌面,以及为iOS和iOS构建本机版本)。 Android)。 Basically Ionic is an Angular 7 library/superset that allows you to create mobile apps based on a webview. 基本上,Ionic是Angular 7库/超集,可让您基于Webview创建移动应用程序。 This webview can be embedded and run on any device in a native way. 该Web视图可以以本机方式嵌入并在任何设备上运行。

Even though the same codebase can be run on multiple devices you can customise the look and feel on each platform and access through Cordova, Electron or Capacitor the native device capabilities and hardware. 即使同一代码库可以在多个设备上运行,您也可以在每个平台上自定义外观,并可以通过Cordova,Electron或Capacitor访问本机设备的功能和硬件。

If you don't want to rewrite the web client, you can use any desktop framework with the preferred language you want. 如果您不想重写Web客户端,则可以使用具有所需首选语言的任何桌面框架。 Any modern language/framework will allow you to make HTTP requests against your backend and get the data through your API. 任何现代语言/框架都将允许您针对后端发出HTTP请求,并通过API获取数据。 Honestly, nowadays I'd day that JavaFX is not the best option out there and I'd recommend you to go through the web-based approach. 坦白说,如今,我认为JavaFX并不是目前最好的选择,我建议您采用基于Web的方法。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将现有Web应用程序转换为桌面应用程序 - Converting an existing web app to desktop application 如何在Java桌面应用程序和Web应用程序PHP之间创建通信? - How to create a communication between Java Desktop Application and Web Application PHP? 如何在Java中将桌面应用程序转换为Web应用程序 - how to make my desktop application to web app application in java 如何从现有的Web动态应用程序创建Web服务 - how to create web service from existing web dynamic application 创建使用不同语言的混合桌面和Web应用程序 - Create hybrid desktop and web application with different languages 如何创建Java桌面应用程序? - How to create a Java desktop application? 桌面应用程序如何与Web应用程序通信? - How can a desktop application communicate with a web application? 在现有的Web应用程序中创建API还是单独创建? - Create an API within existing web application or separate? 如何创建外观与桌面相同的Java Web应用程序? - How can I create a Java web application which looks the same as my desktop? 如何使用Java处理Outlook Mail Window(Desktop App)窗口的关闭并切换回Selenium中的Web应用程序 - How to Handle closing of outlook Mail Window(Desktop App) window and switch back to web application in selenium using java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM