Package org.apache.wicket.util.lang

Examples of org.apache.wicket.util.lang.Bytes


          close();
        }
      }

      data.setContentDisposition(contentDisposition);
      Bytes length = resourceStream.length();
      if (length != null)
      {
        data.setContentLength(length.bytes());
      }
      data.setFileName(fileName);

      String contentType = resourceStream.getContentType();
      if (contentType == null && fileName != null && Application.exists())
View Full Code Here


  }

  protected IDataStore newDataStore()
  {
    StoreSettings storeSettings = getStoreSettings();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    File fileStoreFolder = storeSettings.getFileStoreFolder();

    return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
  }
View Full Code Here

      @Override
      public String getObject()
      {
        Page enclosingPage = getPage();
        long pageSize = WicketObjects.sizeof(enclosingPage);
        Bytes pageSizeInBytes = (pageSize > -1 ? Bytes.bytes(pageSize) : null);
        String pageSizeAsString = pageSizeInBytes != null ? pageSizeInBytes.toString()
          : "unknown";

        return "Page: " + pageSizeAsString;
      }
    };
View Full Code Here

          close();
        }
      }

      data.setContentDisposition(contentDisposition);
      Bytes length = stream.length();
      if (length != null)
      {
        data.setContentLength(length.bytes());
      }
      data.setFileName(fileName);

      String contentType = stream.getContentType();
      if (contentType == null && fileName != null && Application.exists())
View Full Code Here

          close();
        }
      }

      data.setContentDisposition(contentDisposition);
      Bytes length = stream.length();
      if (length != null)
      {
        data.setContentLength(length.bytes());
      }
      data.setFileName(fileName);
      data.setContentType(stream.getContentType());
      data.setTextEncoding(textEncoding);
View Full Code Here

  }

  @Override
  public Bytes getObject()
  {
    Bytes result = null;
    if (Session.exists())
    {
      long sizeOfSession = WicketObjects.sizeof(Session.get());
      if (sizeOfSession > -1)
      {
View Full Code Here

  @Override
  protected IDataStore newDataStore()
  {
    StoreSettings storeSettings = application.getStoreSettings();
    File fileStoreFolder = storeSettings.getFileStoreFolder();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    dataStore = new DebugDiskDataStore(application.getName(), fileStoreFolder,
      maxSizePerSession);
    return dataStore;
  }
View Full Code Here

   *
   * @return the maximum size
   */
  public Bytes getMaxSize()
  {
    Bytes maxSize = this.maxSize;
    if (maxSize == null)
    {
      maxSize = visitChildren(Form.class, new IVisitor<Form<?>, Bytes>()
      {
        public void component(Form<?> component, IVisit<Bytes> visit)
        {
          Bytes maxSize = component.getMaxSize();
          if (maxSize != null)
          {
            visit.stop(maxSize);
          }
        }
View Full Code Here

    info.add( new Label( "memory", new AbstractReadOnlyModel<CharSequence>() {
      @Override
      public CharSequence getObject() {
        Runtime runtime = Runtime.getRuntime();
        Bytes total = Bytes.bytes( runtime.totalMemory() );
        Bytes free = Bytes.bytes( runtime.freeMemory() );
        Bytes max = Bytes.bytes( runtime.maxMemory() );
        Bytes used = Bytes.bytes( total.bytes()-free.bytes() );
        int per = (int)((used.bytes()/(float)max.bytes())*100.0f);
       
        return used + "("+total+")/" +max + " (%"+per+")";
      }
    }));
    add( info );
View Full Code Here

          close();
        }
      }

      data.setContentDisposition(contentDisposition);
      Bytes length = stream.length();
      if (length != null)
      {
        data.setContentLength(length.bytes());
      }
      data.setFileName(fileName);
      data.setContentType(stream.getContentType());
      data.setTextEncoding(textEncoding);
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.lang.Bytes

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.