Redirect to Home tab after logging in

Hi,

This question really comes in two parts.

1.) Overriding StartupHelper - I tried looking into the following link about redirecting to a specific page after login. The code seemed to make sense. However, my biggest question is the manner of implementing the java file. I have Nuxeo IDE installed for Eclipse, and have a nuxeo project defined with some operators in the section (src/main/java). These I have implemented through the Operation wizard on Nuxeo, so I'm guessing it did all the setup I needed. My problem is it seems i need to implement this new java class for login redirection somewhere in my project, but I don't know where. So I decided to create a new java class called LoginRedirect.java and placed it in (src/main/java) where my other java classes are for my operators. This contains the following.

@Name("startupHelper")
@Scope(SESSION)
@Install(precedence = Install.DEPLOYMENT)
public class LoginRedirect extends StartupHelper {
    private static final long serialVersionUID = 1L;
    @Override
    @Begin(id = "#{conversationIdGenerator.nextMainConversationId}", join = true)
    public String initDomainAndFindStartupPage(String domainTitle, String viewId) {
        String view = super.initDomainAndFindStartupPage(domainTitle, viewId);
        PathRef ref = new PathRef("/default-domain/workspaces");
        try {
            if (documentManager.exists(ref)) {
                view =  navigationContext.navigateToRef(ref);
            }
        } catch (ClientException e) {
            // TODO
        }
        return view;
    }
}

To test this out, I wanted to start off just redirecting to the default domains workspaces directory upon login. However, after restarting the server into debug mode, and putting a breakpoint in the code (and setting up the debug profile to listen to the proper port), when I logged in, it didn't catch my breakpoint. So it seems to me that my LoginRedirect file isn't being recognized. Just wanted to make sure where or how this java file should be implemented.

2.) The real objective though is to ultimately redirect to the HOME tab upon login instead of the Workspace tab, assuming the person logging in is the Administrator. I wasn't able to find any specific information or code samples that could help with that, so was wondering if there's something that could give me a start on that.

Thank you so much for your time!

0 votes

0 answers

2174 views

ANSWER