Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:35:50+00:00 2026-06-10T08:35:50+00:00

I want to make authentication in my web app, when some actions occured on

  • 0

I want to make authentication in my web app, when some actions occured on page. For example user click button “add to cart” and if he not yet authenticated, then signIn page displayed. After signIn it returns back to previos page.
What i can use in wicket to implement this?

P.S. On product page i have also link “buy now”, which navigate to Buy page with @AuthorizeInstantiation(“USER”) annotation. This link work just fine.

I think MetaDataRoleAuthorizationStrategy can be used to make the same on “add to cart”. But available actions is ENABLE and RENDER only. I can add my own Action to component, but how can i associate Action with onClick() method of component?

—Edited—

Don’t know where to write, so i edit the post. I try Christoph Leiter’s solution:

add(link = new AjaxFallbackLink("add2cart") {
 @Override
  public void onClick(AjaxRequestTarget target) {
   if (!CynephoneSession.get().isSignedIn()) {
    throw new RestartResponseAtInterceptPageException(SignIn.class);
   }
   user.addItem(item.copy());
   target.add(cartPanel);
  }
});

but after i clicked this link somehow i see ajax response with updated cartPanel in firefox. I mean it show me page with source code:

<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="cart2" ><![CDATA[<div class="cart" wicket:id="cart" id="cart2">
<span wicket:id="total">11 800</span> <img src="./resource/top.Top/img/rouble-ver-1346040298957.gif"/><br/>
<img src="./resource/top.Top/img/good-ver-1346040298926.gif"/>х<span wicket:id="quantity">2</span>
</div>]]></component></ajax-response>

Don’t understand how it pass the Exception…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:35:51+00:00Added an answer on June 10, 2026 at 8:35 am

    I’m not an expert with the authroles module, so I’m not sure whether it’s possible to add another Action to accomplish what you want. I would just use something like that:

    new AjaxLink<Product>("addToCart", product) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            if (!AbstractAuthenticatedWebSession.get().isSignedIn()) {
                // code to remember product to add to cart in session
                throw new RestartResponseAtInterceptPageException(LoginPage.class);
            }
            // continue normally
        }
    };
    

    In your LoginPage/Session you should check if there’s a product in the session that should be added to the cart when the user is authenticated successfully. Then call continueToOriginalDestination so that Wicket displays the previous page (or setResponsePage(CartPage.class)).

    There may be a better way than to do this “manually”, but this should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im developing asp.net c# web site where i want to make user authentication. without
I want to make user Login Authentication in my web application. I am using
I want make interactive application where user launches it and can do various task
Let's say I want make some of my sources publicly available via my blog
I am new android app developer i want make app for tablets and phone
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I have uploaded a app in production mode to linode. I want make changes
I created a web service that I want to make more secure by using
I'm trying to make a web app in Sinatra, and I was wondering if
I have a SQL Server 2000, C# & ASP.net web app. We want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.