Package sun.net.www

Examples of sun.net.www.MessageHeader


            sock = ss.accept();
            connectionCount++;
            InputStream is = sock.getInputStream();
            OutputStream os = sock.getOutputStream();

            MessageHeader headers =  new MessageHeader (is);
            os.write(replyOK.getBytes("UTF-8"));

            headers =  new MessageHeader (is);
            // If we get here then we received a second request.
            connectionCount++;
            os.write(replyOK.getBytes("UTF-8"));

            sock.close();
View Full Code Here


            HttpTransaction msg;
            boolean res;
            try {
                InputStream is = new BufferedInputStream (new NioInputStream (chan, sslEng, inNetBB, inAppBB));
                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

     * @param key the name of the request header to add
     * @param val the value of the header
     */
    public void addResponseHeader (String key, String val) {
        if (rspheaders == null)
            rspheaders = new MessageHeader ();
        rspheaders.add (key, val);
    }
View Full Code Here

     * @param key the name of the request header to add
     * @param val the value of the header
     */
    public void setResponseHeader (String key, String val) {
        if (rspheaders == null)
            rspheaders = new MessageHeader ();
        rspheaders.set (key, val);
    }
View Full Code Here

     * @param key the name of the request trailer to add
     * @param val the value of the trailer
     */
    public void addResponseTrailer (String key, String val) {
        if (rsptrailers == null)
            rsptrailers = new MessageHeader ();
        rsptrailers.add (key, val);
    }
View Full Code Here

public class HeaderTests {

    static MessageHeader createMessageHeader (String s) {
        ByteArrayInputStream bis = new ByteArrayInputStream (s.getBytes());
        MessageHeader h = new MessageHeader ();
        try {
            h.parseHeader (bis);
        } catch (IOException e) {
            throw new RuntimeException ("IOException parsing header");
        }
        return h;
    }
View Full Code Here

                                   {"xparam3", null},{"xparam4","value=4"}
                                  }
                                 };

    public static void main (String args[]) {
        MessageHeader head = createMessageHeader (s1);
        Iterator iter = head.multiValueIterator ("Foo");
        checkHeader (iter, s1_Foo);
        iter = head.multiValueIterator ("Fub");
        checkHeader (iter, s1_Fub);

        HeaderParser hp = new HeaderParser (s2).subsequence (1,12);
        check (hp, s23_expect);
View Full Code Here

     * @param key the name of the request header to add
     * @param val the value of the header
     */
    public void addResponseHeader (String key, String val) {
        if (rspheaders == null)
            rspheaders = new MessageHeader ();
        rspheaders.add (key, val);
    }
View Full Code Here

     * @param key the name of the request header to add
     * @param val the value of the header
     */
    public void setResponseHeader (String key, String val) {
        if (rspheaders == null)
            rspheaders = new MessageHeader ();
        rspheaders.set (key, val);
    }
View Full Code Here

     * @param key the name of the request trailer to add
     * @param val the value of the trailer
     */
    public void addResponseTrailer (String key, String val) {
        if (rsptrailers == null)
            rsptrailers = new MessageHeader ();
        rsptrailers.add (key, val);
    }
View Full Code Here

TOP

Related Classes of sun.net.www.MessageHeader

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.