Mar*_*rko 4 html apache static-content websphere-liberty
我有静态HTML页面.使用Apache服务器(通过XAMPP)我曾经将我的HTML文件放在htdocs文件夹中,并且可以通过localhost URL访问它们.
我不确定如何使用Websphere Liberty服务器执行此操作.假设我有以下HellWorld HTML示例index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HellWorld</title>
</head>
<body>
<p>HellWorld</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如何通过Liberty在浏览器中显示此HTML页面?
所需的最小文件夹结构如下
+ SampleHTMLSite.war
- index.html
Run Code Online (Sandbox Code Playgroud)
要创建.war文件,只需压缩index.html文件,然后将压缩文件夹的扩展名更改.zip为.war
如果您通过server run命令在前台运行Liberty服务器,只要您将此网站放在Liberty的dropins文件夹中(通常位于此处:),...\wlp\usr\servers\YourServerName\dropins您将获得类似以下更新的内容:
[AUDIT ] CWWKT0016I: Web application available (default_host):
http://localhost:9080/SampleHTMLSite/
[AUDIT ] CWWKZ0001I: Application SampleHTMLSite started in 0.317 seconds.
Run Code Online (Sandbox Code Playgroud)
如果你去,http://localhost:9080/SampleHTMLSite/index.html你应该能够看到你的HelloWorld HTML页面.
如果您收到以下错误:
Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /index.html
Run Code Online (Sandbox Code Playgroud)
使用任何解压缩程序(例如:7-Zip)打开SampleHTMLSite.war 并确保它index.html直接显示在.war文件内部而不是在另一个文件夹中.您可能有以下结构:
+ SampleHTMLSite.war
+ SampleHTMLSite
- index.html
Run Code Online (Sandbox Code Playgroud)
这意味着访问index.html您需要以下URL:
http://localhost:9080/SampleHTMLSite/SampleHTMLSite/index.html
在较大的项目中,您需要使用Java应用程序,您的文件夹结构可能需要包含其他文件夹和文件.如果您有兴趣了解更多相关信息,请查看以下文章:
处理WebSphere Application Server中的静态内容
最简单的:
dropins文件夹(\wlp\usr\servers\serverName\dropins)中,创建文件夹myApp.warindex.html去myApp.war如果您的服务器配置为轮询监控,则表明您已完成.否则重启服务器(如果已启动).
它将通过http://host:port/myApp/index.html.
| 归档时间: |
|
| 查看次数: |
3783 次 |
| 最近记录: |