Package org.apache.wicket.util.time

Examples of org.apache.wicket.util.time.Time


    if (response instanceof WebResponse)
    {
      WebResponse webResponse = (WebResponse)response;

      // 1. Last Modified
      Time lastModified = data.getLastModified();
      if (lastModified != null)
      {
        webResponse.setLastModifiedTime(lastModified);
      }
View Full Code Here


     *         <code>false</code> otherwise.
     */
    public boolean dataNeedsToBeWritten(Attributes attributes)
    {
      WebRequest request = (WebRequest)attributes.getRequest();
      Time ifModifiedSince = request.getIfModifiedSinceHeader();

      if (cacheDuration != Duration.NONE && ifModifiedSince != null && lastModified != null)
      {
        // [Last-Modified] headers have a maximum precision of one second
        // so we have to truncate the milliseconds part for a proper compare.
        // that's stupid, since changes within one second will not be reliably
        // detected by the client ... any hint or clarification to improve this
        // situation will be appreciated...
        Time roundedLastModified = Time.millis(lastModified.getMilliseconds() / 1000 * 1000);

        return ifModifiedSince.before(roundedLastModified);
      }
      else
      {
View Full Code Here

            "Unable to find resource");

        resourceResponse.setContentType(findContentType(resources));

        // add Last-Modified header (to support HEAD requests and If-Modified-Since)
        final Time lastModified = findLastModified(resources);

        if (lastModified != null)
          resourceResponse.setLastModified(lastModified);

        // read resource data
View Full Code Here

    return null;
  }

  private Time findLastModified(List<IResourceStream> resources)
  {
    Time ret = null;
    for (IResourceStream curStream : resources)
    {
      Time curLastModified = curStream.lastModifiedTime();
      if (ret == null || curLastModified.after(ret))
        ret = curLastModified;
    }
    return ret;
  }
View Full Code Here

    {
      return null;
    }

    final String contentType = findContentType(resources);
    final Time lastModified = findLastModified(resources);
    final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    final long length = bytes.length;
    AbstractResourceStream ret = new AbstractResourceStream()
    {
      private static final long serialVersionUID = 1L;
View Full Code Here

  @Test
  public void testBlocking() throws Exception
  {
    final PageAccessSynchronizer sync = new PageAccessSynchronizer(Duration.seconds(5));
    final Duration hold = Duration.seconds(1);
    final Time t1locks[] = new Time[1];
    final Time t2locks[] = new Time[1];

    class T1 extends Thread
    {
      @Override
      public void run()
View Full Code Here

    {
      @Override
      public void run()
      {
        Random random = new Random();
        Time start = Time.now();

        while (start.elapsedSince().lessThan(duration) && error[0] == null)
        {
          logger.info("{} elapsed: {}, duration: {}", new Object[] {
              Thread.currentThread().getName(), start.elapsedSince(), duration });
          int page1 = random.nextInt(counts.length);
          int page2 = random.nextInt(counts.length);
          int count = 0;
          while (page2 == page1 && count < 100)
          {
View Full Code Here

    {
      @Override
      public void run()
      {
        Random random = new Random();
        Time start = Time.now();

        while (start.elapsedSince().lessThan(duration) && error[0] == null)
        {
          logger.info("{} elapsed: {}, duration: {}", new Object[] {
              Thread.currentThread().getName(), start.elapsedSince(), duration });
          int page1 = random.nextInt(counts.length);
          int page2 = random.nextInt(counts.length);
          int count = 0;
          while (page2 == page1 && count < 100)
          {
View Full Code Here

    if (response instanceof WebResponse)
    {
      WebResponse webResponse = (WebResponse)response;

      // 1. Last Modified
      Time lastModified = data.getLastModified();
      if (lastModified != null)
      {
        webResponse.setLastModifiedTime(lastModified);
      }
View Full Code Here

     *         <code>false</code> otherwise.
     */
    public boolean dataNeedsToBeWritten(Attributes attributes)
    {
      WebRequest request = (WebRequest)attributes.getRequest();
      Time ifModifiedSince = request.getIfModifiedSinceHeader();

      if (cacheDuration != Duration.NONE && ifModifiedSince != null && lastModified != null)
      {
        // [Last-Modified] headers have a maximum precision of one second
        // so we have to truncate the milliseconds part for a proper compare.
        // that's stupid, since changes within one second will not be reliably
        // detected by the client ... any hint or clarification to improve this
        // situation will be appreciated...
        Time roundedLastModified = Time.millis(lastModified.getMilliseconds() / 1000 * 1000);

        return ifModifiedSince.before(roundedLastModified);
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.time.Time

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.