com.palominolabs.http.server.UnhandledRequestServlet Maven / Gradle / Ivy
/*
* Copyright (c) 2012 Palomino Labs, Inc.
*/
package com.palominolabs.http.server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.concurrent.Immutable;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Jetty wants at least one servlet always, so we'll give it a very simple one...
*/
@Immutable
final class UnhandledRequestServlet extends HttpServlet {
private static final Logger logger = LoggerFactory.getLogger(UnhandledRequestServlet.class);
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
logger.warn("Handled request: " + req.getPathInfo());
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
resp.setContentType("text/plain");
resp.setContentType("UTF-8");
resp.getWriter().append("404");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy