简体   繁体   中英

Tomcat deploy to remote server with war file as url

Im trying to deploy a war file to Tomcat. I want to be able to do this via a webpage that lists my war files and then flings a file I click on to the Tomcat server and deploy it.

According to the docs found here I should be able to do this...

http://localhost:8080/manager/deploy?path=/footoo&war=file:/path/to/foo

where path=/footoo is the path on my server that I want to deploy to but can file be the URL?? I cant seem to get it to work.

sidenote: I can do this manually by using the tomcat manager websevice but this point of my project is that you can access my website from anywhere and deploy without having to access the server directly.

EDIT I dont think I have asked this question very well so I am voting to delete it

If you read the documentation it says:

Upload the web application archive (WAR) file that is specified as the request data in this HTTP PUT request, install it into the appBase directory of our corresponding virtual host, and start , using the directory name or the war file name without the .war extension as the path.

So, what you need is a PUT request.

curl can do that for you:

curl --user script:script --upload-file /tmp/test.war http://localhost:8080/manager/deploy?path=/tester

This logs you in as user script with a password of script , and uploads the /tmp/test.war file. When it gets to Tomcat, it will put it in the tester.war file, and deploy it as /tester .

If you want to do this through an actual web interface, the manager app will do that as well. You can select a war to deploy from your browser.

What Tomcat will NOT do is PULL the file for you given a URL. You need to PUSH the file up to the server.

I don't think that feature exist. But you can build a system that uploads the war into the tomcat host and invoke the manager deploy URL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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