Examples of RequestLine


Examples of org.apache.commons.httpclient.server.RequestLine

        }

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine reqline = request.getRequestLine();
            if (reqline.getUri().equals("/location1/")) {
                response.setStatusLine("HTTP/1.1 302 Object moved");
                response.addHeader(new Header("Location", "http://" + this.host + ":" + this.port + "/location2/"));
            } else if (reqline.getUri().equals("/location2/")) {
                response.setStatusLine("HTTP/1.1 200 OK");
                response.setBodyString("Successful redirect");
            } else {
                response.setStatusLine("HTTP/1.1 404 Not Found");
            }
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            Header challenge = new Header("WWW-Authenticate", "Basic realm=\"test\"");
            RequestLine requestLine = request.getRequestLine();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine("HTTP/1.1 401 Unauthorized");
                response.addHeader(challenge);
                response.setBodyString("Authorization required");
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            Header challenge = new Header("WWW-Authenticate", "Basic realm=\"test2\"");
            RequestLine requestLine = request.getRequestLine();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine("HTTP/1.1 401 Unauthorized");
                response.addHeader(challenge);
                response.setBodyString("Authorization required");
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            Header challenge = new Header("WwW-AuThEnTiCaTe", "bAsIc ReAlM=\"test\"");
            RequestLine requestLine = request.getRequestLine();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine("HTTP/1.1 401 Unauthorized");
                response.addHeader(challenge);
                response.setBodyString("Authorization required");
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

    }

    public boolean process(final SimpleRequest request, final SimpleResponse response)
        throws IOException
    {
        RequestLine requestline = request.getRequestLine();
        HttpVersion httpversion = requestline.getHttpVersion();

        StringWriter buffer = new StringWriter(100);
        buffer.write("Method type: ");
        buffer.write(requestline.getMethod());
        buffer.write("\r\n");
        buffer.write("Requested resource: ");
        buffer.write(requestline.getUri());
        buffer.write("\r\n");
        buffer.write("Protocol version: ");
        buffer.write(httpversion.toString());
        buffer.write("\r\n");
       
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        }

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            HttpVersion ver = requestLine.getHttpVersion();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine(ver, HttpStatus.SC_UNAUTHORIZED);
                response.addHeader(new Header("WWW-Authenticate",
                        "Digest realm=\"realm1\", nonce=\"ABC123\""));
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        }

        public boolean process(final SimpleRequest request, final SimpleResponse response)
            throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            HttpVersion ver = requestLine.getHttpVersion();
            Header auth = request.getFirstHeader("Authorization");
            if (auth == null) {
                response.setStatusLine(ver, HttpStatus.SC_UNAUTHORIZED);
                response.addHeader(new Header("WWW-Authenticate", "NTLM"));
                response.setBodyString("Authorization required");
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

            }

            public boolean process(final SimpleRequest request, final SimpleResponse response)
                throws IOException
            {
                RequestLine reqline = request.getRequestLine();
                HttpVersion ver = reqline.getHttpVersion();
                if (reqline.getUri().equals("/oldlocation/")) {
                    response.setStatusLine(ver, HttpStatus.SC_MOVED_TEMPORARILY);
                    response.addHeader(new Header("Location", "/relativelocation/"));
                } else if (reqline.getUri().equals("/relativelocation/")) {
                    response.setStatusLine(ver, HttpStatus.SC_OK);
                    response.setBodyString("Successful redirect");
                } else {
                    response.setStatusLine(ver, HttpStatus.SC_NOT_FOUND);
                }
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

            }

            public boolean process(final SimpleRequest request, final SimpleResponse response)
                throws IOException
            {
                RequestLine reqline = request.getRequestLine();
                HttpVersion ver = reqline.getHttpVersion();
                if (reqline.getUri().equals("/oldlocation/")) {
                    response.setStatusLine(ver, HttpStatus.SC_MOVED_TEMPORARILY);
                    response.addHeader(new Header("Location", "xxx://bogus"));
                } else if (reqline.getUri().equals("/relativelocation/")) {
                    response.setStatusLine(ver, HttpStatus.SC_OK);
                    response.setBodyString("Successful redirect");
                } else {
                    response.setStatusLine(ver, HttpStatus.SC_NOT_FOUND);
                }
View Full Code Here

Examples of org.apache.commons.httpclient.server.RequestLine

        public boolean processRequest(
            final SimpleHttpServerConnection conn,
            final SimpleRequest request) throws IOException
        {
            RequestLine requestLine = request.getRequestLine();
            ResponseWriter out = conn.getWriter();
            if ("GET".equals(requestLine.getMethod())
                && "/".equals(requestLine.getUri())) {

                requestNo++;

                out.println("HTTP/1.1 200 OK");
                out.println("Content-Type: text/html");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.