java - 我对托管 Java Web 应用程序有什么不明白的地方?

标签 java node.js web-applications firebase web-hosting

我是 Java 新手,我正在尝试 host a Java web app using Firebase .

问题

我的问题似乎是我的 index.html 文件在我的 Java 文件结构中不存在。因此,我无法在我的 firebase.json 文件中“指向它”。

问题

  1. 对于如何托管 Java Web 应用程序,我有什么不明白的地方?
  2. Java Web 应用在部署时是否有 index.html 文件(Firebase 显然需要该文件)?
  3. 如何才能成功托管我的 Java Web 应用?

Firebase 托管设置说明:

SETUP & INSTALLATION

First Time Installation

You should have Node.js installed (you do not need to run Node, just have it installed)

$npm install -g firebase-tools or $sudo npm install -g firebase-tools

Updating Previously Installed Firebase Tools

$npm update -g firebase-tools or $sudo npm update -g firebase-tools

DEPLOY YOUR WEBSITE

  1. $cd into your website directory and run $firebase init
  2. Then deploy your website with $firebase deploy

我的错误消息:

当我按照托管说明并浏览到 https://my-example-firebase.firebaseio.com/ 时,我收到以下错误消息。

Page Not Found

This file does not exist and there was no index.html found in the current directory or 404.html in the root directory.

Why am I seeing this?

You may have deployed the wrong directory for your application. Check your firebase.json and make sure the public directory is pointing to a directory that contains an index.html file.


我的 firebase.json

{
  "firebase": "my-example-firebase",
  "public": ".",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ]
}

如您所见,我的 firebase.json 文件假定我的 root 目录是我的 public 目录。但是,它不包含 index.html 文件。因此,这就是我认为我所缺少的关于 Java Web 应用程序和文件结构的结构。没有 index.html 文件。


我的文件结构

(由 Eclipse 搭建)(部分)如下所示。

root
  Deployment descriptor: myproject
  JAX-WS Web Services
  Java Resources
  Javascript Resources
  build
    src
      com.example.myproject
        MyprojectUI.java
          MyprojectUI
    test
    libraries
  WebContent
  ivy.xml
  ivysettings.xml

我仔细查看了它,没有 index.html 文件。我想知道是否需要将某些内容编译为 HTML 和 Javascript?然后提供该文件?我迷失了,很困惑。请有人帮忙。

最佳答案

Firebase 托管仅用于托管静态资源,例如 HTML、JavaScript、CSS、图像等。

Firebase 托管无法用于运行您的 Java Web 应用程序。

关于java - 我对托管 Java Web 应用程序有什么不明白的地方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32217764/

相关文章:

java - 使用选择排序查找数组的中位数

java - 从 Adapter 类填充 Activity 的 TextView 时出现问题

spring-mvc - 用于 webapp 的独立 Tomcat 服务器

web-applications - 合并2个GetText文件

java - 在 webapp 中实现通知

java - 如何使用 java 为任何数据库中的表列生成 DDL?

java - Tomcat - 异常日志

javascript - 异步/等待正确的错误处理

node.js - 如何在 iojs 中获取模板字符串的原始版本

javascript - 我可以在一台服务器上运行 2 个进程吗,一个用于监听请求,另一个在某些数据存储上处于轮询循环中