How to write a simple HTTP server with Java SE? If you want to support JSP, how can ASP or PHP be improved? If not, are there other languages that can be implemented?

Source: Internet
Author: User
I think so, I have to write a few parsing jsp,asp,php compiler is not realistic, so I do this server when the supervisor hears the Dynamic Web request, the request forwarded to IIS (if the request is ASP), similarly, if the JSP is forwarded to Tomcat, PHP is forwarded to Apache, and then the static content returned to the client browser is returned after receiving the above server parsing. So how does this forwarding function be implemented in Java? If not, do you have any other languages?

Reply content:

Pro, you need a reverse proxy. Java SE does not know, but if it is given to python/nodejs/c++ the principle of implementation is such a few words:

(The following pseudo-code)

Server =Httpservice.Createserver()Server. on ' http request ', (req, res)  Req_ext =req.Require_url.Split /\. [Asp|php|jsp|do]/i  Switch Req_ext     Case ' php ':      Res.Send OS.Execute ' php req.require_url '     Case ' ASP ':      Res.Pip http.require ' IIS server ... '     Case ' Do ', ' JSP ':      Res.Send http.require ' Tomcat server ... '    Default:      Res.Send file.Read '' if file.exist 
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.