You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/11/07 21:29:40 UTC
svn commit: r472235 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/application/
tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/
Author: bommel
Date: Tue Nov 7 12:29:40 2006
New Revision: 472235
URL: http://svn.apache.org/viewvc?view=rev&rev=472235
Log:
[TOBAGO-175] move wml and fo renderkit to sandbox
Added:
myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/
myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/FoViewHandlerImpl.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ViewHandlerImpl.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ViewHandlerImpl.java?view=diff&rev=472235&r1=472234&r2=472235
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ViewHandlerImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/application/ViewHandlerImpl.java Tue Nov 7 12:29:40 2006
@@ -44,13 +44,11 @@
private ViewHandler base;
-
public ViewHandlerImpl(ViewHandler base) {
LOG.info("Hiding RI base implemation: " + base);
this.base = base;
}
-
public Locale calculateLocale(FacesContext facesContext) {
return base.calculateLocale(facesContext);
}
@@ -59,8 +57,6 @@
return base.calculateRenderKitId(facesContext);
}
-
-
public UIViewRoot createView(FacesContext facesContext, String viewId) {
if (LOG.isDebugEnabled()) {
LOG.debug("creating new view with viewId: '" + viewId + "'");
@@ -93,7 +89,6 @@
}
}
-
public String getActionURL(FacesContext facesContext, String viewId) {
return base.getActionURL(facesContext, viewId);
}
@@ -102,48 +97,11 @@
return base.getResourceURL(facesContext, path);
}
-
public void renderView(FacesContext facesContext, UIViewRoot viewRoot)
throws IOException, FacesException {
- String requestUri = viewRoot.getViewId();
-
- String contentType
- = ClientProperties.getInstance(viewRoot).getContentType();
- if (LOG.isDebugEnabled()) {
- LOG.debug("contentType = '" + contentType + "'");
- }
- if (contentType.indexOf("fo") == -1) {
// standard
- base.renderView(facesContext, viewRoot);
- } else {
- try {
- // TODO PortletResponse ??
- if (facesContext.getExternalContext().getResponse() instanceof TobagoResponse) {
- ((TobagoResponse) facesContext.getExternalContext().getResponse()).setBuffering();
- // own dispatch
- HttpServletRequest request = (HttpServletRequest)
- facesContext.getExternalContext().getRequest();
- HttpServletResponse response = (HttpServletResponse)
- facesContext.getExternalContext().getResponse();
- RequestDispatcher requestDispatcher
- = request.getRequestDispatcher(requestUri);
- requestDispatcher.include(request, response);
- response.setContentType("application/pdf");
- String buffer =
- ((TobagoResponse) facesContext.getExternalContext().getResponse()).getBufferedString();
- ServletResponse servletResponse = (ServletResponse)
- facesContext.getExternalContext().getResponse();
- if (LOG.isDebugEnabled()) {
- LOG.debug("fo buffer: " + buffer);
- }
- FopConverter.fo2Pdf(servletResponse, buffer);
- }
- } catch (ServletException e) {
- IOException ex = new IOException();
- ex.initCause(e);
- throw ex;
- }
- }
+ base.renderView(facesContext, viewRoot);
+
if (LOG.isDebugEnabled()) {
LOG.debug("VIEW");
LOG.debug(ComponentUtil.toString(facesContext.getViewRoot(), 0));
@@ -161,8 +119,6 @@
ensureClientProperties(facesContext, viewRoot);
return viewRoot;
}
-
-
public void writeState(FacesContext facesContext) throws IOException {
base.writeState(facesContext);
Added: myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/FoViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/FoViewHandlerImpl.java?view=auto&rev=472235
==============================================================================
--- myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/FoViewHandlerImpl.java (added)
+++ myfaces/tobago/trunk/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/application/FoViewHandlerImpl.java Tue Nov 7 12:29:40 2006
@@ -0,0 +1,97 @@
+package org.apache.myfaces.tobago.application;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.context.ClientProperties;
+import org.apache.myfaces.tobago.webapp.TobagoResponse;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIViewRoot;
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: Nov 7, 2006
+ * Time: 9:09:52 PM
+ */
+public class FoViewHandlerImpl extends ViewHandlerImpl {
+
+ private static final Log LOG = LogFactory.getLog(FoViewHandlerImpl.class);
+
+ public FoViewHandlerImpl(ViewHandler base) {
+ super(base);
+ }
+
+ public void renderView(FacesContext facesContext, UIViewRoot viewRoot)
+ throws IOException, FacesException {
+ String requestUri = viewRoot.getViewId();
+
+ String contentType
+ = ClientProperties.getInstance(viewRoot).getContentType();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("contentType = '" + contentType + "'");
+ }
+ if (contentType.indexOf("fo") == -1) {
+ // standard
+ super.renderView(facesContext, viewRoot);
+ } else {
+ try {
+ // TODO PortletResponse ??
+ if (facesContext.getExternalContext().getResponse() instanceof TobagoResponse) {
+ ((TobagoResponse) facesContext.getExternalContext().getResponse()).setBuffering();
+ // own dispatch
+ HttpServletRequest request = (HttpServletRequest)
+ facesContext.getExternalContext().getRequest();
+ HttpServletResponse response = (HttpServletResponse)
+ facesContext.getExternalContext().getResponse();
+ RequestDispatcher requestDispatcher
+ = request.getRequestDispatcher(requestUri);
+ requestDispatcher.include(request, response);
+ response.setContentType("application/pdf");
+ String buffer =
+ ((TobagoResponse) facesContext.getExternalContext().getResponse()).getBufferedString();
+ ServletResponse servletResponse = (ServletResponse)
+ facesContext.getExternalContext().getResponse();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("fo buffer: " + buffer);
+ }
+ FopConverter.fo2Pdf(servletResponse, buffer);
+ }
+ } catch (ServletException e) {
+ IOException ex = new IOException();
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("VIEW");
+ LOG.debug(ComponentUtil.toString(facesContext.getViewRoot(), 0));
+ }
+ }
+
+}