eclipse WTP HTTP 预览服务器 - 如何重新配置​​默认服务器端口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/741871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:40:40  来源:igfitidea点击:

WTP HTTP Preview server - How can I re-configure default server port?

eclipseeclipse-wtp

提问by Steel Plume

Under Eclipse Ganymede how can I re-configure the default server port (8080) of the Eclipse WTP "HTTP Preview Server"?

在 Eclipse Ganymede 下,如何重新配置​​ Eclipse WTP“HTTP 预览服务器”的默认服务器端口 (8080)?

@Leonel

@莱昂内尔

I suppose you never saw the "view" linked to this question, I asked "HTTP Preview Server", not other server views where the port is obviouslyvisible between any other settable option ;-) otherwise I would not have asked on StackOverflow if the real problem was only to search between form settings

我想您从未见过与此问题相关联的“视图”,我问的是“HTTP 预览服务器”,而不是其他服务器视图,其中端口在任何其他可设置选项之间明显可见;-) 否则我不会在 StackOverflow 上询问真正的问题只是在表单设置之间进行搜索

@Leonel

@莱昂内尔

Tnx for your reliability, it's not a common virtue in these days ;), in fact as read I'd like to know if there is some hidden configurable param :p

为了您的可靠性,Tnx 在这些日子里不是一个普遍的美德 ;),实际上我想知道是否有一些隐藏的可配置参数 :p

回答by Andres Rios

HTTP and J2EE Preview servers can be used as well, but as you have discovered, there isn't any UI to change the port used if there is a conflict. However, you can change it manually.

也可以使用 HTTP 和 J2EE 预览服务器,但正如您所发现的,如果存在冲突,则没有任何 UI 可以更改所使用的端口。但是,您可以手动更改它。

  1. Go into your workspace directory and open the file .metadata.plugins\org.eclipse.wst.server.core\servers.xmlinto a text editor or using File > Open File...in Eclipse.
  2. Find the <server>element for the Preview server in question and add a portattribute, e.g. port="8181".
  3. Restart Eclipse to pickup the change.
  1. 进入您的工作区目录并将文件打开.metadata.plugins\org.eclipse.wst.server.core\servers.xml到文本编辑器或File > Open File...在 Eclipse 中使用。
  2. 找到相关<server>预览服务器的元素并添加一个port属性,例如.port="8181"
  3. 重新启动 Eclipse 以获取更改。

回答by Leonel Martins

Assuming you want to change the port for one server configuration, try this: open the configuration double-clicking the desired server on the list of servers (menu option Window/Show View/Servers)? There is a group named Portswith a list of ports. I think you want to change HTTP/1.1(to edit it, click the port number. And dont forget to CTRL+sto save it. ;)
EDIT: First, sorry for the lazy reponse. You was right (kinda). I saw it but never used it. I use Jboss, Tomcat or Jerry as server. I created an HTTP Preview and noted that there inst a port to configure.

假设您要更改一个服务器配置的端口,请尝试以下操作:在服务器列表中双击所需的服务器(菜单选项Window/Show View/Servers)打开配置?有一个以Ports端口列表命名的组。我想你想改变HTTP/1.1(编辑它,点击端口号。不要忘记CTRL+s保存它。;)
编辑:首先,对懒惰的回应表示抱歉。你是对的(有点)。我看过,但没用过。我使用 Jboss、Tomcat 或 Jerry 作为服务器。我创建了一个 HTTP 预览并注意到有一个要配置的端口。

I ran my server test and eclipse complains

我运行了我的服务器测试并且 eclipse 抱怨

And looking at the help pageyou notice that you can change it:

查看帮助页面,您会注意到您可以更改它:

The HTTP Preview server is a Hypertext Transfer Protocol (HTTP) embedded test server that is integrated with the workbench. It is intended for preliminary testing and saves you time to download, install, and set up an HTTP server. However, as your static Web project progresses through its development cycle you are encourage to test and run on an external HTTP server. You can use the HTTP Preview server as a convenient way to check for errors before you do a final test on an external HTTP server.

HTTP 预览服务器是与工作台集成的超文本传输​​协议 (HTTP) 嵌入式测试服务器。它用于初步测试并节省您下载、安装和设置 HTTP 服务器的时间。但是,随着您的静态 Web 项目在其开发周期中的进展,我们鼓励您在外部 HTTP 服务器上进行测试和运行。在对外部 HTTP 服务器进行最终测试之前,您可以使用 HTTP 预览服务器作为检查错误的便捷方式。

So, i think you cant do it. :(

所以,我认为你做不到。:(

回答by SoSufi

In Eclipse menus , Go to window->show view--> servers

在 Eclipse 菜单中,转到 window->show view--> servers

when you get list of server in server tab double click on the server that you have and change the port number manually.

当您在服务器选项卡中获得服务器列表时,双击您拥有的服务器并手动更改端口号。

Hope this will solve the problem.

希望这能解决问题。

回答by pushpendra yadav

Open Your .metadata where your project is stored on your workspace. brows upto the file path .metadata.plugins\org.eclipse.wst.server.core\servers.xml

打开您的 .metadata,您的项目存储在您的工作区中。向上浏览文件路径 .metadata.plugins\org.eclipse.wst.server.core\servers.xml

open the file servers.xml and in server tag add the attribute port = "any port number". example: server.xml

打开文件servers.xml 并在服务器标签中添加属性port = "any port number"。示例:server.xml