Package org.apache.commons.httpclient.util

Examples of org.apache.commons.httpclient.util.ParameterFormatter


     * @since 3.0
     */
    public DigestScheme() {
        super();
        this.complete = false;
        this.formatter = new ParameterFormatter();
    }
View Full Code Here


    /**
     * Default constructor
     * */
    public RFC2965Spec() {
        super();
        this.formatter = new ParameterFormatter();
        this.formatter.setAlwaysUseQuotes(true);
        this.attribHandlerMap = new HashMap(10);       
        this.attribHandlerList = new ArrayList(10);
        this.rfc2109 = new RFC2109Spec();
       
View Full Code Here

    public int getVersion() {
        return 1;
    }

    public Header getVersionHeader() {
        ParameterFormatter formatter = new ParameterFormatter();
        StringBuffer buffer = new StringBuffer();
        formatter.format(buffer, new NameValuePair("$Version",
                Integer.toString(getVersion())));
        return new Header("Cookie2", buffer.toString(), true);
    }
View Full Code Here

    public static String SET_COOKIE_KEY = "set-cookie";

    /** Default constructor */
    public RFC2109Spec() {
        super();
        this.formatter = new ParameterFormatter();
        this.formatter.setAlwaysUseQuotes(true);
    }
View Full Code Here

    public static Test suite() {
        return new TestSuite(TestParameterFormatter.class);
    }

    public void testBasicValueFormatting() throws Exception {
        ParameterFormatter formatter = new ParameterFormatter();
       
        NameValuePair param1 = new NameValuePair("param", "regular_stuff");
        NameValuePair param2 = new NameValuePair("param", "this\\that");
        NameValuePair param3 = new NameValuePair("param", "this,that");
        NameValuePair param4 = new NameValuePair("param", "quote marks (\") must be escaped");
        NameValuePair param5 = new NameValuePair("param", "back slash (\\) must be escaped too");
        NameValuePair param6 = new NameValuePair("param", "values with\tblanks must always be quoted");
       
        formatter.setAlwaysUseQuotes(false);
        assertEquals("param=regular_stuff", formatter.format(param1));
        assertEquals("param=\"this\\\\that\"", formatter.format(param2));
        assertEquals("param=\"this,that\"", formatter.format(param3));
        assertEquals("param=\"quote marks (\\\") must be escaped\"", formatter.format(param4));
        assertEquals("param=\"back slash (\\\\) must be escaped too\"", formatter.format(param5));
        assertEquals("param=\"values with\tblanks must always be quoted\"", formatter.format(param6));

        formatter.setAlwaysUseQuotes(true);
        assertEquals("param=\"regular_stuff\"", formatter.format(param1));
        assertEquals("param=\"this\\\\that\"", formatter.format(param2));
        assertEquals("param=\"this,that\"", formatter.format(param3));
        assertEquals("param=\"quote marks (\\\") must be escaped\"", formatter.format(param4));
        assertEquals("param=\"back slash (\\\\) must be escaped too\"", formatter.format(param5));
        assertEquals("param=\"values with\tblanks must always be quoted\"", formatter.format(param6));
    }
View Full Code Here

    public final static String SET_COOKIE_KEY = "set-cookie";

    /** Default constructor */
    public RFC2109Spec() {
        super();
        this.formatter = new ParameterFormatter();
        this.formatter.setAlwaysUseQuotes(true);
    }
View Full Code Here

     * @since 3.0
     */
    public DigestScheme() {
        super();
        this.complete = false;
        this.formatter = new ParameterFormatter();
    }
View Full Code Here

    /**
     * Default constructor
     * */
    public RFC2965Spec() {
        super();
        this.formatter = new ParameterFormatter();
        this.formatter.setAlwaysUseQuotes(true);
        this.attribHandlerMap = new HashMap(10);       
        this.attribHandlerList = new ArrayList(10);
        this.rfc2109 = new RFC2109Spec();
       
View Full Code Here

    public int getVersion() {
        return 1;
    }

    public Header getVersionHeader() {
        ParameterFormatter formatter = new ParameterFormatter();
        StringBuffer buffer = new StringBuffer();
        formatter.format(buffer, new NameValuePair("$Version",
                Integer.toString(getVersion())));
        return new Header("Cookie2", buffer.toString(), true);
    }
View Full Code Here

     * @since 3.0
     */
    public DigestScheme() {
        super();
        this.complete = false;
        this.formatter = new ParameterFormatter();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.util.ParameterFormatter

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.