Package javax.servlet

Examples of javax.servlet.RequestDispatcher


//        cal.set(Calendar.MILLISECOND, 0);
//        Date lastModified = cal.getTime();
//        response.setDateHeader("Last-Modified", lastModified.getTime());
        response.setContentType(mimeType);

        RequestDispatcher rd = request.getSession().getServletContext()
            .getRequestDispatcher(resourceUrl);
        rd.forward(request, response);
//      }
      return true;
    }
    return false;
  }
View Full Code Here


                if (context.getContext(decorator.getURIPath()) != null) {
                    context = context.getContext(decorator.getURIPath());
                }
            }
            // get the dispatcher for the decorator
            RequestDispatcher dispatcher = context.getRequestDispatcher(decorator.getPage());
            // create a wrapper around the response
            dispatcher.include(request, response);

            // set the headers specified as decorator init params
            while (decorator.getInitParameterNames().hasNext()) {
                String initParam = (String) decorator.getInitParameterNames().next();
                if (initParam.startsWith("header.")) {
View Full Code Here

        request.setAttribute(ROOTPATH_FILENAME, rootpath);

        try {
            if (rp.isDirectory()) {
                RequestDispatcher rd = request.getRequestDispatcher("/DirectoryList");
                rd.forward(request, response);
                return;
            } else if (filename.endsWith("x") || filename.endsWith("x.")) {
                response.setContentType("text/html");
                out.println(HTML_DOCTYPE + "<HTML><HEAD><TITLE>" + filename
                        + "</TITLE></HEAD>\r\n<BODY>\r\n<H1>Table " + filename
                        + "</H1>\r\n");
                out.println(getStylesheetHTML(request));
                out.println("Skipping VLI format - this format is simply an index to find rows in a corresponding table file, it isn't very interesting to look at so its getting skipped.");
            } else if (filename.endsWith("ti")) {
                RequestDispatcher rd = request.getRequestDispatcher("/Thematic");
                rd.forward(request, response);
            } else if (filename.endsWith("si") || filename.endsWith("si.")) {
                RequestDispatcher rd = request.getRequestDispatcher("/SpatialIndex");
                rd.forward(request, response);
            } else if (filename.endsWith(".doc")) {
                RequestDispatcher rd = request.getRequestDispatcher("/DocFile");
                rd.forward(request, response);
            } else {
                response.setContentType("text/html");
                out.println(HTML_DOCTYPE + "<HTML>\n<HEAD><TITLE>" + filename
                        + "</TITLE></HEAD>\r\n<BODY>\r\n<H1>Table " + filename
                        + "</H1>\r\n");
                out.println(getStylesheetHTML(request));
                DcwRecordFile foo = new DcwRecordFile(rootpath);
                request.setAttribute(RECORD_FILE_OBJ, foo);
                RequestDispatcher rd = request.getRequestDispatcher("/Schema");
                rd.include(request, response);
                RequestDispatcher rd2 = request.getRequestDispatcher("/Data");
                rd2.include(request, response);

                foo.close();
            }
        } catch (FormatException f) {
            throw new ServletException("Format Error: ", f);
View Full Code Here

        } catch (FormatException fe) {
            response.sendError(HttpServletResponse.SC_NOT_FOUND, fe.toString());
        }
        String pi = request.getPathInfo();
        int lin = pi.lastIndexOf('/') + 1;
        RequestDispatcher rd = request.getRequestDispatcher("/UnknownType"
                + pi.substring(0, lin) + ti.getTableIndexed());
        rd.forward(request, response);
    }
View Full Code Here

                    FieldTypeSchema,
                    FieldLengthSchema,
                    false);
        } catch (FormatException fe) {
            out.println("The documentation file appears to be invalid.");
            RequestDispatcher rd = request.getRequestDispatcher("/Schema");
            rd.include(request, response);
            out.println("</BODY></HTML>");
            docfile.close();
            return;
        }
View Full Code Here

        httpResp.sendRedirect(authReq.getDestinationUrl(true));
        return null;
      } else {
        // Option 2: HTML FORM Redirection (Allows payloads >2048 bytes)

        RequestDispatcher dispatcher = getServletContext()
            .getRequestDispatcher("/formredirection.jsp");
        httpReq.setAttribute("prameterMap", httpReq.getParameterMap());
        httpReq.setAttribute("message", authReq);
        // httpReq.setAttribute("destinationUrl", httpResp
        // .getDestinationUrl(false));
        dispatcher.forward(httpReq, httpResp);
      }
    } catch (OpenIDException e) {
      // present error to the user
      throw new ServletException(e);
    }
View Full Code Here

    }
   
    public void forward(String path) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) super.getVariable("request");
        HttpServletResponse response = (HttpServletResponse) super.getVariable("response");
        RequestDispatcher dispatcher = request.getRequestDispatcher(path);
        dispatcher.forward(request, response);
    }
View Full Code Here

    }
   
    public void include(String path) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) super.getVariable("request");
        HttpServletResponse response = (HttpServletResponse) super.getVariable("response");
        RequestDispatcher dispatcher = request.getRequestDispatcher(path);
        dispatcher.include(request, response);
    }
View Full Code Here

  public void doGet(HttpServletRequest request, HttpServletResponse response) {
    doPost(request, response);
  }

  public void doPost(HttpServletRequest request, HttpServletResponse response) {
    RequestDispatcher rd = null
   
    try {
      CalculatorBean hl = new CalculatorBean();
     
      hl = parseRequest(request)
     
      //todo - test this - this will probably fail to run with a nullpointerexceptino
      SpringDecisionTableLoader dtLoader = new SpringDecisionTableLoader();
      hl = (CalculatorBean)dtLoader.executeDecisionTable(hl,true);

      request.setAttribute("result", hl);
     
      rd = request.getRequestDispatcher("/jsp/m3/result.jsp");
      rd.forward(request, response);
    }
    catch (Throwable t) {
     
      //Just catch and log the exception
      //We wouldn't recommend this for production code, remember that this is just a sample
View Full Code Here

      response.setContentType(CONTENT_TYPE_TEXT_PLAIN);

      // Forward
      final String resolvedLocation = ROOT + jsp;
      log.info("Forwarding to: " + resolvedLocation);
      final RequestDispatcher dispatcher = request.getRequestDispatcher(resolvedLocation);
      dispatcher.forward(request, response);
   }
View Full Code Here

TOP

Related Classes of javax.servlet.RequestDispatcher

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.