Example usage for com.liferay.portal.struts StrutsUtil TEXT_HTML_DIR

List of usage examples for com.liferay.portal.struts StrutsUtil TEXT_HTML_DIR

Introduction

In this page you can find the example usage for com.liferay.portal.struts StrutsUtil TEXT_HTML_DIR.

Prototype

String TEXT_HTML_DIR

To view the source code for com.liferay.portal.struts StrutsUtil TEXT_HTML_DIR.

Click Source Link

Usage

From source file:com.liferay.portlet.VelocityPortlet.java

License:Open Source License

protected String getVelocityTemplateId(String name) {
    if (Validator.isNull(name)) {
        return name;
    }/*  ww  w. j  ava2 s .  c o  m*/

    StringBundler sb = new StringBundler(4);

    sb.append(_portletContextName);
    sb.append(VelocityResourceListener.SERVLET_SEPARATOR);
    sb.append(StrutsUtil.TEXT_HTML_DIR);
    sb.append(name);

    return sb.toString();
}

From source file:com.liferay.portlet.webproxy.WebProxyPortlet.java

License:Open Source License

@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
        throws IOException, PortletException {

    if (!_enabled) {
        printError(renderResponse);/*from  w  w  w  . j a v a  2 s  . c  om*/

        return;
    }

    PortletPreferences preferences = renderRequest.getPreferences();

    String initUrl = preferences.getValue("initUrl", StringPool.BLANK);

    if (Validator.isNull(initUrl)) {
        PortletRequestDispatcher portletRequestDispatcher = getPortletContext()
                .getRequestDispatcher(StrutsUtil.TEXT_HTML_DIR + "/portal/portlet_not_setup.jsp");

        portletRequestDispatcher.include(renderRequest, renderResponse);
    } else {
        super.doView(renderRequest, renderResponse);

        RenderResponseImpl renderResponseImpl = (RenderResponseImpl) renderResponse;

        StringServletResponse stringResponse = (StringServletResponse) renderResponseImpl
                .getHttpServletResponse();

        String output = stringResponse.getString();

        output = StringUtil.replace(output, "//pbhs/", "/pbhs/");

        stringResponse.setString(output);
    }
}

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;//from   w w  w  . j a v a 2s . 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);
    }
}