Package org.apache.wicket.request.cycle

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


  }

  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


   * @return the page being rendered when the exception was thrown, or {@code null} if it cannot
   *         be extracted
   */
  private Page extractCurrentPage()
  {
    final RequestCycle requestCycle = RequestCycle.get();

    IRequestHandler handler = requestCycle.getActiveRequestHandler();

    if (handler == null)
    {
      handler = requestCycle.getRequestHandlerScheduledAfterCurrent();
    }

    if (handler instanceof IPageRequestHandler)
    {
      IPageRequestHandler pageRequestHandler = (IPageRequestHandler)handler;
View Full Code Here

        WebRequest webRequest = application.createWebRequest(httpServletRequest, filterPath);
        WebResponse webResponse = application.createWebResponse(webRequest,
          httpServletResponse);

        RequestCycle requestCycle = application.createRequestCycle(webRequest, webResponse);
        if (!requestCycle.processRequestAndDetach())
        {
          if (chain != null)
          {
            chain.doFilter(request, response);
          }
View Full Code Here

  @Override
  public WebClientInfo getClientInfo()
  {
    if (clientInfo == null)
    {
      RequestCycle requestCycle = RequestCycle.get();

      if (getApplication().getRequestCycleSettings().getGatherExtendedBrowserInfo())
      {
        if (getMetaData(BROWSER_WAS_POLLED_KEY) == null)
        {
View Full Code Here

   */
  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

   * @see org.apache.wicket.core.request.handler.IPageRequestHandler#respond(org.apache.wicket.request.IRequestCycle)
   */
  @Override
  public final void respond(final IRequestCycle requestCycle)
  {
    final RequestCycle rc = (RequestCycle)requestCycle;
    final WebResponse response = (WebResponse)requestCycle.getResponse();

    if (responseObject.containsPage())
    {
      // the page itself has been added to the request target, we simply issue a redirect
      // back to the page
      IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
      final String url = rc.urlFor(handler).toString();
      response.sendRedirect(url);
      return;
    }

    respondersFrozen = true;

    for (ITargetRespondListener listener : respondListeners)
    {
      listener.onTargetRespond(this);
    }

    final Application app = page.getApplication();

    page.send(app, Broadcast.BREADTH, this);

    // Determine encoding
    final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

    // Set content type based on markup type for page
    responseObject.setContentType(response, encoding);

    // Make sure it is not cached by a client
    response.disableCaching();

    try
    {
      final StringResponse bodyResponse = new StringResponse();
      responseObject.writeTo(bodyResponse, encoding);
      CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
      response.write(filteredResponse);
    }
    finally
    {
      // restore the original response
      rc.setResponse(response);
    }
  }
View Full Code Here

      } catch (IOException iox)
      {
        throw new WicketRuntimeException(iox);
      }

      RequestCycle cycle = RequestCycle.get();
      Attributes attributes;
      if (cycle != null)
      {
        attributes = new Attributes(cycle.getRequest(), cycle.getResponse());
      }
      else
      {
        // use empty request and response in case of non-http thread. WICKET-5532
        attributes = new Attributes(new MockWebRequest(Url.parse("")), new StringResponse());
View Full Code Here

   
    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

      // 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

  /**
   * @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

TOP

Related Classes of org.apache.wicket.request.cycle.RequestCycle

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.