Package org.apache.wicket.util.lang

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


   *
   * @return the maximum size
   */
  public Bytes getMaxSize()
  {
    Bytes maxSize = this.maxSize;
    if (maxSize == null)
    {
      maxSize = (Bytes)visitChildren(Form.class, new IVisitor<Form<?>>()
      {

        public Object component(Form<?> component)
        {
          Bytes maxSize = component.getMaxSize();
          if (maxSize != null)
          {
            return maxSize;
          }
          return CONTINUE_TRAVERSAL;
View Full Code Here


      private final IModel<Bytes> size = new SessionSizeModel();

      @Override
      public String getObject()
      {
        Bytes sessionSizeInBytes = size.getObject();
        String sessionSizeAsString = sessionSizeInBytes != null
          ? sessionSizeInBytes.toString() : "unknown";

        return "Session: " + sessionSizeAsString;
      }

      @Override
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(resourceStream);
        }
      }

      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()
  {
    IStoreSettings storeSettings = getStoreSettings();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    File fileStoreFolder = storeSettings.getFileStoreFolder();

    return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
  }
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

  @Test
  public void lastModifiedForResourceInJar() throws IOException {
    String anyClassInJarFile = "/java/lang/String.class";
    URL url = getClass().getResource(anyClassInJarFile);
    UrlResourceStream stream = new UrlResourceStream(url);
    Bytes length = stream.length();
    stream.lastModifiedTime();
    assertEquals(stream.length(), length);
    stream.close();
  }
View Full Code Here

   *
   * @return the maximum size
   */
  public Bytes getMaxSize()
  {
    Bytes maxSize = this.maxSize;
    if (maxSize == null)
    {
      maxSize = (Bytes)visitChildren(Form.class, new IVisitor<Form<?>>()
      {

        public Object component(Form<?> component)
        {
          Bytes maxSize = component.getMaxSize();
          if (maxSize != null)
          {
            return maxSize;
          }
          return CONTINUE_TRAVERSAL;
View Full Code Here

      private final IModel<Bytes> size = new SessionSizeModel(Session.get());

      @Override
      public String getObject()
      {
        Bytes sessionSizeInBytes = size.getObject();
        String sessionSizeAsString = sessionSizeInBytes != null
          ? sessionSizeInBytes.toString() : "unknown";

        return "Session: " + sessionSizeAsString;
      }

      @Override
View Full Code Here

          close(resourceStream);
        }
      }

      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

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.