Package org.apache.wicket.util.time

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


     * @see IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
     * @see IResourceSettings#getDefaultCacheDuration()
     */
    public Duration getCacheDuration()
    {
      Duration duration = cacheDuration;
      if (duration == null && Application.exists())
      {
        duration = Application.get().getResourceSettings().getDefaultCacheDuration();
      }

View Full Code Here


      else if (AjaxRequestAttributes.EventPropagation.STOP_IMMEDIATE.equals(attributes.getEventPropagation()))
      {
        attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "stopImmediate");
      }

      Duration requestTimeout = attributes.getRequestTimeout();
      if (requestTimeout != null)
      {
        attributesJson.put(AjaxAttributeName.REQUEST_TIMEOUT.jsonName(),
          requestTimeout.getMilliseconds());
      }

      boolean wicketAjaxResponse = attributes.isWicketAjaxResponse();
      if (wicketAjaxResponse == false)
      {
View Full Code Here

  /**
   * Tests timer behavior in a component added to an AjaxRequestTarget
   */
  public void testAddToAjaxUpdate()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID).setOutputMarkupId(true));

View Full Code Here

  /**
   * tests timer behavior in a WebPage.
   */
  public void testAddToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link(MockPageWithLinkAndComponent.LINK_ID)
View Full Code Here

   */
  public IModificationWatcher getResourceWatcher(boolean start)
  {
    if ((resourceWatcher == null) && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here

   */
  public ModificationWatcher getResourceWatcher(boolean start)
  {
    if (resourceWatcher == null && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            // if it is still not the right thread..
            // This either points to long running code (a report
            // page?) or a deadlock or such
            throw new WicketRuntimeException("After " + timeout + " the Pagemap " +
View Full Code Here

  {
    Response response = attributes.getResponse();

    if (response instanceof WebResponse)
    {
      Duration duration = data.getCacheDuration();
      WebResponse webResponse = (WebResponse)response;
      if (duration.compareTo(Duration.NONE) > 0)
      {
        webResponse.enableCaching(duration, data.getCacheScope());
      }
      else
      {
View Full Code Here

     * @see IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
     * @see IResourceSettings#getDefaultCacheDuration()
     */
    public Duration getCacheDuration()
    {
      Duration duration = cacheDuration;
      if (duration == null && Application.exists())
      {
        duration = Application.get().getResourceSettings().getDefaultCacheDuration();
      }

View Full Code Here

    if (removed == false)
    {
      Value value = (Value)eldest.getValue();
      if (value != null)
      {
        Duration elapsedTime = Time.now().subtract(value.creationTime);
        if (lifetime.lessThanOrEqual(elapsedTime))
        {
          removedValue = value.response;
          removed = true;
        }
View Full Code Here

TOP

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

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.