How do I invoke a servlet before login?

0
I want to access HttpServletRequest & HttpServletResponse. This is a common basic requirement for any web application. Any pointers? Thanks. public class MyServlet extends HttpServlet {     public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
asked
3 answers
0

There was an addition in release 8.9: Core.http().registerHttpRequestInterceptor(...)

https://docs.mendix.com/releasenotes/studio-pro/8.9

I am not sure what your goal is, but maybe that could be a starting point?

answered
0

I’m using v8.8.1.

I created a new class in Eclipse.

public class MyAppInterceptor extends RequestHandler {
protected void processRequest(IMxRuntimeRequest arg0, IMxRuntimeResponse arg1, String arg2) throws Exception {
Core.getLogger("JavaAction").critical("Interceptor invoked......"); 

and in my Java action class..I ran my app. no error...but the control did not go to the above code, why??

  // BEGIN USER CODE
Core.getLogger("JavaAction").critical("Java Action invoked......");
RequestHandler requestHandler = new MyAppInterceptor();

Core.addRequestHandler(“localhost”, requestHandler);

//or I tried below line as well..
MyAppInterceptor myAppInterceptor  = new MyAppInterceptor();

 

answered
0

Hi Sekar, 

Check if what Michiel suggested solution works. 

Otherwise, you can do it like perform the action needed after login immediately and if something fails, you could logout the user with a custom logout java action.

answered