Example usage for com.liferay.portal.kernel.servlet BrowserSnifferUtil isRtf

List of usage examples for com.liferay.portal.kernel.servlet BrowserSnifferUtil isRtf

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet BrowserSnifferUtil isRtf.

Prototype

public static boolean isRtf(HttpServletRequest httpServletRequest) 

Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.internal.util.DDMFormFieldFreeMarkerRendererHelper.java

License:Open Source License

public static Editor getEditor(HttpServletRequest request) {
    if (!BrowserSnifferUtil.isRtf(request)) {
        return _editors.get("simple");
    }// w w w  .  j ava2 s  . com

    if (Validator.isNull(_TEXT_HTML_EDITOR_WYSIWYG_DEFAULT)) {
        return _editors.get(_EDITOR_WYSIWYG_DEFAULT);
    }

    if (!_editors.containsKey(_TEXT_HTML_EDITOR_WYSIWYG_DEFAULT)) {
        return _editors.get(_EDITOR_WYSIWYG_DEFAULT);
    }

    return _editors.get(_TEXT_HTML_EDITOR_WYSIWYG_DEFAULT);
}

From source file:org.apache.jsp.html.js.editor.editor_jsp.java

License:Open Source License

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;/* ww  w.  ja  v  a 2 s .c o m*/
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        response.setContentType("text/html");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");

        String editorImpl = ParamUtil.getString(request, "editorImpl", PropsValues.EDITOR_WYSIWYG_DEFAULT);

        if (!BrowserSnifferUtil.isRtf(request)) {
            if (BrowserSnifferUtil.isSafari(request) && BrowserSnifferUtil.isMobile(request)) {
                editorImpl = "simple";
            } else if (BrowserSnifferUtil.isSafari(request) && (editorImpl.indexOf("simple") == -1)) {
                editorImpl = "tinymcesimple";
            } else {
                editorImpl = "simple";
            }
        }

        //editorImpl = "fckeditor";
        //editorImpl = "liferay";
        //editorImpl = "simple";
        //editorImpl = "tinymce";
        //editorImpl = "tinymcesimple";

        // Resin won't allow dynamic content inside the jsp:include tag

        RequestDispatcher rd = application
                .getRequestDispatcher(StrutsUtil.TEXT_HTML_DIR + "/js/editor/" + editorImpl + ".jsp");

        rd.include(request, response);

        out.write('\n');
        out.write('\n');
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}