Package org.apache.wicket

Examples of org.apache.wicket.RequestCycle


   *            required protocol
   * @return request target or null
   */
  public static IRequestTarget requireProtocol(Protocol protocol)
  {
    RequestCycle requestCycle = RequestCycle.get();
    WebRequest webRequest = (WebRequest)requestCycle.getRequest();
    HttpServletRequest request = webRequest.getHttpServletRequest();
    if (protocol == null || protocol == Protocol.PRESERVE_CURRENT ||
      request.getScheme().equals(protocol.toString().toLowerCase()))
    {
      return null;
View Full Code Here


   * @see org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy#matches(java.lang.String)
   */
  @Override
  public boolean matches(String path)
  {
    RequestCycle rc = RequestCycle.get();

    // the null check is necessary, as this method is first time called from WicketFilter when
    // no RequestCycle exists yet
    if (rc != null && ((WebRequest)rc.getRequest()).isAjax())
    {
      // HybridUrlCodingStrategy doesn't make sense for ajax request
      return false;
    }

View Full Code Here

   * @param url
   *            The url which describes the component path and the interface to be called.
   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof IListenerInterfaceRequestTarget)
    {
      IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
View Full Code Here

   *            the <code>Class</code> of the <code>Page</code> to be checked
   * @return true if the given <code>pageClass</code> is mounted, false otherwise
   */
  private boolean isPageMounted(Class /* <? extends Page> */pageClass)
  {
    RequestCycle cycle = RequestCycle.get();
    CharSequence path = getRequestCodingStrategy().pathForTarget(
      new BookmarkablePageRequestTarget(pageClass));
    return path != null;
  }
View Full Code Here

   */
  public void testDetachAttachNormalModel() throws Exception
  {
    StringResourceModel model = new StringResourceModel("simple.text", page, wsModel);
    tester.setupRequestAndResponse();
    RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
      tester.getWicketRequest(), tester.getWicketResponse());
    model.getObject();
    Assert.assertNotNull(model.getLocalizer());
    model.detach();
    Assert.assertNull(model.getLocalizer());
View Full Code Here


    };
    StringResourceModel model = new StringResourceModel("simple.text", page, wsDetachModel);
    tester.setupRequestAndResponse();
    RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
      tester.getWicketRequest(), tester.getWicketResponse());
    model.getObject();
    Assert.assertNotNull(model.getLocalizer());
    model.detach();
    // Removed this because getObject() will reattach now...
View Full Code Here

          .getResponseRequestEncoding());

        createRequestContext(request, response);

        // Create request cycle
        final RequestCycle cycle = webApplication.newRequestCycle(request, response);

        try
        {
          // Process request
          cycle.request();

          return cycle.wasHandled();
        }
        catch (AbortException e)
        {
          // noop
        }
View Full Code Here

    assertTrue(group3.getDefaultModelObject() == list);


    // set up necessary objects to emulate a form submission

    RequestCycle cycle = tester.createRequestCycle();

    // this could have been any page it seems. see comment at method
    MockPage page = new MockPage();

    // create component hierarchy
View Full Code Here

    // object used to test regular model
    Model model = new Model();

    // set up necessary objects to emulate a form submission

    RequestCycle cycle = tester.createRequestCycle();

    // this could have been any page it seems. see comment at method
    MockPage page = new MockPage();

    // create component hierarchy
View Full Code Here

   * @param url
   *            The url which describes the component path and the interface to be called.
   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof IListenerInterfaceRequestTarget)
    {
      IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
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.