Examples of RequestCycle


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

      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
    Response oldResponse = requestCycle.setResponse(encodingHeaderResponse);

    try {
      encodingHeaderResponse.reset();

      // render the head of component and all it's children

      component.renderHead(header);

      if (component instanceof MarkupContainer)
      {
        ((MarkupContainer)component).visitChildren(new IVisitor<Component, Void>()
        {
          @Override
          public void component(final Component component, final IVisit<Void> visit)
          {
            if (component.isVisibleInHierarchy())
            {
              component.renderHead(header);
            }
            else
            {
              visit.dontGoDeeper();
            }
          }
        });
      }
    } finally {
      // revert to old response
      requestCycle.setResponse(oldResponse);
    }

    writeHeaderContribution(response);

    headerRendering = false;
View Full Code Here

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

  }

  @Override
  public void onResourceRequested()
  {
    RequestCycle requestCycle = RequestCycle.get();
    ServletWebRequest request = (ServletWebRequest)requestCycle.getRequest();

    // Grab a Meteor
    Meteor meteor = Meteor.build(request.getContainerRequest());
    String uuid = getUUID(meteor.getAtmosphereResource());
    component.getPage().setMetaData(ATMOSPHERE_UUID, uuid);
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

  }

  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

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

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

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

        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

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

  @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

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

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

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

      } 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
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.