Examples of Bucket


Examples of freenet.support.api.Bucket

  }
 
  @Override
  public String getPartAsStringFailsafe(String name, int maxLength) {
    if(freedParts) throw new IllegalStateException("Already freed");
    Bucket part = this.parts.get(name);
    return part == null ? "" : getPartAsLimitedString(part, maxLength);
  }
View Full Code Here

Examples of freenet.support.api.Bucket

   */
  @Override
  @Deprecated
  public byte[] getPartAsBytes(String name, int maxlength) {
    if(freedParts) throw new IllegalStateException("Already freed");
    Bucket part = this.parts.get(name);
    if(part == null) return new byte[0];
   
    if (part.size() > maxlength) return new byte[0];
   
    InputStream is = null;
    DataInputStream dis = null;
    try {
      is = part.getInputStream();
      dis = new DataInputStream(is);
      byte[] buf = new byte[(int)Math.min(part.size(), maxlength)];
      dis.readFully(buf);
      return buf;
    } catch (IOException ioe) {
           Logger.error(this, "Caught IOE:" + ioe.getMessage());
    } finally {
View Full Code Here

Examples of freenet.support.api.Bucket

  }
 
  @Override
  public byte[] getPartAsBytesThrowing(String name, int maxLength) throws NoSuchElementException, SizeLimitExceededException {
    if(freedParts) throw new IllegalStateException("Already freed");
    Bucket part = this.parts.get(name);
   
    if(part == null)
      throw new NoSuchElementException(name);
   
    if(part.size() > maxLength)
      throw new SizeLimitExceededException();
   
    return getPartAsLimitedBytes(part, maxLength);
  }
View Full Code Here

Examples of freenet.support.api.Bucket

  }
 
  @Override
  public byte[] getPartAsBytesFailsafe(String name, int maxLength) {
    if(freedParts) throw new IllegalStateException("Already freed");
    Bucket part = this.parts.get(name);
    return part == null ? new byte[0] : getPartAsLimitedBytes(part, maxLength);
  }
View Full Code Here

Examples of freenet.support.api.Bucket

        /*
         * copy the data into a bucket now,
         * before we go into the redirect loop
         */
       
        Bucket data;

        boolean methodIsConfigurable = true;

        String slen = headers.get("content-length");

        if (METHODS_MUST_HAVE_DATA.contains(method)) {
          // <method> must have data
          methodIsConfigurable = false;
          if (slen == null) {
            ctx.shouldDisconnect = true;
            ctx.sendReplyHeaders(400, "Bad Request", null, null, -1);
            return;
          }
        } else if (METHODS_CANNOT_HAVE_DATA.contains(method)) {
          // <method> can not have data
          methodIsConfigurable = false;
          if (slen != null) {
            ctx.shouldDisconnect = true;
            ctx.sendReplyHeaders(400, "Bad Request", null, null, -1);
            return;
          }
        }

        if (slen != null) {
          long len;
          try {
            len = Integer.parseInt(slen);
            if(len < 0) throw new NumberFormatException("content-length less than 0");
          } catch (NumberFormatException e) {
            ctx.shouldDisconnect = true;
            ctx.sendReplyHeaders(400, "Bad Request", null, null, -1);
            return;
          }
          if(allowPost && ((!container.publicGatewayMode()) || ctx.isAllowedFullAccess())) {
            data = bf.makeBucket(len);
            BucketTools.copyFrom(data, is, len);
          } else {
            FileUtil.skipFully(is, len);
            if (method.equals("POST")) {
              ctx.sendMethodNotAllowed("POST", true);
            } else {
              sendError(sock.getOutputStream(), 403, "Forbidden", "Content not allowed in this configuration", true, null);
            }
            ctx.close();
            return;
          }
        } else {
          // we're not doing to use it, but we have to keep
          // the compiler happy
          data = null;
        }

        if (!container.enableExtendedMethodHandling()) {
          if (!METHODS_RESTRICTED_MODE.contains(method)) {
            sendError(sock.getOutputStream(), 403, "Forbidden", "Method not allowed in this configuration", true, null);
            return;
          }
        }

        // Handle it.
        try {
          boolean redirect = true;
          while (redirect) {
            // don't go around the loop unless set explicitly
            redirect = false;
           
            Toadlet t;
            try {
              t = container.findToadlet(uri);
            } catch (PermanentRedirectException e) {
              Toadlet.writePermanentRedirect(ctx, "Found elsewhere", e.newuri.toASCIIString());
              break;
            }
         
            if(t == null) {
              ctx.sendNoToadletError(ctx.shouldDisconnect);
              break;
            }

            // if the Toadlet does not support the method, we don't need to parse the data
            // also due this pre check a 'NoSuchMethodException' should never appear
            if (!(t.findSupportedMethods().contains(method))) {
              ctx.sendMethodNotAllowed(method, ctx.shouldDisconnect);
              break;
            }

            HTTPRequestImpl req = new HTTPRequestImpl(uri, data, ctx, method);
           
            // require form password if it's a POST, unless the toadlet requests otherwise
            if (method.equals("POST") && !t.allowPOSTWithoutPassword()) {
              if (!ctx.checkFormPassword(req, t.path())) {
                break;
              }
            }
           
            if(ctx.isAllowedFullAccess()) {
              ctx.getPageMaker().parseMode(req, container);
            }
           
            try {
              callToadletMethod(t, method, uri, req, ctx, data, sock, redirect);
            } catch (RedirectException re) {
              uri = re.newuri;
              redirect = true;
            } finally {
              req.freeParts();
            }
          }
          if(ctx.shouldDisconnect) {
            sock.close();
            return;
          }
        } finally {
          if(data != null) data.free();
        }
      }
     
    } catch (ParseException e) {
      try {
View Full Code Here

Examples of net.noderunner.amazon.s3.Bucket

   }

   private void setBucket(String s)
   {
      if (s != null)
         setBucket(new Bucket(s));
   }
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.fill.calculation.BucketDefinition.Bucket

    }

    for (Iterator it = bucketMap.entryIterator(); it.hasNext();)
    {
      Map.Entry entry = (Map.Entry) it.next();
      Bucket bucketValue = (Bucket) entry.getKey();

      boolean totalBucket = bucketValue.isTotal();
      boolean createHeader = !totalBucket || total || totalPosition != CrosstabTotalPositionEnum.NONE;

      if (createHeader)
      {
        CollectedList nextHeaders;
View Full Code Here

Examples of net.sf.jasperreports.crosstabs.fill.calculation.BucketDefinition.Bucket

     
      Iterator it = map.entryIterator();
      Map.Entry entry = it.hasNext() ? (Map.Entry) it.next() : null;
      while(entry != null)
      {
        Bucket key = (Bucket) entry.getKey();
       
        int compare = totalItEntry == null ? -1 : key.compareTo(totalItEntry.key);
        if (compare <= 0)
        {
          Object addVal = null;
         
          if (last)
View Full Code Here

Examples of net.spy.memcached.vbucket.config.Bucket

        HttpRequest request = prepareRequest(cometStreamURI, host);
        channel.write(request);
        try {
            String response = this.handler.getLastResponse();
            logFiner("Getting server list returns this last chunked response:\n" + response);
            Bucket bucketToMonitor = this.configParser.parseBucket(response);
            setBucket(bucketToMonitor);
        } catch (ParseException ex) {
            Logger.getLogger(BucketMonitor.class.getName()).log(Level.WARNING,
                    "Invalid client configuration received from server.  Staying with existing configuration.", ex);
            Logger.getLogger(BucketMonitor.class.getName()).log(Level.FINE,
View Full Code Here

Examples of org.elasticsearch.search.aggregations.bucket.terms.InternalTerms.Bucket

        //replay any deferred collections
        runDeferredCollections(survivingBucketOrds);
       
        //Now build the aggs
        for (int i = 0; i < list.length; i++) {
          Bucket bucket = list[i];
          bucket.aggregations = bucket.docCount == 0 ? bucketEmptyAggregations() : bucketAggregations(bucket.bucketOrd);
          bucket.docCountError = 0;
        }

        return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getShardSize(), bucketCountThresholds.getMinDocCount(), Arrays.asList(list), showTermDocCountError, 0, otherDocCount, getMetaData());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.