Package org.jboss.netty.handler.codec.http

Examples of org.jboss.netty.handler.codec.http.QueryStringDecoder


            for (Map.Entry<String, String> h: request.getHeaders()) {
                buf.append("HEADER: " + h.getKey() + " = " + h.getValue() + "\r\n");
            }
            buf.append("\r\n");

            QueryStringDecoder queryStringDecoder = new QueryStringDecoder(request.getUri());
            Map<String, List<String>> params = queryStringDecoder.getParameters();
            if (!params.isEmpty()) {
                for (Entry<String, List<String>> p: params.entrySet()) {
                    String key = p.getKey();
                    List<String> vals = p.getValue();
                    for (String val : vals) {
View Full Code Here


      {
        if (!readingChunks) {
            request = (HttpRequest) e.getMessage();
            ctx.sendUpstream(e);

            QueryStringDecoder queryStringDecoder = new QueryStringDecoder(request.getUri());
            String queryPath = queryStringDecoder.getPath();
            int slashPos = queryPath.indexOf('/', 1);
            if (slashPos < 0)
            {
              slashPos = queryPath.length();
            }
            String cmdName = queryPath.substring(1, slashPos);
            ServerContainer.RuntimeConfig config = _serverContainer.getContainerRuntimeConfigMgr()
                .getReadOnlyConfig();

            if (LOG.isDebugEnabled())
            {
              LOG.debug("Got command: " + cmdName);
            }


            dbusRequest = new DatabusRequest(cmdName, request.getMethod(), e.getRemoteAddress(),
                                             config);
            if (LOG.isDebugEnabled())
            {
              LOG.debug("Starting processing command [" + dbusRequest.getId() + "] " +
                        dbusRequest.getName() );
            }

            Properties requestProps = dbusRequest.getParams();

            if (slashPos < queryPath.length())
            {
              requestProps.put(DatabusRequest.PATH_PARAM_NAME, queryPath.substring(slashPos + 1));
            }

            for (Map.Entry<String, String> h: request.getHeaders()) {
              handleHttpHeader(h);
            }

            Map<String, List<String>> params = queryStringDecoder.getParameters();
            if (!params.isEmpty())
            {
                for (Entry<String, List<String>> p: params.entrySet())
                {
                    String key = p.getKey();
View Full Code Here

   * Parses the metric stream and passes the results to the metric collector
   * @param request The submitted http request
   * @return The number of metrics successfully extracted and processed.
   */
  protected int processMetric(HttpRequest request) {
    QueryStringDecoder decoder = new QueryStringDecoder(request.getUri());
    Map<String,List<String>> params = decoder.getParameters();
    Map<String, Long> metrics = new HashMap<String, Long>();
   
    for(Map.Entry<String,List<String>> entry: params.entrySet()) {
      try {
        String metricName = entry.getKey();
View Full Code Here

   * @return the requested timeout, or forever if one was not found
   */
  protected long getTimeout(HttpRequest req) {
    long tout = Long.MAX_VALUE;
    // First try the URL param
    QueryStringDecoder qp = new QueryStringDecoder(req.getUri());
    List<String> values = qp.getParameters().get("timeout");
    if(values!=null && values.size()>0) {
      try { tout = Long.parseLong(values.iterator().next().trim()); } catch (Exception e) {}
    }
    // If nothing then try the request header
    String tmp = req.getHeader("timeout");
View Full Code Here

            uri.contains("." + File.separator) ||
            uri.startsWith(".") || uri.endsWith(".")) {
            return null;
        }

        QueryStringDecoder decoder = new QueryStringDecoder(uri);
        uri = decoder.getPath();

        if (uri.endsWith("/")) {
            uri += "index.html";
        }
View Full Code Here

      public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
        throws Exception {
      HttpRequest request = (HttpRequest) e.getMessage();
      HttpResponse response = null;

      QueryStringDecoder queryStringDecoder = new QueryStringDecoder(
          request.getUri());
      buf.setLength(0);
      if (request.getMethod() == HttpMethod.GET) {
        try {
          String requestResult = CountandraUtils
View Full Code Here

        String content = null;
        try {

            content = request.getContent().toString(CharsetUtil.UTF_8);
            if (request.getMethod() == HttpMethod.POST)
                qs = new QueryStringDecoder("/?" + content);
            parameters = qs.getParameters();

        }catch(Exception e){
            logger.debug("post request seems DATA");
            logger.trace("error in parsing request", e);
View Full Code Here

    if (request.getMethod() != GET) {
      sendError(ctx, METHOD_NOT_ALLOWED);
      return;
    }
    final Map<String,List<String>> q =
        new QueryStringDecoder(request.getUri()).getParameters();
    final List<String> mapIds = splitMaps(q.get("map"));
    final List<String> reduceQ = q.get("reduce");
    final List<String> jobQ = q.get("job");
    if (LOG.isDebugEnabled()) {
      LOG.debug("RECV: " + request.getUri() +
View Full Code Here

  @Override
  public FileChunk [] handle(ChannelHandlerContext ctx, HttpRequest request)
      throws IOException {

    final Map<String, List<String>> params =
      new QueryStringDecoder(request.getUri()).getParameters();

    if (!params.containsKey("qid")) {
      throw new FileNotFoundException("No such qid: " + params.containsKey("qid"));
    }
View Full Code Here

  @Override
  public FileChunk [] handle(ChannelHandlerContext ctx, HttpRequest request)
      throws IOException {

    final Map<String, List<String>> params =
      new QueryStringDecoder(request.getUri()).getParameters();

    if (!params.containsKey("qid")) {
      throw new FileNotFoundException("No such qid: " + params.containsKey("qid"));
    }
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.http.QueryStringDecoder

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.