Posts

Showing posts from August, 2019

【Java】How to use Jetty build simple Http Server

Hello guys. I will explain how to use Jetty to build HTTP server in this blog. Welcome to leave comments if you have any trouble about it. Precondition the reader should download Jetty before the start. According to the official document, the reader can download Jetty at the  download page , and access API document Build HTTP Jetty server The first step, create a server instance Server server = new Server ( 8081 ); Create a basic jetty server object that will listen on port 8081. Note that if you set this to port 0 then a randomly available port will be assigned that you can either look in the logs for the port or programmatically obtain it for use in test cases. The second step, need to set Handler which should be wrapped. server . setHandler ( handler ); the handler is an instance of an interface implementation class of org.eclipse.jetty.server.Handler interface. A Handler instance is required by an org.eclipse.jetty.server.Server to handle incoming HTTP r

【Java】How to use Jetty build simple Http Server

Hello guys. I will explain how to use Jetty to build HTTP server in this blog. Welcome to leave comments if you have any trouble about it. Precondition the reader should download Jetty before the start. According to the official document, the reader can download Jetty at the  download page , and access API document Build HTTP Jetty server The first step, create a server instance Server server = new Server ( 8081 ); Create a basic jetty server object that will listen on port 8081. Note that if you set this to port 0 then a randomly available port will be assigned that you can either look in the logs for the port or programmatically obtain it for use in test cases. The second step, need to set Handler which should be wrapped. server . setHandler ( handler ); the handler is an instance of an interface implementation class of org.eclipse.jetty.server.Handler interface. A Handler instance is required by an org.eclipse.jetty.server.Server to handle incoming HTTP r

Popular posts from this blog

【Java】How to use Jetty build simple Http Server