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

  • Home
  • SEARCH
  • 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 9008561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:58:09+00:00 2026-06-16T01:58:09+00:00

Is that possible to retrieve the user’s requested URL before the JAAS redirect it?

  • 0

Is that possible to retrieve the user’s requested URL before the JAAS redirect it?

my web.xml is like this:

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.jsf</form-login-page>
        <form-error-page>/login.jsf</form-error-page>
    </form-login-config>
</login-config>

So, when I’m not logged and try to go at ex. www.blah.com/myApp/users.jsf
then the app redirect me to login.jsf but the url still the same that the user requested.

then I fill the login form and click Login, that goes to my backbean where a call my loginModule and callbackHandler ex.:

public String actionLogin(){
   //do my login and stuff
   return "page that user requested";
}

I tried many ways to get the user’s requested page. request.getRequestURL()

all returned me : www.blah.com/myApp/login.jsf

any way to get the requested page? www.blah.com/myApp/users.jsf

regards

  • 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-16T01:58:10+00:00Added an answer on June 16, 2026 at 1:58 am

    The login page is internally opened by a server-side forward by RequestDispatcher#forward(). This thus means that the initially requested page is available as a request attribute with the name as specified in RequestDispatcher.FORWARD_REQUEST_URI constant. In JSF terms, that’s thus available as follows:

    String originalURI = (String) externalContext.getRequestMap().get(RequestDispatcher.FORWARD_REQUEST_URI);
    String originalQuery = (String) externalContext.getRequestMap().get(RequestDispatcher.FORWARD_QUERY_STRING);
    
    if (originalQuery != null) {
        originalURI+= "?" + originalQuery;
    }
    

    (keep in mind to have a fallback URL for the case it returns null, i.e. when it’s been opened directly without hitting a restricted URL first)

    The best place to collect it would be the (post)constructor of a @ViewScoped bean associated with the login page.

    See also:

    • Performing user authentication in Java EE / JSF using j_security_check
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to make JavaScript retrieve a file that is above the web
I would like to know if it's possible to retrieve the .cs file that
Is this possible: i'd like to update one of the 'user stories' within a
Is it possible to retrieve an user id before agreeing to give permissions to
My application sends Facebook notifications to a user. Is that possible to format the
I want to retrieve the text that the user has typed into the currently
My XML file consists of a structure that resembles something like the following: <root>
I am using a vbscript to retrieve local user account details. This script uses
Is it possible to retrieve User information inside a filter in symfony 1.4? I
I want to know if it is possible to retrieve a user's friend's photo

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.