You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/03/22 23:31:20 UTC
svn commit: r1304107 - in /myfaces/orchestra/trunk/core20/src/main:
java/org/apache/myfaces/orchestra/requestParameterProvider/
java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/
resources/META-INF/
Author: lu4242
Date: Thu Mar 22 22:31:19 2012
New Revision: 1304107
URL: http://svn.apache.org/viewvc?rev=1304107&view=rev
Log:
ORCHESTRA-59 Orchestra does not work with JSF RI
Added:
myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/ (with props)
myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/ (with props)
myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java (with props)
myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java (with props)
Modified:
myfaces/orchestra/trunk/core20/src/main/resources/META-INF/faces-config.xml
Propchange: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java?rev=1304107&view=auto
==============================================================================
--- myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java (added)
+++ myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java Thu Mar 22 22:31:19 2012
@@ -0,0 +1,57 @@
+/*
+ * 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 java.util.List;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.ExternalContextWrapper;
+
+import org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterProviderManager;
+
+public class RequestParameterExternalContextWrapper extends ExternalContextWrapper
+{
+ private ExternalContext _delegate;
+
+ public RequestParameterExternalContextWrapper(ExternalContext delegate)
+ {
+ this._delegate = delegate;
+ }
+
+ @Override
+ public String encodeRedirectURL(String baseUrl,
+ Map<String, List<String>> parameters)
+ {
+ // Mojarra 2.1.3 does not call encodeURL internally, but MyFaces 2.0.x/2.1.x does.
+ // Anyway, the place to add Orchestra parameters for redirect should be here.
+ String url = super.encodeRedirectURL(baseUrl, parameters);
+ if (url != null)
+ {
+ url = RequestParameterProviderManager.getInstance().encodeAndAttachParameters(url);
+ }
+ return url;
+ }
+
+ @Override
+ public ExternalContext getWrapped()
+ {
+ return _delegate;
+ }
+}
Propchange: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java?rev=1304107&view=auto
==============================================================================
--- myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java (added)
+++ myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java Thu Mar 22 22:31:19 2012
@@ -0,0 +1,51 @@
+/*
+ * 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 javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.ExternalContextFactory;
+
+import org.apache.myfaces.orchestra.lib.jsf.ExternalContextUtils;
+
+
+public class RequestParameterExternalContextWrapperFactory extends ExternalContextFactory
+{
+ private ExternalContextFactory _delegate;
+
+ public RequestParameterExternalContextWrapperFactory(ExternalContextFactory delegate)
+ {
+ _delegate = delegate;
+ }
+
+ @Override
+ public ExternalContext getExternalContext(Object context, Object request,
+ Object response) throws FacesException
+ {
+ if (!ExternalContextUtils.getRequestType(context, request).isPortlet())
+ {
+ return new RequestParameterExternalContextWrapper(
+ _delegate.getExternalContext(context, request, response));
+ }
+ else
+ {
+ return _delegate.getExternalContext(context, request, response);
+ }
+ }
+}
Propchange: myfaces/orchestra/trunk/core20/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/jsf/RequestParameterExternalContextWrapperFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/orchestra/trunk/core20/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core20/src/main/resources/META-INF/faces-config.xml?rev=1304107&r1=1304106&r2=1304107&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core20/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/orchestra/trunk/core20/src/main/resources/META-INF/faces-config.xml Thu Mar 22 22:31:19 2012
@@ -44,6 +44,7 @@
</lifecycle>
<factory>
+ <external-context-factory>org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterExternalContextWrapperFactory</external-context-factory>
<faces-context-factory>org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory</faces-context-factory>
<faces-context-factory>org.apache.myfaces.orchestra.requestParameterProvider.jsf.RequestParameterFacesContextFactory</faces-context-factory>
</factory>