Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1609

add RedirectToExternalException

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.3, 1.4-M1
    • 1.3.4, 1.4-M2
    • wicket
    • None

    Description

      We have exceptions that restart a response and go to a different page, or to an intercept page. But we can't redirect to an external site.

      public class RedirectToExternalException extends AbstractRestartResponseException
      {
      private static final long serialVersionUID = 1L;

      public RedirectToExternalException(String url)
      {
      RequestCycle rc = RequestCycle.get();
      if (rc == null)

      { 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"); }

      // abort any further response processing
      rc.setRequestTarget(new RedirectRequestTarget(url));
      }
      }
      }

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            dashorst Martijn Dashorst
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified