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 9235305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:59:47+00:00 2026-06-18T06:59:47+00:00

I have created a Controller named InterceptionLogger.java which will contain only the Interception methods.

  • 0

I have created a Controller named InterceptionLogger.java which will contain only the Interception methods. The other Controller namely Application will contain all the action methods and use the Interception using the @With annotation.

This is the Application.java Controller:

@With(InterceptionLogger.class)
public class Application extends Controller {

public static void index() {
    System.out.println("Inside index!!!");
    render();
}

public static void welcome(String txtName){     
    render(txtName);
}

If the InterceptionLogger.java Controller is this:

public class InterceptionLogger extends Controller {   

@Before
static void logBefore(){
    System.out.println("Inside \"logBefore\" method of App Controller");
}

@After
static void logAfter(){
    System.out.println("Inside \"logAfter\" method of App Controller");
}

}

When I run the Application, the Output is:

Inside "logBefore" method of App Controller
Inside index!!!
Inside "logAfter" method of App Controller

Fine, as expected.

But If I change the InterceptionLogger.java to this:

public class InterceptionLogger extends Controller {   

@Before(only="welcome")
static void logBefore(){
    System.out.println("Inside \"logBefore\" method of App Controller");
}

@After(only="index")
static void logAfter(){
    System.out.println("Inside \"logAfter\" method of App Controller");
}

}

Then I am getting this output for index :

Inside index!!!

In this case, why is the statement Inside "logAfter" method of App Controller not getting printed in the console?

How to make it work?

  • 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-18T06:59:49+00:00Added an answer on June 18, 2026 at 6:59 am

    Play! is looking for the intercepted methods in the current controller. You need to supply the full path, if the method is in another controller:

    @Before(only="Application.welcome")
    static void logBefore(){
        System.out.println("Inside \"logBefore\" method of App Controller");
    }
    
    @After(only="Application.index")
    static void logAfter(){
        System.out.println("Inside \"logAfter\" method of App Controller");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a controller class named TAddAlarmController which has a tableview which consists
I have a module in which I created a custom page with controller and
I have a tab bar controller that I have created programmatically, named TPastJourneyTabbar .
I have a created custom table view cell class named CustomCell which inherits from
I'm using ASP.NET MVC 3 (Razor) and have created a Controller named Controllers -
i have a model named 'chapter' (whose only attributes are 'name' and 'course__id') which
I have an object named Camera in my MVC 3 application. I created a
I have created a Entity named MediaItem which is Abstract and Game inherits form
I have created Controller Attribute and would like to read SessionId but get error
I have created a MY_Controller and I'm linking to it through my main controller...

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.