public boolean process(SimpleRequest request, SimpleResponse response) throws IOException { if (request.getRequestLine().getMethod().equalsIgnoreCase("CONNECT")) { response.setStatusLine( request.getRequestLine().getHttpVersion(), HttpStatus.SC_METHOD_NOT_ALLOWED); response.setHeader(new Header("Connection", "close")); return true; } else { return super.process(request, response); } }
public boolean process(final SimpleRequest request, final SimpleResponse response) throws IOException { HttpVersion httpversion = request.getRequestLine().getHttpVersion(); response.setStatusLine(httpversion, HttpStatus.SC_OK); response.addHeader(new Header("Content-Type", "text/plain")); URI uri = new URI(request.getRequestLine().getUri(), true); StringBuffer buffer = new StringBuffer(); buffer.append("QueryString=\""); buffer.append(uri.getQuery()); buffer.append("\"\r\n"); response.setBodyString(buffer.toString()); return true; }