Package org.apache.slide.projector

Examples of org.apache.slide.projector.HttpContext


    private final static String allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      ApplicationManager.getInstance();
      boolean sessionCreated = request.getSession(false) == null;
      Context context = new HttpContext(request, response);
        logger.log(Level.FINE, "Request uri=" + request.getRequestURI());
        logger.log(Level.FINE, "Context path=" + request.getContextPath());
        logger.log(Level.FINE, "Servlet path=" + request.getServletPath());
        URI uri = new URIValue(request.getRequestURI().substring(request.getContextPath().length()+request.getServletPath().length()+1));
        try {
            Result result;
            Processor processor;
            try {
                logger.log(Level.FINE, "Processing started with URI=" + uri);
                Map requestParameters = request.getParameterMap();
                if ( requestParameters.containsKey(Constants.PROCESS_ID_PARAMETER) ) {
                  context.setProcessId(requestParameters.get(Constants.PROCESS_ID_PARAMETER).toString());
                } else {
                    StringBuffer processIdBuffer = new StringBuffer(Constants.PROCESS_ID_LENGTH);
                  for ( int i = 0; i < Constants.PROCESS_ID_LENGTH; i++) {
                      processIdBuffer.append(allowedChars.charAt(random.nextInt(allowedChars.length())));
                  }
                  context.setProcessId(processIdBuffer.toString());
                }
                processor = ProcessorManager.getInstance().getProcessor(uri);
                Scheduler.getInstance();
                Scheduler.setContext(context);
              if ( sessionCreated ) {
                // new session
                    Scheduler.getInstance().launchSessionJobs(context);
              }
                Scheduler.getInstance().launchRequestJobs(context);
                if ( ProcessorManager.getInstance().getProcessorDescriptor(uri).isBookmark() ) {
                    context.setBookmark(uri);
                }
                ParameterDescriptor[] parameterDescriptors = processor.getParameterDescriptors();
                result = ProcessorManager.process(processor, new HashMap(requestParameters), context);
            } catch ( Exception exception ) {
                logger.log(Level.SEVERE, "Exception while processing processor with URI="+uri+"", exception);
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.HttpContext

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.