Package org.apache.wicket

Examples of org.apache.wicket.RequestCycle


    if (lockedRequest.isAjax() == true)
    {
      return true;
    }

    RequestCycle currentRequestCycle = RequestCycle.get();
    WebRequest currentRequest = (WebRequest)currentRequestCycle.getRequest();

    if (currentRequest.isAjax() == false)
    {
      // if this request is not ajax, we allow it
      return true;
    }

    String lockedPageId = Strings.firstPathComponent(lockedRequest.getRequestParameters()
      .getComponentPath(), Component.PATH_SEPARATOR);
    String currentPageId = Strings.firstPathComponent(currentRequestCycle.getRequest()
      .getRequestParameters()
      .getComponentPath(), Component.PATH_SEPARATOR);

    int lockedVersion = lockedRequest.getRequestParameters().getVersionNumber();
    int currentVersion = currentRequest.getRequestParameters().getVersionNumber();
View Full Code Here


    totalCreatedSessions.incrementAndGet();
  }

  RequestData getCurrentRequest()
  {
    RequestCycle requestCycle = RequestCycle.get();
    RequestData rd = requestCycle.getMetaData(REQUEST_DATA);
    if (rd == null)
    {
      rd = new RequestData();
      requestCycle.setMetaData(REQUEST_DATA, rd);
      active.incrementAndGet();
    }
    return rd;
  }
View Full Code Here

    }

    @Override
    protected void respond(AjaxRequestTarget target)
    {
      RequestCycle requestCycle = RequestCycle.get();
      boolean save = Boolean.valueOf(requestCycle.getRequest().getParameter("save"));

      if (save)
      {
        editor.processInput();
View Full Code Here

    /** Create a new one of these from the current request */
    public UploadResourceState()
    {

      RequestCycle rc = RequestCycle.get();
      HttpServletRequest req = ((WebRequest)rc.getRequest()).getHttpServletRequest();
      UploadInfo info = UploadWebRequest.getUploadInfo(req);

      if (info == null || info.getTotalBytes() < 1)
      {
        status = "0|0|0|0";
View Full Code Here

   * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
   */
  @Override
  protected void respond(AjaxRequestTarget target)
  {
    final RequestCycle requestCycle = RequestCycle.get();
    final String val = requestCycle.getRequest().getParameter("q");
    onRequest(val, requestCycle);
  }
View Full Code Here

   * @return {@link AjaxRequestTarget} instance if current request is an Ajax request,
   *         <code>null</code> otherwise.
   */
  public static AjaxRequestTarget get()
  {
    final RequestCycle requestCycle = RequestCycle.get();
    if (requestCycle != null)
    {
      if (requestCycle.getRequestTarget() instanceof AjaxRequestTarget)
      {
        return (AjaxRequestTarget)requestCycle.getRequestTarget();
      }
    }
    return null;
  }
View Full Code Here

   */
  public AbortWithHttpStatusException(int status, boolean statusCodeOptional)
  {
    this.status = status;

    RequestCycle rc = RequestCycle.get();
    if (rc == null)
    {
      if (!statusCodeOptional)
      {
        throw new IllegalStateException(
          "This exception can only be thrown from within request processing cycle");
      }
    }
    else
    {
      Response r = rc.getResponse();
      if (!(r instanceof WebResponse))
      {
        throw new IllegalStateException(
          "This exception can only be thrown when wicket is processing an http request");
      }

      WebResponse wr = (WebResponse)r;
      wr.getHttpServletResponse().setStatus(status);

      // abort any further response processing
      rc.setRequestTarget(EmptyRequestTarget.getInstance());
    }
  }
View Full Code Here

    if (IResourceListener.INTERFACE.equals(lockedRequest.getRequestParameters().getInterface()))
    {
      return true;
    }

    RequestCycle currentRequestCycle = RequestCycle.get();
    WebRequest currentRequest = (WebRequest)currentRequestCycle.getRequest();

    if (currentRequest.isAjax() == false)
    {
      // if this request is not ajax, we allow it
      return true;
    }

    String lockedPageId = Strings.firstPathComponent(lockedRequest.getRequestParameters()
      .getComponentPath(), Component.PATH_SEPARATOR);
    String currentPageId = Strings.firstPathComponent(currentRequestCycle.getRequest()
      .getRequestParameters()
      .getComponentPath(), Component.PATH_SEPARATOR);

    int lockedVersion = lockedRequest.getRequestParameters().getVersionNumber();
    int currentVersion = currentRequest.getRequestParameters().getVersionNumber();
View Full Code Here

    totalCreatedSessions.incrementAndGet();
  }

  RequestData getCurrentRequest()
  {
    RequestCycle requestCycle = RequestCycle.get();
    RequestData rd = requestCycle.getMetaData(REQUEST_DATA);
    if (rd == null)
    {
      rd = new RequestData();
      requestCycle.setMetaData(REQUEST_DATA, rd);
      active.incrementAndGet();
    }
    return rd;
  }
View Full Code Here

     * Show the resulting valid edit
     */
    @Override
    public final void onSubmit()
    {
      final RequestCycle cycle = getRequestCycle();
      PageParameters parameters = new PageParameters();
      final Book book = getModelObject();
      parameters.put("id", book.getId());
      cycle.setResponsePage(getSession().getPageFactory().newPage(BookDetails.class,
        parameters));
      cycle.setRedirect(true);
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.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.