简体   繁体   English

带有移动和Web客户端的Amazon Web Services上的Java应用程序

[英]Java Application on Amazon Web Services with Mobile and Web Clients

Our new start-up company is trying to build a mobile app with an accompanied website. 我们的新创业公司正在尝试使用随附的网站构建移动应用程序。 We are trying to setup our application on Amazon Web Services. 我们正在尝试在Amazon Web Services上设置我们的应用程序。

We have Java code running in an EC2 instance, which will store data in S3. 我们在EC2实例中运行Java代码,它将在S3中存储数据。 We want clients (iOS and Web for now) to communicate with the Java Backend via a REST API. 我们希望客户端(现在是iOS和Web)通过REST API与Jav​​a后端进行通信。 Ideally the website would be hosted under the same AWS account. 理想情况下,该网站将托管在同一AWS账户下。

The Java Code and REST API are already set up in a very basic form, but the setup of the Website is unclear, since this is new to us all. Java代码和REST API已经以非常基本的形式设置,但网站的设置尚不清楚,因为这对我们所有人来说都是新的。 We also would like to evaluate beforehand if such a setup is even feasible. 我们还想事先评估这样的设置是否可行。

Since I am in charge of the Website i have already spend hours researching this specific setup, but i simply lack experience in cloud/backend development to come to a conclusion. 由于我负责网站,我已经花了几个小时研究这个特定的设置,但我只是缺乏云/后端开发的经验来得出结论。

Here are some questions we would like to answer: 以下是我们想要回答的一些问题:

  • Where would the HTML files and accompanied JavaScript etc. files be stored? HTML文件和随附的JavaScript等文件将存储在哪里?
  • How can data (images etc.) that is stored within S3 by the JAVA code be accessed from the Website directly? 如何直接从网站访问由JAVA代码存储在S3中的数据(图像等)?
  • How could something like bootstrapping of data within HTML files be achieved (in JSON format preferably)? 怎样才能实现HTML文件中的数据引导(最好是JSON格式)?
  • How could the server be set up to compress certain files like CSS or JavaScript? 如何设置服务器来压缩CSS或JavaScript等特定文件?

Please point me into the right direction, any comment is appreciated. 请指出我正确的方向,任何评论表示赞赏。

Where would the HTML files and accompanied JavaScript etc. files be stored? HTML文件和随附的JavaScript等文件将存储在哪里?

Either on the same AWS EC2 box or a different one, just give it a static IP and link that IP to the domain you want, done. 无论是在同一个AWS EC2盒子还是不同的盒子上,只需给它一个静态IP并将该IP链接到您想要的域,就完成了。 Just remember to have port 80 open as a firewall rule. 请记住将端口80作为防火墙规则打开。

How can data (images etc.) that is stored within S3 by the JAVA code be accessed from the Website directly? 如何直接从网站访问由JAVA代码存储在S3中的数据(图像等)?

The files will have some url that you can link to directly in your html so it's essentially just a url. 这些文件会有一些你可以直接在你的HTML中链接的网址,所以它基本上只是一个网址。

How could something like bootstrapping of data within HTML files be achieved (in JSON format preferably)? 怎样才能实现HTML文件中的数据引导(最好是JSON格式)?

You have a number of choices here. 你有很多选择。 You could potentially create some JSP files to generate the HTML and load the JSP files on access and cache them so they load up super fast. 您可以创建一些JSP文件来生成HTML并在访问时加载JSP文件并对其进行缓存,以便加载速度超快。 You could argue however, this is overkill and in some ways, the REST endpoint should be robust enough to handle the requests. 然而,你可能会说,这是过度的,在某些方面,REST端点应该足够强大以处理请求。

Part of me thinks you should endeavor to use the REST API for this information so you just have to manage one endpoint, why make an extra endpoint or over engineered solution for the HTML that you then have to maintain? 我的一部分认为您应该努力使用REST API来获取此信息,因此您只需要管理一个端点,为什么要为您必须维护的HTML创建额外的端点或过度设计的解决方案? Build once and reuse. 构建一次并重用。

How could the server be set up to compress certain files like CSS or JavaScript? 如何设置服务器来压缩CSS或JavaScript等特定文件?

During the build process, run the files through a minify process. 在构建过程中,通过minify过程运行文件。 This is built into maven so you could do it automatically or by hand using something like jscompress . 这是内置于maven中,因此您可以使用jscompress之类的东西自动或手动完成 This Minify plugin shows how to automatically minify your resources. 此Minify插件显示了如何自动缩小资源。 Consider you'll need to be using Maven though as your build tool. 考虑一下你需要使用Maven作为你的构建工具。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM