Java Code Examples for org.jboss.netty.handler.codec.http.QueryStringDecoder

The following examples show how to use org.jboss.netty.handler.codec.http.QueryStringDecoder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: incubator-tajo   Source File:    License: Apache License 2.0 5 votes vote down vote up
public void testCreateHashFetchURL() throws Exception {
  QueryId q1 = TestTajoIds.createQueryId(1315890136000l, 2);
  String hostName = "tajo1";
  int port = 1234;
  ExecutionBlockId sid = new ExecutionBlockId(q1, 2);
  int partitionId = 2;

  List<QueryUnit.IntermediateEntry> intermediateEntries = TUtil.newList();
  for (int i = 0; i < 1000; i++) {
    intermediateEntries.add(new QueryUnit.IntermediateEntry(i, 0, partitionId, hostName, port));

  Collection<URI> uris = Repartitioner.
      createHashFetchURL(hostName + ":" + port, sid, partitionId,
              TajoWorkerProtocol.ShuffleType.HASH_SHUFFLE, intermediateEntries);

  List<String> taList = TUtil.newList();
  for (URI uri : uris) {
    final Map<String, List<String>> params =
        new QueryStringDecoder(uri).getParameters();

  int checkTaskId = 0;
  for (String ta : taList) {
    assertEquals(checkTaskId++, Integer.parseInt(ta.split("_")[0]));
Example 2
Source Project: ob1k   Source File:    License: Apache License 2.0 5 votes vote down vote up
public ComposableFuture<Map<String, String>> handle(final HttpRequest request) {
  final QueryStringDecoder queryStringDecoder = new QueryStringDecoder(request.getUri());
  final Map<String,List<String>> params = queryStringDecoder.getParameters();
  final Map<String, String> res = new HashMap<>();
  for (final String key: params.keySet()) {
    res.put(key, params.get(key).get(0));

  return ComposableFutures.fromValue(res);