📄 fullscreendispatcherengine.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .//package org.jahia.engines.applications;import java.io.IOException;import java.io.PrintWriter;import java.util.Properties;import java.util.StringTokenizer;import org.jahia.data.JahiaData;import org.jahia.engines.JahiaEngine;import org.jahia.exceptions.JahiaException;import org.jahia.params.ParamBean;import org.jahia.registries.ServicesRegistry;/** * <p>Title: Full screen application dispatcher engine</p> * <p>Description: The goal of this engine is to allow applications to "take" * over the HTML screen, without Jahia giving up it's hand. This can be useful * for all types of applications.</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Jahia Ltd</p> * @author Serge Huber * @version 1.0 */public class FullScreenDispatcherEngine implements JahiaEngine { public static final String ENGINE_NAME = "appdispatcher"; public FullScreenDispatcherEngine () { } public boolean authoriseRender (ParamBean jParams) { // render is always authorized as even guest users might need this. // Actually the rendering is controlled more by the application than // by the user. return true; } public String renderLink (ParamBean jParams, Object theObj) throws JahiaException { String resultURL; Properties paramPairs = new Properties (); // paramPairs.setProperty("fieldid", ) paramPairs.setProperty (ParamBean.PAGE_ID_PARAMETER, Integer.toString (jParams.getPageID ())); resultURL = jParams.composeEngineUrl (ENGINE_NAME, paramPairs, ""); return resultURL; } public boolean needsJahiaData (ParamBean jParams) { return false; } public void handleActions (ParamBean jParams, JahiaData jData) throws JahiaException { String appUniqueIDStr = jParams.getParameter ("appid"); if (appUniqueIDStr == null) { throw new JahiaException ( "Error while displaying application", "Missing appID parameter for engine " + FullScreenDispatcherEngine.ENGINE_NAME, JahiaException.APPLICATION_ERROR, JahiaException.ERROR); } StringTokenizer strToken = new StringTokenizer (appUniqueIDStr, "_"); String fieldIDStr = strToken.nextToken (); String appIDStr = strToken.nextToken (); int fieldID = Integer.parseInt (fieldIDStr); String appOutput = ServicesRegistry.getInstance ().getJahiaApplicationsDispatchingService ().getAppOutput (fieldID, appIDStr, jParams); try { PrintWriter out = jParams.getResponse ().getWriter (); out.print (appOutput); out.flush (); } catch (IOException ioe) { throw new JahiaException ( "Error while displaying application output", "Couldn't get HttpResponse PrintWriter instance", JahiaException.APPLICATION_ERROR, JahiaException.ERROR, ioe); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -