Package jeeves.server

Examples of jeeves.server.JeevesEngine


        Log.debug(Log.REQUEST, "Session created for client : " + ip);
    }

    ServiceRequest srvReq = null;

    JeevesEngine jeeves = jeevesApplicationContext
        .getBean(JeevesEngine.class);
    try {
      srvReq = ServiceRequestFactory.create(request, response,
          jeeves.getUploadDir(), jeeves.getMaxUploadSize());
    } catch (FileUploadTooBigEx e) {
      StringBuffer sb = new StringBuffer();
      sb.append("File upload too big - exceeds "
          + jeeves.getMaxUploadSize() + " Mb\n");
      sb.append("Error : " + e.getClass().getName() + "\n");
      response.sendError(400, sb.toString());

      // now stick the stack trace on the end and log the whole lot
      sb.append("Stack :\n");
      sb.append(Util.getStackTrace(e));
      Log.error(Log.REQUEST, sb.toString());

    } catch (Exception e) {
      StringBuffer sb = new StringBuffer();

      sb.append("Cannot build ServiceRequest\n");
      sb.append("Cause : " + e.getMessage() + "\n");
      sb.append("Error : " + e.getClass().getName() + "\n");
      response.sendError(400, sb.toString());

      // now stick the stack trace on the end and log the whole lot
      sb.append("Stack :\n");
      sb.append(Util.getStackTrace(e));
      Log.error(Log.REQUEST, sb.toString());
    }

    // --- execute request

    jeeves.dispatch(srvReq, session);
  }
View Full Code Here


    //--- create request

        ConfigurableApplicationContext applicationContext = JeevesDelegatingFilterProxy.getApplicationContextFromServletContext
                (getServletContext());
        JeevesEngine jeeves = applicationContext.getBean(JeevesEngine.class);

    try {
      srvReq = ServiceRequestFactory.create(req, res, jeeves.getUploadDir(), jeeves.getMaxUploadSize());
    } catch (FileUploadTooBigEx e) {
            StringBuilder sb = new StringBuilder();
            sb.append("File upload too big - exceeds ").append(jeeves.getMaxUploadSize()).append(" Mb\n")
                .append("Error : ").append(e.getClass().getName()).append("\n");

            res.sendError(SC_BAD_REQUEST, sb.toString());

            // now stick the stack trace on the end and log the whole lot
      sb.append("Stack :\n").append(Util.getStackTrace(e));

      Log.error(Log.REQUEST,sb.toString());
      return;
    } catch (Exception e) {
      StringBuilder sb = new StringBuilder();

            sb.append("Cannot build ServiceRequest\n").append("Cause : ").append(e.getMessage()).append("\n")
                .append("Error : ").append(e.getClass().getName()).append("\n");

            res.sendError(SC_BAD_REQUEST, sb.toString());

            // now stick the stack trace on the end and log the whole lot
      sb.append("Stack :\n").append(Util.getStackTrace(e));
      Log.error(Log.REQUEST, sb.toString());
      return;
    }

        // Set the language of the request as the preferred language in a cookie
        final Cookie langCookie = new Cookie(Jeeves.LANG_COOKIE, srvReq.getLanguage());
        langCookie.setMaxAge((int) TimeUnit.DAYS.toSeconds(7));
        langCookie.setComment("Keeps the last language chosen to be the preferred language");
        langCookie.setVersion(1);
        langCookie.setPath("/");
        res.addCookie(langCookie);

    //--- execute request

    jeeves.dispatch(srvReq, session);
  }
View Full Code Here

      // Needed to explicitly select Saxon over default Xalan
      System.setProperty("javax.xml.transform.TransformerFactory",
                   "net.sf.saxon.TransformerFactoryImpl");

      // Init jeeves with proper config
      jeeves = new JeevesEngine();
      // null JeevesServlet arg because not running in servlet here
      jeeves.init(appPath, configPath, baseUrl, null);

      // Make session with all permissions
      session = new UserSession();
View Full Code Here

TOP

Related Classes of jeeves.server.JeevesEngine

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.