开发者

How do I add a servlet to an existing website with IIS7 and Tomcat6?

开发者 https://www.devze.com 2023-01-03 05:02 出处:网络
I\'ve configured IIS7 and Tomcat6 successfully with the isapi redirector. I can get my servlets from tomcat\'s examples, and also 开发者_StackOverflow中文版my own servlets running from localhost.

I've configured IIS7 and Tomcat6 successfully with the isapi redirector. I can get my servlets from tomcat's examples, and also 开发者_StackOverflow中文版my own servlets running from localhost. http://localhost/examples/servlets/ works fine for the supplied tomcat examples. How do i add servlets to existing web sites? I've tried adding a virtual directory to my website, the same way i did for the Default Website, but i get 404 errors thanks


You shouldn't be adding anything to that directory or root. The proper way to do it is to create your own servlets and package them in a WAR file. That will give your project its own domain/context and keep your servlets separate from others.

Given that, you'll have to tell IIS how to redirect requests for your new context over to Tomcat.


This will work if http://YourSite.com:8080/YourWebApp works. If that doesn't work, you probably have the same problem I was looking to solve.

IIS has an HTTP Redirect module that may do what you're looking for. In the IIS Manager, go to your folder in your existing website that you want to redirect to your Tomcat apps. (Make a new folder if needed.) Look for HTTP Redirect in the features view. It's straightforward after you double-click it. It will redirect browsers anywhere you want, but the new URL will not be hidden or an alias.

If it's not there, you need to install it. If you're using Windows Server 2008, use the Server Manager to add the Role. If it's Windows 7, use "Turn Windows features on or off." It's in one of the folders under IIS.

0

精彩评论

暂无评论...
验证码 换一张
取 消