Examples of RequestCycle


Examples of org.apache.wicket.request.cycle.RequestCycle

   
    if (parameters != null)
    {
      // store the version in the request cycle
      StringValue versionValue = parameters.get(versionParameter);
      RequestCycle requestCycle = RequestCycle.get();
      if (versionValue.isEmpty() == false && requestCycle != null)
      {
        requestCycle.setMetaData(URL_VERSION, versionValue.toString());
      }

      // undecorate
      parameters.remove(versionParameter);
    }
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

      // create filename without version string
      // (required for working resource lookup)
      url.setFileName(extension == null? basename : basename + extension);

      // store the version in the request cycle
      RequestCycle requestCycle = RequestCycle.get();
      if (requestCycle != null)
      {
        int idx = fullname.indexOf(versionPrefix);
        String urlVersion = fullname.substring(idx + versionPrefix.length());
        requestCycle.setMetaData(URL_VERSION, urlVersion);
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

  /**
   * @return The request for this component's active request cycle
   */
  public final Request getRequest()
  {
    RequestCycle requestCycle = getRequestCycle();
    if (requestCycle == null)
    {
      // Happens often with WicketTester when one forgets to call
      // createRequestCycle()
      throw new WicketRuntimeException("No RequestCycle is currently set!");
    }
    return requestCycle.getRequest();
  }
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

   */
  public void renderXmlDecl(final WebPage page, boolean insert)
  {
    if (insert || MarkupType.XML_MIME.equalsIgnoreCase(page.getMarkupType().getMimeType()))
    {
      final RequestCycle cycle = RequestCycle.get();

      if (insert == false)
      {
        WebRequest request = (WebRequest)cycle.getRequest();

        String accept = request.getHeader("Accept");
        insert = ((accept == null) || (accept.indexOf(MarkupType.XML_MIME) != -1));
      }

      if (insert)
      {
        WebResponse response = (WebResponse)cycle.getResponse();
        response.write("<?xml version='1.0'");
        String encoding = getRequestCycleSettings().getResponseRequestEncoding();
        if (Strings.isEmpty(encoding) == false)
        {
          response.write(" encoding='");
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

   * page. Prior to this, the other constructor should already have been called.
   */
  public BrowserInfoPage()
  {
    initComps();
    RequestCycle requestCycle = getRequestCycle();
    WebSession session = (WebSession)getSession();
    WebClientInfo clientInfo = session.getClientInfo();
    if (clientInfo == null)
    {
      clientInfo = new WebClientInfo(requestCycle);
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

  public final RequestCycle createRequestCycle(final Request request, final Response response)
  {
    RequestCycleContext context = new RequestCycleContext(request, response,
      getRootRequestMapper(), getExceptionMapperProvider().get());

    RequestCycle requestCycle = getRequestCycleProvider().get(context);
    requestCycle.getListeners().add(requestCycleListeners);
    requestCycle.getListeners().add(new AbstractRequestCycleListener()
    {
      @Override
      public void onDetach(final RequestCycle requestCycle)
      {
        if (Session.exists())
        {
          Session.get().getPageManager().commitRequest();
        }

        if (Application.exists())
        {
          IRequestLogger requestLogger = Application.get().getRequestLogger();
          if (requestLogger != null)
          {
            requestLogger.requestTime((System.currentTimeMillis() - requestCycle.getStartTime()));
          }
        }
      }
    });
    return requestCycle;
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

  private static class DefaultRequestCycleProvider implements IRequestCycleProvider
  {
    @Override
    public RequestCycle get(final RequestCycleContext context)
    {
      return new RequestCycle(context);
    }
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

  @Override
  public String getVersion(IStaticCacheableResource resource)
  {
    // get current request cycle
    final RequestCycle requestCycle = ThreadContext.getRequestCycle();

    // cache instance
    Map<Serializable, String> cache = null;

    // cache key
    Serializable key = null;

    // is request cycle available?
    if (requestCycle != null)
    {
      // retrieve cache from current request cycle
      cache = requestCycle.getMetaData(CACHE_KEY);

      // create caching key
      key = resource.getCacheKey();

      // does cache exist within current request cycle?
      if (cache == null)
      {
        // no, so create it
        requestCycle.setMetaData(CACHE_KEY, cache = Generics.newHashMap());
      }
      else if (cache.containsKey(key))
      {
        // lookup timestamp from cache (may contain NULL values which are valid)
        return cache.get(key);
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

    }
  }

  private RenderPageRequestHandler createPageRequestHandler(PageProvider pageProvider)
  {
    RequestCycle requestCycle = RequestCycle.get();

    if (requestCycle == null)
    {
      throw new IllegalStateException(
        "there is no current request cycle attached to this thread");
View Full Code Here

Examples of org.apache.wicket.request.cycle.RequestCycle

    return new RenderPageRequestHandler(pageProvider, redirect);
  }

  private boolean isProcessingAjaxRequest()
  {
    RequestCycle rc = RequestCycle.get();
    Request request = rc.getRequest();
    if (request instanceof WebRequest)
    {
      return ((WebRequest)request).isAjax();
    }
    return false;
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.