@Override
    public HttpAction restore(final CallContext ctx, final String defaultUrl) {
        val webContext = ctx.webContext();
        val sessionStore = ctx.sessionStore();

        val optRequestedUrl = sessionStore.get(webContext, Pac4jConstants.REQUESTED_URL);
        HttpAction requestedAction = null;
        if (optRequestedUrl.isPresent()) {
            sessionStore.set(webContext, Pac4jConstants.REQUESTED_URL, null);
            val requestedUrl = optRequestedUrl.get();
            if (requestedUrl instanceof String) {
                requestedAction = new FoundAction((String) requestedUrl);
            } else if (requestedUrl instanceof RedirectionAction) {
                requestedAction = (RedirectionAction) requestedUrl;
            }
        }
        if (requestedAction == null) {
            requestedAction = new FoundAction(defaultUrl);
        }

        LOGGER.debug("requestedAction: {}", requestedAction.getMessage());
        if (requestedAction instanceof FoundAction) {
            return HttpActionHelper.buildRedirectUrlAction(webContext, ((FoundAction) requestedAction).getLocation());
        } else {
            return HttpActionHelper.buildFormPostContentAction(webContext, ((OkAction) requestedAction).getContent());
        }
    }
@Test
    public void testRestoreEmptyString() {
        val context = MockWebContext.create();
        val sessionStore = new MockSessionStore();
        sessionStore.set(context, Pac4jConstants.REQUESTED_URL, null);
        val action = handler.restore(new CallContext(context, sessionStore), LOGIN_URL);
        assertTrue(action instanceof FoundAction);
        assertEquals(LOGIN_URL, ((FoundAction) action).getLocation());
        assertFalse(sessionStore.get(context, Pac4jConstants.REQUESTED_URL).isPresent());
    }