You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/04 00:13:02 UTC
svn commit: r673845 [4/4] - in /myfaces/core/trunk:
api/src/main/java/javax/faces/webapp/
api/src/test/java/javax/faces/component/
impl/src/main/java/org/apache/myfaces/application/pss/
impl/src/main/java/org/apache/myfaces/config/element/ impl/src/mai...
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspStateManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspViewHandlerImpl.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspViewHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspViewHandlerImpl.java Thu Jul 3 15:13:01 2008
@@ -1,324 +1,324 @@
-/*
- * Copyright 2004 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.
- */
-
-package org.apache.myfaces.application.pss;
-
-
-import org.apache.myfaces.application.jsp.JspViewHandlerImpl;
-import org.apache.myfaces.portlet.PortletUtil;
-import org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping;
-import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
-import org.apache.myfaces.util.DebugUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.faces.application.ViewHandler;
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.component.UIViewRoot;
-import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.render.RenderKitFactory;
-import javax.faces.render.RenderKit;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletResponse;
-import javax.servlet.ServletResponseWrapper;
-import java.util.Locale;
-import java.util.List;
-import java.io.IOException;
-
-/**
- * @author Martin Haimberger
- */
-public class PssJspViewHandlerImpl extends ViewHandler
-{
- private static final Log log = LogFactory.getLog(JspViewHandlerImpl.class);
- private ViewHandler oldViewHandler = null;
-
- private static final String PARTIAL_STATE_SAVING_METHOD_PARAM_NAME = "javax.faces.PARTIAL_STATE_SAVING_METHOD";
- private static final String PARTIAL_STATE_SAVING_METHOD_ON = "true";
- private static final String PARTIAL_STATE_SAVING_METHOD_OFF = "false";
-
- private Boolean _partialStateSaving = null;
-
-
- private int bufSize = 32;
-
- private boolean isPartialStateSavingOn(FacesContext context)
- {
- if(context == null) throw new NullPointerException("context");
- if (_partialStateSaving != null) return _partialStateSaving.booleanValue();
- String stateSavingMethod = context.getExternalContext().getInitParameter(PARTIAL_STATE_SAVING_METHOD_PARAM_NAME);
- if (stateSavingMethod == null)
- {
- _partialStateSaving = Boolean.FALSE; //Specs 10.1.3: default server saving
- context.getExternalContext().log("No context init parameter '"+PARTIAL_STATE_SAVING_METHOD_PARAM_NAME+"' found; no partial state saving method defined, assuming default partial state saving method off.");
- }
- else if (stateSavingMethod.equals(PARTIAL_STATE_SAVING_METHOD_ON))
- {
- _partialStateSaving = Boolean.TRUE;
- }
- else if (stateSavingMethod.equals(PARTIAL_STATE_SAVING_METHOD_OFF))
- {
- _partialStateSaving = Boolean.FALSE;
- }
- else
- {
- _partialStateSaving = Boolean.FALSE; //Specs 10.1.3: default server saving
- context.getExternalContext().log("Illegal partial state saving method '" + stateSavingMethod + "', default partial state saving will be used (partial state saving off).");
- }
- return _partialStateSaving.booleanValue();
- }
-
-
- private ViewHandler getOldViewHandler()
- {
- if (oldViewHandler == null)
- {
- oldViewHandler = new JspViewHandlerImpl();
- }
- return oldViewHandler;
- }
-
- public PssJspViewHandlerImpl() {
- super();
- if (log.isTraceEnabled()) log.trace("New partial ViewHandler instance created");
- }
-
- public Locale calculateLocale(FacesContext context)
- {
- return getOldViewHandler().calculateLocale(context);
- }
-
- public String calculateRenderKitId(FacesContext context)
- {
- return getOldViewHandler().calculateRenderKitId(context);
- }
-
- public UIViewRoot createView(FacesContext context, String viewId)
- {
- return getOldViewHandler().createView(context,viewId);
- }
-
- public String getActionURL(FacesContext context, String viewId)
- {
- return getOldViewHandler().getActionURL(context,viewId);
- }
-
- public String getResourceURL(FacesContext context, String path)
- {
- return getOldViewHandler().getResourceURL(context,path);
- }
-
- public UIViewRoot restoreView(FacesContext context, String viewId)
- {
- if (!isPartialStateSavingOn(context)) {
- log.fatal("Partial state saving ViewHandler is installed, but partial state saving is not enabled. Please enable partial state saving or use another ViewHandler.");
- }
-
-
- UIViewRoot root = null;
-
- Application application = context.getApplication();
- ViewHandler applicationViewHandler = application.getViewHandler();
- String renderKitId = applicationViewHandler.calculateRenderKitId(context);
-
- root = context.getApplication().getStateManager().restoreView(context,viewId,renderKitId);
- return root;
- }
-
-
-
-
- public void writeState(FacesContext context) throws IOException
- {
- getOldViewHandler().writeState(context);
- }
-
- public void renderView(FacesContext facesContext, UIViewRoot viewToRender)
- throws IOException, FacesException
- {
- if (viewToRender == null)
- {
- log.fatal("viewToRender must not be null");
- throw new NullPointerException("viewToRender must not be null");
- }
-
- ExternalContext externalContext = facesContext.getExternalContext();
-
- String viewId = facesContext.getViewRoot().getViewId();
-
- if (PortletUtil.isPortletRequest(facesContext)) {
- externalContext.dispatch(viewId);
- return;
- }
-
- ServletMapping servletMapping = getServletMapping(externalContext);
-
- if (servletMapping != null && servletMapping.isExtensionMapping())
- {
- String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
- String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
- DebugUtils.assertError(suffix.charAt(0) == '.',
- log, "Default suffix must start with a dot!");
- if (!viewId.endsWith(suffix))
- {
- int slashPos = viewId.lastIndexOf('/');
- int extensionPos = viewId.lastIndexOf('.');
- if (extensionPos == -1 || extensionPos <= slashPos)
- {
- if (log.isTraceEnabled()) log.trace("Current viewId has no extension, appending default suffix " + suffix);
- viewId = viewId + suffix;
- }
- else
- {
- if (log.isTraceEnabled()) log.trace("Replacing extension of current viewId by suffix " + suffix);
- viewId = viewId.substring(0, extensionPos) + suffix;
- }
- facesContext.getViewRoot().setViewId(viewId);
- }
- }
-
- if (log.isTraceEnabled()) log.trace("Dispatching to " + viewId);
-
- // handle character encoding as of section 2.5.2.2 of JSF 1.1
- if (externalContext.getResponse() instanceof ServletResponse) {
- ServletResponse response = (ServletResponse) externalContext.getResponse();
- response.setLocale(viewToRender.getLocale());
- }
-
- ResponseWriter oldWriter = facesContext.getResponseWriter();
- HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
- HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
-
- RenderKitFactory renderFactory = (RenderKitFactory)
- FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit =
- renderFactory.getRenderKit(facesContext, viewToRender.getRenderKitId());
-
-
- BufferedStringWriter strWriter = new BufferedStringWriter(facesContext, bufSize);
- ResponseWriter newWriter;
- if (null != oldWriter) {
- newWriter = oldWriter.cloneWithWriter(strWriter);
- } else {
- newWriter = renderKit.createResponseWriter(strWriter, null,
- request.getCharacterEncoding());
- }
- facesContext.setResponseWriter(newWriter);
-
-
- ResponseWriter responseWriter;
- if (null != oldWriter) {
- responseWriter = oldWriter.cloneWithWriter(response.getWriter());
- } else {
- response.reset();
- responseWriter = newWriter.cloneWithWriter(response.getWriter());
- }
-
- // now render the UIViewRoot
- newWriter.startDocument();
- newWriter.flush();
- EncodeAllComponentUtil.encodeAll(facesContext,viewToRender);
- newWriter.flush();
- newWriter.endDocument();
-
- facesContext.setResponseWriter(responseWriter);
- strWriter.flushToWriter(responseWriter);
-
- if (oldWriter != null)
- {
- facesContext.setResponseWriter(oldWriter);
- }
-
- if (facesContext.getExternalContext().getResponse() instanceof ServletResponseWrapper)
- ((ServletResponseWrapper)facesContext.getExternalContext().getResponse()).setContentType("text/html");
-
-
- // handle character encoding as of section 2.5.2.2 of JSF 1.1
- if (externalContext.getRequest() instanceof HttpServletRequest) {
- HttpSession session = request.getSession(false);
-
- if (session != null) {
- session.setAttribute(ViewHandler.CHARACTER_ENCODING_KEY, response.getCharacterEncoding());
- }
- }
-
- }
-
-
- private static ServletMapping getServletMapping(ExternalContext externalContext)
- {
- String servletPath = externalContext.getRequestServletPath();
- String requestPathInfo = externalContext.getRequestPathInfo();
-
- WebXml webxml = WebXml.getWebXml(externalContext);
- List mappings = webxml.getFacesServletMappings();
-
-
- if (requestPathInfo == null)
- {
- // might be extension mapping
- for (int i = 0, size = mappings.size(); i < size; i++)
- {
- ServletMapping servletMapping = (ServletMapping) mappings.get(i);
- String urlpattern = servletMapping.getUrlPattern();
- String extension = urlpattern.substring(1, urlpattern.length());
- if (servletPath.endsWith(extension))
- {
- return servletMapping;
- } else if (servletPath.equals(urlpattern)) {
- // path mapping with no pathInfo for the current request
- return servletMapping;
- }
- }
- }
- else
- {
- // path mapping
- for (int i = 0, size = mappings.size(); i < size; i++)
- {
-
- ServletMapping servletMapping = (ServletMapping) mappings.get(i);
- String urlpattern = servletMapping.getUrlPattern();
- urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
- // servletPath starts with "/" except in the case where the
- // request is matched with the "/*" pattern, in which case
- // it is the empty string (see Servlet Sepc 2.3 SRV4.4)
- if (servletPath.equals(urlpattern))
- {
- return servletMapping;
- }
- }
- }
-
- // handle cases as best possible where servletPath is not a faces servlet,
- // such as when coming through struts-faces
- if (mappings.size() > 0)
- {
- return (ServletMapping) mappings.get(0);
- }
- else
- {
- log.warn("no faces servlet mappings found");
- return null;
- }
- }
-}
+/*
+ * Copyright 2004 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.
+ */
+
+package org.apache.myfaces.application.pss;
+
+
+import org.apache.myfaces.application.jsp.JspViewHandlerImpl;
+import org.apache.myfaces.portlet.PortletUtil;
+import org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping;
+import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
+import org.apache.myfaces.util.DebugUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.component.UIViewRoot;
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.RenderKit;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletResponseWrapper;
+import java.util.Locale;
+import java.util.List;
+import java.io.IOException;
+
+/**
+ * @author Martin Haimberger
+ */
+public class PssJspViewHandlerImpl extends ViewHandler
+{
+ private static final Log log = LogFactory.getLog(JspViewHandlerImpl.class);
+ private ViewHandler oldViewHandler = null;
+
+ private static final String PARTIAL_STATE_SAVING_METHOD_PARAM_NAME = "javax.faces.PARTIAL_STATE_SAVING_METHOD";
+ private static final String PARTIAL_STATE_SAVING_METHOD_ON = "true";
+ private static final String PARTIAL_STATE_SAVING_METHOD_OFF = "false";
+
+ private Boolean _partialStateSaving = null;
+
+
+ private int bufSize = 32;
+
+ private boolean isPartialStateSavingOn(FacesContext context)
+ {
+ if(context == null) throw new NullPointerException("context");
+ if (_partialStateSaving != null) return _partialStateSaving.booleanValue();
+ String stateSavingMethod = context.getExternalContext().getInitParameter(PARTIAL_STATE_SAVING_METHOD_PARAM_NAME);
+ if (stateSavingMethod == null)
+ {
+ _partialStateSaving = Boolean.FALSE; //Specs 10.1.3: default server saving
+ context.getExternalContext().log("No context init parameter '"+PARTIAL_STATE_SAVING_METHOD_PARAM_NAME+"' found; no partial state saving method defined, assuming default partial state saving method off.");
+ }
+ else if (stateSavingMethod.equals(PARTIAL_STATE_SAVING_METHOD_ON))
+ {
+ _partialStateSaving = Boolean.TRUE;
+ }
+ else if (stateSavingMethod.equals(PARTIAL_STATE_SAVING_METHOD_OFF))
+ {
+ _partialStateSaving = Boolean.FALSE;
+ }
+ else
+ {
+ _partialStateSaving = Boolean.FALSE; //Specs 10.1.3: default server saving
+ context.getExternalContext().log("Illegal partial state saving method '" + stateSavingMethod + "', default partial state saving will be used (partial state saving off).");
+ }
+ return _partialStateSaving.booleanValue();
+ }
+
+
+ private ViewHandler getOldViewHandler()
+ {
+ if (oldViewHandler == null)
+ {
+ oldViewHandler = new JspViewHandlerImpl();
+ }
+ return oldViewHandler;
+ }
+
+ public PssJspViewHandlerImpl() {
+ super();
+ if (log.isTraceEnabled()) log.trace("New partial ViewHandler instance created");
+ }
+
+ public Locale calculateLocale(FacesContext context)
+ {
+ return getOldViewHandler().calculateLocale(context);
+ }
+
+ public String calculateRenderKitId(FacesContext context)
+ {
+ return getOldViewHandler().calculateRenderKitId(context);
+ }
+
+ public UIViewRoot createView(FacesContext context, String viewId)
+ {
+ return getOldViewHandler().createView(context,viewId);
+ }
+
+ public String getActionURL(FacesContext context, String viewId)
+ {
+ return getOldViewHandler().getActionURL(context,viewId);
+ }
+
+ public String getResourceURL(FacesContext context, String path)
+ {
+ return getOldViewHandler().getResourceURL(context,path);
+ }
+
+ public UIViewRoot restoreView(FacesContext context, String viewId)
+ {
+ if (!isPartialStateSavingOn(context)) {
+ log.fatal("Partial state saving ViewHandler is installed, but partial state saving is not enabled. Please enable partial state saving or use another ViewHandler.");
+ }
+
+
+ UIViewRoot root = null;
+
+ Application application = context.getApplication();
+ ViewHandler applicationViewHandler = application.getViewHandler();
+ String renderKitId = applicationViewHandler.calculateRenderKitId(context);
+
+ root = context.getApplication().getStateManager().restoreView(context,viewId,renderKitId);
+ return root;
+ }
+
+
+
+
+ public void writeState(FacesContext context) throws IOException
+ {
+ getOldViewHandler().writeState(context);
+ }
+
+ public void renderView(FacesContext facesContext, UIViewRoot viewToRender)
+ throws IOException, FacesException
+ {
+ if (viewToRender == null)
+ {
+ log.fatal("viewToRender must not be null");
+ throw new NullPointerException("viewToRender must not be null");
+ }
+
+ ExternalContext externalContext = facesContext.getExternalContext();
+
+ String viewId = facesContext.getViewRoot().getViewId();
+
+ if (PortletUtil.isPortletRequest(facesContext)) {
+ externalContext.dispatch(viewId);
+ return;
+ }
+
+ ServletMapping servletMapping = getServletMapping(externalContext);
+
+ if (servletMapping != null && servletMapping.isExtensionMapping())
+ {
+ String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+ String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
+ DebugUtils.assertError(suffix.charAt(0) == '.',
+ log, "Default suffix must start with a dot!");
+ if (!viewId.endsWith(suffix))
+ {
+ int slashPos = viewId.lastIndexOf('/');
+ int extensionPos = viewId.lastIndexOf('.');
+ if (extensionPos == -1 || extensionPos <= slashPos)
+ {
+ if (log.isTraceEnabled()) log.trace("Current viewId has no extension, appending default suffix " + suffix);
+ viewId = viewId + suffix;
+ }
+ else
+ {
+ if (log.isTraceEnabled()) log.trace("Replacing extension of current viewId by suffix " + suffix);
+ viewId = viewId.substring(0, extensionPos) + suffix;
+ }
+ facesContext.getViewRoot().setViewId(viewId);
+ }
+ }
+
+ if (log.isTraceEnabled()) log.trace("Dispatching to " + viewId);
+
+ // handle character encoding as of section 2.5.2.2 of JSF 1.1
+ if (externalContext.getResponse() instanceof ServletResponse) {
+ ServletResponse response = (ServletResponse) externalContext.getResponse();
+ response.setLocale(viewToRender.getLocale());
+ }
+
+ ResponseWriter oldWriter = facesContext.getResponseWriter();
+ HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
+ HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
+
+ RenderKitFactory renderFactory = (RenderKitFactory)
+ FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit =
+ renderFactory.getRenderKit(facesContext, viewToRender.getRenderKitId());
+
+
+ BufferedStringWriter strWriter = new BufferedStringWriter(facesContext, bufSize);
+ ResponseWriter newWriter;
+ if (null != oldWriter) {
+ newWriter = oldWriter.cloneWithWriter(strWriter);
+ } else {
+ newWriter = renderKit.createResponseWriter(strWriter, null,
+ request.getCharacterEncoding());
+ }
+ facesContext.setResponseWriter(newWriter);
+
+
+ ResponseWriter responseWriter;
+ if (null != oldWriter) {
+ responseWriter = oldWriter.cloneWithWriter(response.getWriter());
+ } else {
+ response.reset();
+ responseWriter = newWriter.cloneWithWriter(response.getWriter());
+ }
+
+ // now render the UIViewRoot
+ newWriter.startDocument();
+ newWriter.flush();
+ EncodeAllComponentUtil.encodeAll(facesContext,viewToRender);
+ newWriter.flush();
+ newWriter.endDocument();
+
+ facesContext.setResponseWriter(responseWriter);
+ strWriter.flushToWriter(responseWriter);
+
+ if (oldWriter != null)
+ {
+ facesContext.setResponseWriter(oldWriter);
+ }
+
+ if (facesContext.getExternalContext().getResponse() instanceof ServletResponseWrapper)
+ ((ServletResponseWrapper)facesContext.getExternalContext().getResponse()).setContentType("text/html");
+
+
+ // handle character encoding as of section 2.5.2.2 of JSF 1.1
+ if (externalContext.getRequest() instanceof HttpServletRequest) {
+ HttpSession session = request.getSession(false);
+
+ if (session != null) {
+ session.setAttribute(ViewHandler.CHARACTER_ENCODING_KEY, response.getCharacterEncoding());
+ }
+ }
+
+ }
+
+
+ private static ServletMapping getServletMapping(ExternalContext externalContext)
+ {
+ String servletPath = externalContext.getRequestServletPath();
+ String requestPathInfo = externalContext.getRequestPathInfo();
+
+ WebXml webxml = WebXml.getWebXml(externalContext);
+ List mappings = webxml.getFacesServletMappings();
+
+
+ if (requestPathInfo == null)
+ {
+ // might be extension mapping
+ for (int i = 0, size = mappings.size(); i < size; i++)
+ {
+ ServletMapping servletMapping = (ServletMapping) mappings.get(i);
+ String urlpattern = servletMapping.getUrlPattern();
+ String extension = urlpattern.substring(1, urlpattern.length());
+ if (servletPath.endsWith(extension))
+ {
+ return servletMapping;
+ } else if (servletPath.equals(urlpattern)) {
+ // path mapping with no pathInfo for the current request
+ return servletMapping;
+ }
+ }
+ }
+ else
+ {
+ // path mapping
+ for (int i = 0, size = mappings.size(); i < size; i++)
+ {
+
+ ServletMapping servletMapping = (ServletMapping) mappings.get(i);
+ String urlpattern = servletMapping.getUrlPattern();
+ urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
+ // servletPath starts with "/" except in the case where the
+ // request is matched with the "/*" pattern, in which case
+ // it is the empty string (see Servlet Sepc 2.3 SRV4.4)
+ if (servletPath.equals(urlpattern))
+ {
+ return servletMapping;
+ }
+ }
+ }
+
+ // handle cases as best possible where servletPath is not a faces servlet,
+ // such as when coming through struts-faces
+ if (mappings.size() > 0)
+ {
+ return (ServletMapping) mappings.get(0);
+ }
+ else
+ {
+ log.warn("no faces servlet mappings found");
+ return null;
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/PssJspViewHandlerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TempServletOutputStream.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TempServletOutputStream.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TempServletOutputStream.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TempServletOutputStream.java Thu Jul 3 15:13:01 2008
@@ -1,61 +1,61 @@
-/*
- * Copyright 2004 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.
- */
-
-package org.apache.myfaces.application.pss;
-
-import javax.servlet.ServletOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * @author Martin Haimberger
- */
-
-class TempServletOutputStream extends ServletOutputStream {
- private ByteArrayOutputStream tempOS = null;
-
-
- public TempServletOutputStream() {
- tempOS = new ByteArrayOutputStream();
- }
-
- public void write(int n) {
- tempOS.write(n);
- }
-
- public void resetByteArray() {
- tempOS.reset();
- }
-
- public byte[] toByteArray() {
- return tempOS.toByteArray();
- }
-
- public String toString() {
- return tempOS.toString();
- }
-
- public String toString(String enc) {
- String result = null;
- try {
- result = tempOS.toString(enc);
- }
- catch (UnsupportedEncodingException usee) {
- }
- return result;
- }
- }
-
+/*
+ * Copyright 2004 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.
+ */
+
+package org.apache.myfaces.application.pss;
+
+import javax.servlet.ServletOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @author Martin Haimberger
+ */
+
+class TempServletOutputStream extends ServletOutputStream {
+ private ByteArrayOutputStream tempOS = null;
+
+
+ public TempServletOutputStream() {
+ tempOS = new ByteArrayOutputStream();
+ }
+
+ public void write(int n) {
+ tempOS.write(n);
+ }
+
+ public void resetByteArray() {
+ tempOS.reset();
+ }
+
+ public byte[] toByteArray() {
+ return tempOS.toByteArray();
+ }
+
+ public String toString() {
+ return tempOS.toString();
+ }
+
+ public String toString(String enc) {
+ String result = null;
+ try {
+ result = tempOS.toString(enc);
+ }
+ catch (UnsupportedEncodingException usee) {
+ }
+ return result;
+ }
+ }
+
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TempServletOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TreeStructComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TreeStructComponent.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TreeStructComponent.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TreeStructComponent.java Thu Jul 3 15:13:01 2008
@@ -1,114 +1,114 @@
-/*
- * Copyright 2004 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.
- */
-
-package org.apache.myfaces.application.pss;
-
-import java.io.Serializable;
-
-/**
- * @author Martin Haimberger
- */
-public class TreeStructComponent
- implements Serializable
-{
-
- final public static byte STATE_IS_TEMPLATE_STATE = 1;
- final public static byte STATE_IS_NEW_STATE = 2;
- final public static byte STATE_IS_NEW_COMPONENT = 3;
- final public static byte STATE_IS_RESTORED = 4;
-
- private static final long serialVersionUID = 5069177074684737231L;
- private Integer _componentClass;
- private String _componentId;
- private TreeStructComponent[] _children = null; // Array of children
- private Object[] _facets = null; // Array of Array-tuples with Facetname and TreeStructComponent
- private Object _componentState = null;
- private byte status = 0;
- private boolean _transient;
-
- public boolean isTransient() {
- return _transient;
- }
-
- public void setTransient(boolean _transient) {
- this._transient = _transient;
- }
-
- public byte getStatus() {
- return status;
- }
-
- public void setStatus(byte status) {
- this.status = status;
- }
-
- public Object get_componentState() {
- return _componentState;
- }
-
- public void set_componentState(Object _componentState) {
- this._componentState = _componentState;
- }
-
- TreeStructComponent(Integer componentClass, String componentId,Object componentState, boolean isTransient)
- {
- _componentClass = componentClass;
- _componentId = componentId;
- set_componentState(componentState);
- _transient = isTransient;
-
- }
-
- public Integer getComponentClass()
- {
- return _componentClass;
- }
-
- public String getComponentId()
- {
- return _componentId;
- }
-
- void setChildren(TreeStructComponent[] children)
- {
- _children = children;
- }
-
- TreeStructComponent[] getChildren()
- {
- return _children;
- }
-
- Object[] getFacets()
- {
- return _facets;
- }
-
- void setFacets(Object[] facets)
- {
- _facets = facets;
- }
-
- public TreeStructComponent clone(TreeStructComponent org)
- {
- if (org == null)
- {
- return new TreeStructComponent(getComponentClass(),getComponentId(),get_componentState(),isTransient());
- }
- return new TreeStructComponent(org.getComponentClass(),org.getComponentId(),org.get_componentState(),org.isTransient());
- }
-
-}
+/*
+ * Copyright 2004 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.
+ */
+
+package org.apache.myfaces.application.pss;
+
+import java.io.Serializable;
+
+/**
+ * @author Martin Haimberger
+ */
+public class TreeStructComponent
+ implements Serializable
+{
+
+ final public static byte STATE_IS_TEMPLATE_STATE = 1;
+ final public static byte STATE_IS_NEW_STATE = 2;
+ final public static byte STATE_IS_NEW_COMPONENT = 3;
+ final public static byte STATE_IS_RESTORED = 4;
+
+ private static final long serialVersionUID = 5069177074684737231L;
+ private Integer _componentClass;
+ private String _componentId;
+ private TreeStructComponent[] _children = null; // Array of children
+ private Object[] _facets = null; // Array of Array-tuples with Facetname and TreeStructComponent
+ private Object _componentState = null;
+ private byte status = 0;
+ private boolean _transient;
+
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ public void setTransient(boolean _transient) {
+ this._transient = _transient;
+ }
+
+ public byte getStatus() {
+ return status;
+ }
+
+ public void setStatus(byte status) {
+ this.status = status;
+ }
+
+ public Object get_componentState() {
+ return _componentState;
+ }
+
+ public void set_componentState(Object _componentState) {
+ this._componentState = _componentState;
+ }
+
+ TreeStructComponent(Integer componentClass, String componentId,Object componentState, boolean isTransient)
+ {
+ _componentClass = componentClass;
+ _componentId = componentId;
+ set_componentState(componentState);
+ _transient = isTransient;
+
+ }
+
+ public Integer getComponentClass()
+ {
+ return _componentClass;
+ }
+
+ public String getComponentId()
+ {
+ return _componentId;
+ }
+
+ void setChildren(TreeStructComponent[] children)
+ {
+ _children = children;
+ }
+
+ TreeStructComponent[] getChildren()
+ {
+ return _children;
+ }
+
+ Object[] getFacets()
+ {
+ return _facets;
+ }
+
+ void setFacets(Object[] facets)
+ {
+ _facets = facets;
+ }
+
+ public TreeStructComponent clone(TreeStructComponent org)
+ {
+ if (org == null)
+ {
+ return new TreeStructComponent(getComponentClass(),getComponentId(),get_componentState(),isTransient());
+ }
+ return new TreeStructComponent(org.getComponentClass(),org.getComponentId(),org.get_componentState(),org.isTransient());
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/TreeStructComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/UIViewRootWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/ViewHandlerResponseWrapperHelperImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/ViewHandlerResponseWrapperHelperImpl.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/ViewHandlerResponseWrapperHelperImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/ViewHandlerResponseWrapperHelperImpl.java Thu Jul 3 15:13:01 2008
@@ -1,108 +1,108 @@
-/*
- * Copyright 2004 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.
- */
-
-package org.apache.myfaces.application.pss;
-
-import javax.servlet.http.HttpServletResponseWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.CharArrayWriter;
-
-/**
- * @author Martin Haimberger
- */
-public class ViewHandlerResponseWrapperHelperImpl extends HttpServletResponseWrapper {
- private TempServletOutputStream tempOS = null;
- private PrintWriter pw = null;
- private CharArrayWriter caw = null;
- private int status = HttpServletResponse.SC_OK;
-
- public PrintWriter getPw() {
- if (pw == null) {
- caw = new CharArrayWriter();
- pw = new PrintWriter(caw);
- }
- return pw;
- }
-
- public ServletOutputStream getTempOS() {
- if (tempOS == null)
- {
- tempOS = new TempServletOutputStream();
- }
- return tempOS;
- }
-
- public ViewHandlerResponseWrapperHelperImpl(HttpServletResponse httpServletResponse) {
- super(httpServletResponse);
- }
-
-
- // from HttpServletResponseWrapper
- public void sendError(int i, String string) throws IOException {
- super.sendError(i, string);
- status = i;
- }
-
- public void sendError(int i) throws IOException {
- super.sendError(i);
- status = i;
- }
-
- public void setStatus(int i) {
- super.setStatus(i);
- status = i;
- }
-
- public void setStatus(int i, String string) {
- super.setStatus(i, string);
- status = i;
- }
-
-
- public String toString() {
- String result = null;
- if (caw != null) {
- result = caw.toString();
- }
- else if (tempOS != null) {
- result = tempOS.toString();
- }
-
- return result;
- }
-
- public PrintWriter getWriter() throws IOException {
- return getPw();
- }
-
- public ServletOutputStream getOutputStream() throws IOException {
- return getTempOS();
- }
-
- public void resetWriter() {
- if (caw != null)
- {
- pw.flush();
- caw.flush();
- caw.reset();
- }
- }
-
-
-}
+/*
+ * Copyright 2004 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.
+ */
+
+package org.apache.myfaces.application.pss;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.CharArrayWriter;
+
+/**
+ * @author Martin Haimberger
+ */
+public class ViewHandlerResponseWrapperHelperImpl extends HttpServletResponseWrapper {
+ private TempServletOutputStream tempOS = null;
+ private PrintWriter pw = null;
+ private CharArrayWriter caw = null;
+ private int status = HttpServletResponse.SC_OK;
+
+ public PrintWriter getPw() {
+ if (pw == null) {
+ caw = new CharArrayWriter();
+ pw = new PrintWriter(caw);
+ }
+ return pw;
+ }
+
+ public ServletOutputStream getTempOS() {
+ if (tempOS == null)
+ {
+ tempOS = new TempServletOutputStream();
+ }
+ return tempOS;
+ }
+
+ public ViewHandlerResponseWrapperHelperImpl(HttpServletResponse httpServletResponse) {
+ super(httpServletResponse);
+ }
+
+
+ // from HttpServletResponseWrapper
+ public void sendError(int i, String string) throws IOException {
+ super.sendError(i, string);
+ status = i;
+ }
+
+ public void sendError(int i) throws IOException {
+ super.sendError(i);
+ status = i;
+ }
+
+ public void setStatus(int i) {
+ super.setStatus(i);
+ status = i;
+ }
+
+ public void setStatus(int i, String string) {
+ super.setStatus(i, string);
+ status = i;
+ }
+
+
+ public String toString() {
+ String result = null;
+ if (caw != null) {
+ result = caw.toString();
+ }
+ else if (tempOS != null) {
+ result = tempOS.toString();
+ }
+
+ return result;
+ }
+
+ public PrintWriter getWriter() throws IOException {
+ return getPw();
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException {
+ return getTempOS();
+ }
+
+ public void resetWriter() {
+ if (caw != null)
+ {
+ pw.flush();
+ caw.flush();
+ caw.reset();
+ }
+ }
+
+
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/pss/ViewHandlerResponseWrapperHelperImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ElementBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ElementBase.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ElementBase.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ElementBase.java Thu Jul 3 15:13:01 2008
@@ -1,27 +1,27 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.myfaces.config.element;
-
-/**
- * @author Martin Marinschek (latest modification by $Author: grantsmith $)
- * @version $Revision: 472618 $ $Date: 2006-11-08 21:06:54 +0100 (Mi, 08 Nov 2006) $
- */
-public interface ElementBase {
- public String getConfigLocation();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.config.element;
+
+/**
+ * @author Martin Marinschek (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472618 $ $Date: 2006-11-08 21:06:54 +0100 (Mi, 08 Nov 2006) $
+ */
+public interface ElementBase {
+ public String getConfigLocation();
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/element/ElementBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ElementBaseImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ElementBaseImpl.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ElementBaseImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ElementBaseImpl.java Thu Jul 3 15:13:01 2008
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.myfaces.config.impl.digester.elements;
-
-import org.apache.myfaces.config.element.ElementBase;
-
-/**
- * @author Martin Marinschek (latest modification by $Author: grantsmith $)
- * @version $Revision: 472618 $ $Date: 2006-11-08 21:06:54 +0100 (Mi, 08 Nov 2006) $
- */
-public class ElementBaseImpl implements ElementBase {
- private String configLocation;
-
- public void setConfigLocation(String configLocation) {
- this.configLocation = configLocation;
- }
-
- public String getConfigLocation() {
- return configLocation;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.myfaces.config.impl.digester.elements;
+
+import org.apache.myfaces.config.element.ElementBase;
+
+/**
+ * @author Martin Marinschek (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472618 $ $Date: 2006-11-08 21:06:54 +0100 (Mi, 08 Nov 2006) $
+ */
+public class ElementBaseImpl implements ElementBase {
+ private String configLocation;
+
+ public void setConfigLocation(String configLocation) {
+ this.configLocation = configLocation;
+ }
+
+ public String getConfigLocation() {
+ return configLocation;
+ }
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/ElementBaseImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/SavedRequestAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/SavedRequestAttributes.java?rev=673845&r1=673844&r2=673845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/SavedRequestAttributes.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/SavedRequestAttributes.java Thu Jul 3 15:13:01 2008
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-package org.apache.myfaces.portlet;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import javax.portlet.ActionRequest;
-import javax.portlet.RenderRequest;
-
-/**
- * This class saves the request attributes at the end of processAction.
- *
- * The attributes saved will be restored at the beginning of each render or
- * until the session times out. Some portlet containers don't do this
- * automatically, so it is done here.
- *
- * @author Stan Silvert
- */
-public class SavedRequestAttributes implements Serializable
-{
- private Map reqAttribs;
-
- /** Creates a new instance of SavedRequestAttributes */
- public SavedRequestAttributes()
- {
- }
-
- public synchronized void saveRequestAttributes(ActionRequest request)
- {
- this.reqAttribs = new HashMap();
- for (Enumeration i = request.getAttributeNames(); i.hasMoreElements();)
- {
- String name = (String)i.nextElement();
- reqAttribs.put(name, request.getAttribute(name));
- }
- }
-
- public synchronized void resotreRequestAttributes(RenderRequest request)
- {
- for (Iterator i = this.reqAttribs.keySet().iterator(); i.hasNext();)
- {
- String name = (String)i.next();
- Object attrib = request.getAttribute(name);
-
- // if somebody already set this attribute, don't overwrite
- if (attrib == null)
- {
- request.setAttribute(name, this.reqAttribs.get(name));
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.myfaces.portlet;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.portlet.ActionRequest;
+import javax.portlet.RenderRequest;
+
+/**
+ * This class saves the request attributes at the end of processAction.
+ *
+ * The attributes saved will be restored at the beginning of each render or
+ * until the session times out. Some portlet containers don't do this
+ * automatically, so it is done here.
+ *
+ * @author Stan Silvert
+ */
+public class SavedRequestAttributes implements Serializable
+{
+ private Map reqAttribs;
+
+ /** Creates a new instance of SavedRequestAttributes */
+ public SavedRequestAttributes()
+ {
+ }
+
+ public synchronized void saveRequestAttributes(ActionRequest request)
+ {
+ this.reqAttribs = new HashMap();
+ for (Enumeration i = request.getAttributeNames(); i.hasMoreElements();)
+ {
+ String name = (String)i.nextElement();
+ reqAttribs.put(name, request.getAttribute(name));
+ }
+ }
+
+ public synchronized void resotreRequestAttributes(RenderRequest request)
+ {
+ for (Iterator i = this.reqAttribs.keySet().iterator(); i.hasNext();)
+ {
+ String name = (String)i.next();
+ Object attrib = request.getAttribute(name);
+
+ // if somebody already set this attribute, don't overwrite
+ if (attrib == null)
+ {
+ request.setAttribute(name, this.reqAttribs.get(name));
+ }
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/SavedRequestAttributes.java
------------------------------------------------------------------------------
svn:eol-style = native