Package ch.ralscha.extdirectspring.controller

Examples of ch.ralscha.extdirectspring.controller.RouterController


   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      if (isMultipart()) {
        response.setContentType(RouterController.TEXT_HTML.toString());
        response.setCharacterEncoding(RouterController.TEXT_HTML.getCharSet().name());

        ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
        bos.write("<html><body><textarea>".getBytes());

        String responseJson = routerController.getJsonHandler().getMapper()
            .writeValueAsString(extDirectResponse);

        responseJson = responseJson.replace("&quot;", "\\&quot;");
        bos.write(responseJson.getBytes());
        bos.write("</textarea></body></html>".getBytes());

        response.setContentLength(bos.size());
        FileCopyUtils.copy(bos.toByteArray(), response.getOutputStream());
      } else {
        routerController.writeJsonResponse(response, extDirectResponse, routerController.getConfiguration()
            .isStreamResponse());
      }
    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
View Full Code Here


   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      routerController.writeJsonResponse(response, extDirectResponse, routerController.getConfiguration()
          .isStreamResponse(), ExtDirectSpringUtil.isMultipart(request));

    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      if (isMultipart()) {
        response.setContentType(RouterController.TEXT_HTML.toString());
        response.setCharacterEncoding(RouterController.TEXT_HTML.getCharSet().name());

        ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
        bos.write("<html><body><textarea>".getBytes("UTF-8"));

        String responseJson = routerController.getJsonHandler().getMapper()
            .writeValueAsString(extDirectResponse);

        responseJson = responseJson.replace("&quot;", "\\&quot;");
        bos.write(responseJson.getBytes("UTF-8"));
        bos.write("</textarea></body></html>".getBytes("UTF-8"));

        response.setContentLength(bos.size());
        FileCopyUtils.copy(bos.toByteArray(), response.getOutputStream());
      } else {
        routerController.writeJsonResponse(response, extDirectResponse, routerController.getConfiguration()
            .isStreamResponse());
      }
    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
View Full Code Here

   * @throws IOException
   */
  public static void writeModel(HttpServletRequest request, HttpServletResponse response, ModelBean model,
      OutputFormat format, boolean debug) throws IOException {

    RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
        RouterController.class);

    byte[] data = generateJavascript(model, format, debug).getBytes(RouterController.UTF8_CHARSET);
    String ifNoneMatch = request.getHeader("If-None-Match");
    String etag = "\"0" + DigestUtils.md5DigestAsHex(data) + "\"";

    if (etag.equals(ifNoneMatch)) {
      response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
      return;
    }

    response.setContentType(routerController.getConfiguration().getJsContentType());
    response.setCharacterEncoding(RouterController.UTF8_CHARSET.name());
    response.setContentLength(data.length);

    response.setHeader("ETag", etag);

View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      if (isMultipart()) {
        response.setContentType(RouterController.TEXT_HTML.toString());
        response.setCharacterEncoding(RouterController.TEXT_HTML.getCharSet().name());

        ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
        bos.write("<html><body><textarea>".getBytes());

        String responseJson = routerController.getJsonHandler().getMapper()
            .writeValueAsString(extDirectResponse);

        responseJson = responseJson.replace("&quot;", "\\&quot;");
        bos.write(responseJson.getBytes());
        bos.write("</textarea></body></html>".getBytes());

        response.setContentLength(bos.size());
        FileCopyUtils.copy(bos.toByteArray(), response.getOutputStream());
      } else {
        routerController.writeJsonResponse(response, extDirectResponse, routerController.getConfiguration()
            .isStreamResponse());
      }
    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
View Full Code Here

   * @throws IOException
   */
  public static void writeModel(HttpServletRequest request, HttpServletResponse response, ModelBean model,
      OutputFormat format, boolean debug) throws IOException {

    RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
        RouterController.class);

    byte[] data = generateJavascript(model, format, debug).getBytes(RouterController.UTF8_CHARSET);
    String ifNoneMatch = request.getHeader("If-None-Match");
    String etag = "\"0" + DigestUtils.md5DigestAsHex(data) + "\"";

    if (etag.equals(ifNoneMatch)) {
      response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
      return;
    }

    response.setContentType(routerController.getConfiguration().getJsContentType());
    response.setCharacterEncoding(RouterController.UTF8_CHARSET.name());
    response.setContentLength(data.length);

    response.setHeader("ETag", etag);

View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      routerController.writeJsonResponse(response, extDirectResponse, routerController.getConfiguration()
          .isStreamResponse(), ExtDirectSpringUtil.isMultipart(request));

    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      routerController.writeJsonResponse(request, response, extDirectResponse);

    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
    }
View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      routerController.writeJsonResponse(request, response, extDirectResponse, jsonView);

    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
    }
View Full Code Here

   * a FORM_POST method.
   */
  public void buildAndWrite() {

    try {
      RouterController routerController = RequestContextUtils.getWebApplicationContext(request).getBean(
          RouterController.class);

      routerController.writeJsonResponse(request, response, extDirectResponse, jsonView);

    } catch (IOException e) {
      LogFactory.getLog(getClass()).error("buildAndWrite", e);
      throw new RuntimeException(e);
    }
View Full Code Here

TOP

Related Classes of ch.ralscha.extdirectspring.controller.RouterController

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.