You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:30 UTC
[myfaces-trinidad] 02/07: Add new offline and web crawler
OutputModes with the appropriate capability merging. The offline mode
represents a page that can not POST or GET additional content.
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch jwaldman-offline-mode-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git
commit 66009c3a6ec8ed0f190f7865e098dd9354a7793e
Author: Blake Sullivan <bs...@apache.org>
AuthorDate: Tue Sep 20 07:09:22 2011 +0000
Add new offline and web crawler OutputModes with the appropriate capability merging. The offline mode represents a page that can not POST or GET additional content.
---
.../renderkit/core/CoreRenderKit.java | 14 ++++++++++
.../renderkit/core/CoreRenderingContext.java | 32 ++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
index 5e1283a..0b756cd 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
@@ -111,6 +111,20 @@ public class CoreRenderKit extends RenderKitDecorator
*/
static public final String OUTPUT_MODE_EMAIL = "email";
+ /**
+ * An offline browser output mode. Render the content such that the output can be taken
+ * offline. Interactions requiring server communication should be avoided.
+ */
+ static public final String OUTPUT_MODE_OFFLINE = "offline";
+
+ /**
+ * Web Creawler output mode. Render the content for consumption by a web crawler
+ */
+ static public final String OUTPUT_MODE_WEB_CRAWLER = "webcrawler";
+
+
+ public enum OutputMode {normal, portlet, printable, email, offline}
+
static public final String RETURN_PARAM = "rtrn";
/**
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
index e1374d2..ae08920 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
@@ -671,6 +671,14 @@ public class CoreRenderingContext extends RenderingContext
return AgentUtil.mergeCapabilities(agent, _PORTLET_CAPABILITIES);
}
}
+ else if (CoreRenderKit.OUTPUT_MODE_OFFLINE.equals(outputMode))
+ {
+ return AgentUtil.mergeCapabilities(agent, _OFFLINE_CAPABILITIES);
+ }
+ else if (CoreRenderKit.OUTPUT_MODE_WEB_CRAWLER.equals(outputMode))
+ {
+ return AgentUtil.mergeCapabilities(agent, _WEB_CRAWLER_CAPABILITIES);
+ }
else
{
return agent;
@@ -819,6 +827,13 @@ public class CoreRenderingContext extends RenderingContext
static private final Map<Object, Object> _ENHANCED_PORTLET_CAPABILITIES =
new HashMap<Object, Object>();
+ static private final Map<Object, Object> _OFFLINE_CAPABILITIES =
+ new HashMap<Object, Object>();
+
+ static private final Map<Object, Object> _WEB_CRAWLER_CAPABILITIES =
+ new HashMap<Object, Object>();
+
+
static
{
_PRINTABLE_CAPABILITIES.put(TrinidadAgent.CAP_INTRINSIC_EVENTS,
@@ -846,6 +861,20 @@ public class CoreRenderingContext extends RenderingContext
TrinidadAgent.STYLES_INTERNAL);
_EMAIL_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
Boolean.FALSE);
+
+ // for now, the Web Crawler capabilities are the same as the EMail capabilities
+ _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_INTRINSIC_EVENTS,
+ Boolean.FALSE);
+ _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_SCRIPTING_SPEED,
+ TrinidadAgent.SCRIPTING_SPEED_CAP_NONE);
+ _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_EDITING,
+ Boolean.FALSE);
+ // =-= bts I wouldn't think that we would output any style sheets for a web crawler
+ _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_STYLE_ATTRIBUTES,
+ TrinidadAgent.STYLES_INTERNAL);
+ _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
+ Boolean.FALSE);
+
_PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
Boolean.FALSE);
@@ -854,6 +883,9 @@ public class CoreRenderingContext extends RenderingContext
_ENHANCED_PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
Boolean.FALSE);
+
+ // turn off PPR
+ _OFFLINE_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING, Boolean.FALSE);
}
static private final TrinidadLogger _LOG =
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.