1 Reply Latest reply on Jul 30, 2013 11:23 AM by Jonathan Fuerth

    Inject HttpServletRequest inside method body (Errai service implementation)

    xybrek Newbie

      How to inject HttpServletRequest in a Errai service implementation (server side) for use with code like this:



      public void login(String username, String password, boolean rememberMe) {

      try {

      HttpServletRequest request = null;

                  String host = request.getRemoteHost();

                  UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe, host);

                  try {

                      Subject subject = SecurityUtils.getSubject();

                      loginWithNewSession(token, subject);


                  } catch (AuthenticationException e) {

                 throw new IllegalArgumentException("Service could not authenticate caller with the given authorization credentials.");


              } catch (Exception e) {

             throw new IllegalArgumentException("Something went wrong with the login request");