Example usage for org.springframework.web.context.support WebApplicationContextUtils getWebApplicationContext

List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getWebApplicationContext

Introduction

In this page you can find the example usage for org.springframework.web.context.support WebApplicationContextUtils getWebApplicationContext.

Prototype

@Nullable
public static WebApplicationContext getWebApplicationContext(ServletContext sc) 

Source Link

Document

Find the root WebApplicationContext for this web app, typically loaded via org.springframework.web.context.ContextLoaderListener .

Usage

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public UserProfileDTO getUserProfile(String SID) {
    try {/* w  w w .  j  a v  a 2s.c o  m*/

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserProfile(SID);

    } catch (Exception err) {
        log.error("[getUserSelf]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public UserLicenseDTO getUserLicense(String SID) {
    try {//  www.  j  a v  a2s  . c o m

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserLicense(SID);

    } catch (Exception err) {
        log.error("[getUserLicense]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public String getUserPictureURI(String SID) {
    try {//w w w.  j  a  va2s.  co m

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserPictureURI(SID);

    } catch (Exception err) {
        log.error("[getUserPictureURI]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public Long resetUserPwd(String SID, String email, String login, String applink) {
    try {/*from   w  w w  .j a v a2 s.  c o  m*/

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.resetUserPwd(SID, email, login, applink);

    } catch (Exception err) {
        log.error("[resetUserPwd]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public Object getUserByHash(String SID, String hash) {
    try {// w  ww. jav a  2 s .com

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserByHash(SID, hash);

    } catch (Exception err) {
        log.error("[getUserByHash]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public Object resetPassByHash(String SID, String hash, String pass) {
    try {/*from ww w. j av  a  2  s  .c o m*/

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.resetPassByHash(SID, hash, pass);

    } catch (Exception err) {
        log.error("[resetPassByHash]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public UserProfileDTO getUserById(String SID, long user_id) {
    try {//from w  w w  .  j a  va2s  .  c o m

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserById(SID, user_id);

    } catch (Exception err) {
        log.error("[getUserById]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public String refreshSession(String SID) {
    try {//from   ww  w .  ja  va2  s  .  c  om

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.refreshSession(SID);

    } catch (Exception err) {
        log.error("[refreshSession]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public List<Salutations> getUserSalutations(String SID, int language_id) {
    try {//from w w w .j  a  v  a  2  s .co  m

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.getUserSalutations(SID, language_id);

    } catch (Exception err) {
        log.error("[getUserSalutations]", err);
    }
    return null;
}

From source file:org.i4change.app.http.javarpc.UserServiceRPC.java

public List<Users> searchUser(String SID, String searchcriteria, String searchstring, int max, int start,
        String orderby, boolean asc) {
    try {/*  w w w. j a v  a 2s  .co m*/

        ServletContext servletContext = this.servletRequest.getSession().getServletContext();

        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        IUserservice userservice = (IUserservice) context.getBean("userservice.service");

        return userservice.searchUser(SID, searchcriteria, searchstring, max, start, orderby, asc);

    } catch (Exception err) {
        log.error("[searchUser]", err);
    }
    return null;
}