Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.netty.handler.codec.http
Class QueryStringEncoder

    java.lang.Object
      org.jboss.netty.handler.codec.http.QueryStringEncoder

    public class QueryStringEncoder

extends Object

Creates an URL-encoded URI from a path string and key-value parameter pairs. This encoder is for one time use only. Create a new instance for each URI.

     QueryStringEncoder encoder = new QueryStringDecoder("/hello");
     encoder.addParam("recipient", "world");
     assert encoder.toString().equals("/hello?recipient=world");

Version:
  $Rev: 2122 $, $Date: 2010-02-02 11:00:04 +0900 (Tue, 02 Feb 2010) $
Author:
  The Netty Project, Andy Taylor (andy.taylor@jboss.org), Trustin Lee
See Also:
  `QueryStringDecoder`

Constructor Summary
`QueryStringEncoder(String uri)` Creates a new encoder that encodes a URI that starts with the specified path string.
`QueryStringEncoder(String uri, Charset charset)` Creates a new encoder that encodes a URI that starts with the specified path string in the specified charset.
`QueryStringEncoder(String uri, String charset)` Deprecated. Use `QueryStringEncoder(String, Charset)` instead.

Method Summary
`void` | `addParam(String name, String value)` Adds a parameter with the specified name and value to this encoder.
`String` | `toString()` Returns the URL-encoded URI which was created from the path string specified in the constructor and the parameters added by `addParam(String, String)` method.
`URI` | `toUri()` Returns the URL-encoded URI object which was created from the path string specified in the constructor and the parameters added by `addParam(String, String)` method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### QueryStringEncoder

    public QueryStringEncoder(String uri)

  Creates a new encoder that encodes a URI that starts with the specified path string. The encoder will encode the URI in UTF-8.

### QueryStringEncoder

    public QueryStringEncoder(String uri,
                              Charset charset)

  Creates a new encoder that encodes a URI that starts with the specified path string in the specified charset.

### QueryStringEncoder

    @Deprecated
    public QueryStringEncoder(String uri,
                                         String charset)

  Deprecated. Use `QueryStringEncoder(String, Charset)` instead.

Method Detail

### addParam

    public void addParam(String name,
                         String value)

  Adds a parameter with the specified name and value to this encoder.

### toUri

    public URI toUri()
              throws URISyntaxException

  Returns the URL-encoded URI object which was created from the path string specified in the constructor and the parameters added by `addParam(String, String)` method.

  Throws:
    `URISyntaxException`

### toString

    public String toString()

  Returns the URL-encoded URI which was created from the path string specified in the constructor and the parameters added by `addParam(String, String)` method.

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.