Package org.openqreg.util

Examples of org.openqreg.util.Dispatcher


    } catch (NamingException ne) {
      ne.printStackTrace();
      fail("NamingException thrown on Init : " + ne.getMessage());
    }
   
    dispatcher = new Dispatcher();
  }
View Full Code Here


    LoginAnswer loginAnswer;
    HttpServletResponse res = WebContextFactory.get().getHttpServletResponse();
    Object reply = null;

    // Get the Dispatcher
    Dispatcher disp = Dispatcher.getInstance();
   
    if (disp != null) {
           
      HttpServletRequest req = WebContextFactory.get().getHttpServletRequest();
       
        //User id is always sent as the first parameter
        String userId = (String)params[0];
        // needed to prevent problems when user enters username as 'userid '
      if (null != userId) {
        userId = userId.trim();
      }
        loginAnswer = disp.isActiveForAjaxInterfaceUpdates(userId, req);
       
      // If the user is active & has needed service
      if (LoginAnswer.ACTIVE.equals(loginAnswer.getStatus())) {
        //Execute the method
            reply = chain.doFilter(obj, method, params);       
View Full Code Here

      logger.log(Level.FATAL, "Unable to load dispatcher class", cnfe);
      throw new ServletException(cnfe);
    }
    ServletContext application = config.getServletContext();
    synchronized (application) {
      Dispatcher disp = (Dispatcher) application.getAttribute("disp");
      if (disp == null) {
        logger.log(Level.INFO, "Initializing dispatcher");

        try {
          Method getInstance = dispatcherClass.getMethod("getInstance", (Class[]) null);
View Full Code Here

   *      Takes both GET and POST
   */
  @Override
  public void service(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    Dispatcher disp = null;

    LoginAnswer loginAnswer = null;

    User user = null;

    String langId = null;

    FetchData fetch = null;
    // checks that we are active and so on....

    // Try to get the Dispatcher from the application scope
    disp = Dispatcher.getInstance();
    if (disp != null) {

      // loginAnswer = disp.isActiveForInterfaceUpdates(req);
      loginAnswer = disp.isActive(req);

      // Get the user from the application scope
      user = disp.getUser(loginAnswer.getUserId());
      // Get the fetch from the application scope
      fetch = loginAnswer.getFetch();

      // If active & has needed service
      if ("active".equals(loginAnswer.getStatus())
          && (null == requiredService() || disp.checkAccess(
              loginAnswer.getUserId(), requiredService()))) {

        // Get the langId from the application scope
        langId = user.getLanguageid();
        // must be implemented in subclass, does the magic... :)
View Full Code Here

      throws IOException {

    //checks that we are active and so on....
    ServletContext applicationScope = getServletContext();
    //Get dispatcher from Servlet context (application scope)
    Dispatcher disp = (Dispatcher) applicationScope.getAttribute("disp");
   
    if (disp != null) {

      LoginAnswer loginAnswer = disp.isActive(req);

      String service = req.getParameter("service");
      String xmlDocName = req.getParameter("xmlDocNameInDb");
      ImportType type = ImportType.valueOf(req.getParameter("importtype"));
     
      //If user is properly logged in etc
      if (loginAnswer.getStatus().equals(LoginAnswer.ACTIVE)
          && !loginAnswer.getStatus().equals(LoginAnswer.DEACTIVATED)
          && !loginAnswer.getStatus().equals(LoginAnswer.SYSTEM_IS_DOWN) &&
          disp.checkAccess(loginAnswer.getUserId(), service) && xmlDocName != null) {
       
        InputStream is = null;
       
        try {
          XmlCreator creator;
View Full Code Here

TOP

Related Classes of org.openqreg.util.Dispatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.