Package sun.net.www

Examples of sun.net.www.MessageHeader$HeaderIterator


            HttpTransaction msg;
            boolean res;
            try {
                InputStream is = new BufferedInputStream (new NioInputStream (chan));
                String requestline = readLine (is);
                MessageHeader mhead = new MessageHeader (is);
                String clen = mhead.findValue ("Content-Length");
                String trferenc = mhead.findValue ("Transfer-Encoding");
                String data = null;
                if (trferenc != null && trferenc.equals ("chunked"))
                    data = new String (readChunkedData (is));
                else if (clen != null)
                    data = new String (readNormalData (is, Integer.parseInt (clen)));
View Full Code Here


        try {
            Socket s = ss.accept();

            /* check the request to find close connection option header */
            InputStream is = s.getInputStream ();
            MessageHeader mh = new MessageHeader(is);
            String connHeader = mh.findValue("Connection");
            if (connHeader != null && connHeader.equalsIgnoreCase("close")) {
                hasCloseHeader = true;
            }

            PrintStream out = new PrintStream(
View Full Code Here

    MessageHeader mh;

    final public void serviceRequest() {
        //totalConnections++;
        try {
            mh = new MessageHeader(clientInput);
            String cmd = mh.findValue(null);
            // if (cmd == null) {
            //  error("Missing command " + mh);
            //  return;
            // }
View Full Code Here

    public void run () {
        try {
            String version = System.getProperty ("java.version");
            String expected = "foo Java/"+version;
            Socket s = server.accept ();
            MessageHeader header = new MessageHeader (s.getInputStream());
            String v = header.findValue ("User-Agent");
            if (!expected.equals (v)) {
                error ("Got unexpected User-Agent: " + v);
            } else {
                success ();
            }
View Full Code Here

     * Processes the CONNECT requests
     */
    private void processRequests() throws Exception {

        InputStream in = clientSocket.getInputStream();
        MessageHeader response = new MessageHeader(in);
        String statusLine = response.getValue(0);

        if (statusLine.startsWith("CONNECT")) {
            // retrieve the host and port info from the response line
            retrieveConnectInfo(statusLine);
            respondForConnect();
View Full Code Here

            throw new IllegalStateException("Already connected");
        if (key == null)
            throw new NullPointerException ("key is null");

        if (requests == null)
            requests = new MessageHeader();

        requests.set(key, value);
    }
View Full Code Here

            throw new IllegalStateException("Already connected");
        if (key == null)
            throw new NullPointerException ("key is null");

        if (requests == null)
            requests = new MessageHeader();

        requests.add(key, value);
    }
View Full Code Here

            HttpTransaction msg;
            boolean res;
            try {
                InputStream is = new BufferedInputStream (new NioInputStream (chan));
                String requestline = readLine (is);
                MessageHeader mhead = new MessageHeader (is);
                String[] req = requestline.split (" ");
                if (req.length < 2) {
                    /* invalid request line */
                    return false;
                }
View Full Code Here

TOP

Related Classes of sun.net.www.MessageHeader$HeaderIterator

Copyright © 2018 www.massapicom. 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.