You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/08/19 12:20:44 UTC
svn commit: r567382 - in /myfaces/orchestra/trunk:
core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/
core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/
core15/src/test/java/org/apache/myfaces/orchestra/framewo...
Author: imario
Date: Sun Aug 19 03:20:40 2007
New Revision: 567382
URL: http://svn.apache.org/viewvc?view=rev&rev=567382
Log:
fixed wrong method-name
Added:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterFacesContextFactory.java
Modified:
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java
myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java
Added: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterFacesContextFactory.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterFacesContextFactory.java?view=auto&rev=567382
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterFacesContextFactory.java (added)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterFacesContextFactory.java Sun Aug 19 03:20:40 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.orchestra.requestParameterProvider.jsf;
+
+import org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterResponseWrapper;
+import org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterServletFilter;
+
+import javax.faces.context.FacesContextFactory;
+import javax.faces.context.FacesContext;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.FacesException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p/>
+ * This factory wraps each {@link javax.servlet.http.HttpServletResponse} in a {@link org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterResponseWrapper},
+ * meaning that every call to response.encodeURL() gets forwarded to the RequestParameterProviderManager.
+ * </p>
+ * <p/>
+ * If you have to deal with a mixed environment e.g. JSP/JSF it would be better to use the
+ * {@link org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterServletFilter}
+ * </p>
+ */
+public class RequestParameterFacesContextFactory extends FacesContextFactory
+{
+ private final FacesContextFactory original;
+
+ public RequestParameterFacesContextFactory(FacesContextFactory original)
+ {
+ this.original = original;
+ }
+
+ public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException
+ {
+ if (response instanceof HttpServletResponse)
+ {
+ HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+ if (!Boolean.TRUE.equals(httpServletRequest.getAttribute(RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED)))
+ {
+ httpServletRequest.setAttribute(RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED, Boolean.TRUE);
+ response = new RequestParameterResponseWrapper((HttpServletResponse) response);
+ }
+ }
+
+ return original.getFacesContext(context, request, response, lifecycle);
+ }
+}
Modified: myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java?view=diff&rev=567382&r1=567381&r2=567382
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java Sun Aug 19 03:20:40 2007
@@ -43,7 +43,7 @@
public static MockFrameworkAdapter register()
{
MockFrameworkAdapter instance = new MockFrameworkAdapter();
- FrameworkAdapter.setFrameworkAdapter(instance);
+ FrameworkAdapter.setInstance(instance);
return instance;
}
Modified: myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java?view=diff&rev=567382&r1=567381&r2=567382
==============================================================================
--- myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java Sun Aug 19 03:20:40 2007
@@ -43,7 +43,7 @@
public static MockFrameworkAdapter register()
{
MockFrameworkAdapter instance = new MockFrameworkAdapter();
- FrameworkAdapter.setFrameworkAdapter(instance);
+ FrameworkAdapter.setInstance(instance);
return instance;
}