SimplestApp.java

/***************************************************************************
   Copyright 2013 Emily Estes

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
***************************************************************************/
package net.metanotion.web.examples;


import net.metanotion.web.servlets.ServerUtil;

/** This is the "simplest" app you could write with this web framework. It starts an
HTTP server listening on port 8080, but it does not give the server a SessionHandler
and thus any HTTP request generates a null pointer exception. The framework will
log the error and return an HTTP Status of 500 (internal server error). */
public final class SimplestApp {
	/** This is the main method, we're going to start up a web server listening
	on a port. Since we're not providing it with any handlers from our app though
	it can actually serve up anything, so we'll just get 500 "server error" for
	every attempt to connect.
		@param args The command line arguments passed to our app.
		@throws Exception If something goes wrong launching the web server.
	*/
	public static void main(String[] args) throws Exception {
		// Start the web server listening on port 8080 with no session handler.
		ServerUtil.launchJettyServer(8080, null);
	}
}