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 2008/09/20 01:33:41 UTC
svn commit: r697281 - in
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces:
custom/fileupload/ webapp/filter/ webapp/filter/portlet/
Author: lu4242
Date: Fri Sep 19 16:33:41 2008
New Revision: 697281
URL: http://svn.apache.org/viewvc?rev=697281&view=rev
Log:
MYFACES-434 MyFaces's Portlet enhancement (last feature left fileUpload support! ;-) )
Added:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java (with props)
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java (with props)
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java (with props)
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/UploadedFileDefaultFileImpl.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapperConfig.java
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/UploadedFileDefaultFileImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/UploadedFileDefaultFileImpl.java?rev=697281&r1=697280&r2=697281&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/UploadedFileDefaultFileImpl.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/UploadedFileDefaultFileImpl.java Fri Sep 19 16:33:41 2008
@@ -18,14 +18,14 @@
*/
package org.apache.myfaces.custom.fileupload;
-import org.apache.commons.fileupload.DefaultFileItem;
-import org.apache.commons.fileupload.FileItem;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+
/**
* @author Sylvain Vieujot (latest modification by $Author$)
@@ -34,14 +34,14 @@
public class UploadedFileDefaultFileImpl extends UploadedFileDefaultImplBase
{
private static final long serialVersionUID = -6401426361519246443L;
- private transient DefaultFileItem fileItem = null;
+ private transient DiskFileItem fileItem = null;
private StorageStrategy storageStrategy;
public UploadedFileDefaultFileImpl(final FileItem fileItem) throws IOException
{
super(fileItem.getName(), fileItem.getContentType());
- this.fileItem = (DefaultFileItem) fileItem;
- storageStrategy = new DiskStorageStrategy() {
+ this.fileItem = (DiskFileItem) fileItem;
+ storageStrategy = new DiskStorageStrategy() {
public File getTempFile() {
return UploadedFileDefaultFileImpl.this.fileItem.getStoreLocation();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapperConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapperConfig.java?rev=697281&r1=697280&r2=697281&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapperConfig.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/MultipartRequestWrapperConfig.java Fri Sep 19 16:33:41 2008
@@ -21,6 +21,8 @@
import javax.faces.context.ExternalContext;
import javax.servlet.ServletContext;
+import org.apache.myfaces.tomahawk.util.ExternalContextUtils;
+
/**
* This class is used to retrieve the context paramaters used to initialize
* of the MultipartRequestWrapper.
@@ -115,25 +117,51 @@
{
config = new MultipartRequestWrapperConfig();
- ServletContext servletContext = (ServletContext) context
- .getContext();
-
- String param = servletContext
- .getInitParameter(UPLOAD_MAX_FILE_SIZE);
-
- config._uploadMaxFileSize = resolveSize(param,
- config._uploadMaxFileSize);
-
- param = servletContext.getInitParameter(UPLOAD_THRESHOLD_SIZE);
-
- config._uploadThresholdSize = resolveSize(param,
- config._uploadThresholdSize);
-
- config._uploadRepositoryPath = servletContext
- .getInitParameter(UPLOAD_MAX_REPOSITORY_PATH);
+ if(!ExternalContextUtils.getRequestType(context).isPortlet())
+ {
+ ServletContext servletContext = (ServletContext) context
+ .getContext();
+
+ String param = servletContext
+ .getInitParameter(UPLOAD_MAX_FILE_SIZE);
+
+ config._uploadMaxFileSize = resolveSize(param,
+ config._uploadMaxFileSize);
+
+ param = servletContext.getInitParameter(UPLOAD_THRESHOLD_SIZE);
+
+ config._uploadThresholdSize = resolveSize(param,
+ config._uploadThresholdSize);
+
+ config._uploadRepositoryPath = servletContext
+ .getInitParameter(UPLOAD_MAX_REPOSITORY_PATH);
+
+ context.getApplicationMap().put(MULTIPART_REQUEST_WRAPPER_CONFIG,
+ config);
+ }
+ else
+ {
+ Object portletContext = context.getContext();
- context.getApplicationMap().put(MULTIPART_REQUEST_WRAPPER_CONFIG,
- config);
+ String param = PortletUtils.getContextInitParameter(
+ portletContext, UPLOAD_MAX_FILE_SIZE);
+
+ config._uploadMaxFileSize = resolveSize(param,
+ config._uploadMaxFileSize);
+
+ param = PortletUtils.getContextInitParameter(
+ portletContext, UPLOAD_THRESHOLD_SIZE);
+
+ config._uploadThresholdSize = resolveSize(param,
+ config._uploadThresholdSize);
+
+ config._uploadRepositoryPath = PortletUtils.getContextInitParameter(
+ portletContext,UPLOAD_MAX_REPOSITORY_PATH);
+
+ context.getApplicationMap().put(MULTIPART_REQUEST_WRAPPER_CONFIG,
+ config);
+
+ }
}
return config;
Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java?rev=697281&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java Fri Sep 19 16:33:41 2008
@@ -0,0 +1,243 @@
+/*
+ * 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.webapp.filter;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadBase;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.webapp.filter.portlet.ActionRequestWrapper;
+
+/**
+ * @since 1.1.8
+ * @author Sylvain Vieujot (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class PortletMultipartRequestWrapper
+ extends ActionRequestWrapper
+{
+ private static Log log = LogFactory.getLog(PortletMultipartRequestWrapper.class);
+ public static final String UPLOADED_FILES_ATTRIBUTE = "org.apache.myfaces.uploadedFiles";
+ public static final String WWW_FORM_URLENCODED_TYPE = "application/x-www-form-urlencoded";
+
+ ActionRequest request = null;
+ HashMap parametersMap = null;
+ PortletFileUpload fileUpload = null;
+ HashMap fileItems = null;
+ int maxSize;
+ int thresholdSize;
+ String repositoryPath;
+
+ public PortletMultipartRequestWrapper(Object request,
+ int maxSize, int thresholdSize,
+ String repositoryPath){
+ super((ActionRequest) request );
+ this.request = (ActionRequest) request;
+ this.maxSize = maxSize;
+ this.thresholdSize = thresholdSize;
+ this.repositoryPath = repositoryPath;
+ }
+
+ private void parseRequest() {
+ fileUpload = new PortletFileUpload();
+
+ fileUpload.setSizeMax(maxSize);
+
+ //fileUpload.setSizeThreshold(thresholdSize);
+
+ if(repositoryPath != null && repositoryPath.trim().length()>0)
+ {
+ //fileUpload.setRepositoryPath(repositoryPath);
+ fileUpload.setFileItemFactory(
+ new DiskFileItemFactory(thresholdSize,
+ new File(repositoryPath)));
+ }
+ else
+ {
+ fileUpload.setFileItemFactory(
+ new DiskFileItemFactory(thresholdSize,
+ new File(System.getProperty("java.io.tmpdir"))));
+ System.out.println("TEMP DIR:"+ new File(System.getProperty("java.io.tmpdir")));
+ }
+
+ String charset = request.getCharacterEncoding();
+ fileUpload.setHeaderEncoding(charset);
+
+
+ List requestParameters = null;
+ try{
+ requestParameters = fileUpload.parseRequest(request);
+ } catch (FileUploadBase.SizeLimitExceededException e) {
+
+ request.setAttribute(
+ "org.apache.myfaces.custom.fileupload.exception","sizeLimitExceeded");
+ request.setAttribute("org.apache.myfaces.custom.fileupload.maxSize",
+ new Integer(maxSize));
+
+ requestParameters = Collections.EMPTY_LIST;
+
+ }catch(FileUploadException fue){
+ log.error("Exception while uploading file.", fue);
+ requestParameters = Collections.EMPTY_LIST;
+ }
+
+ parametersMap = new HashMap( requestParameters.size() );
+ fileItems = new HashMap();
+
+ for (Iterator iter = requestParameters.iterator(); iter.hasNext(); ){
+ FileItem fileItem = (FileItem) iter.next();
+
+ if (fileItem.isFormField()) {
+ String name = fileItem.getFieldName();
+
+ // The following code avoids commons-fileupload charset problem.
+ // After fixing commons-fileupload, this code should be
+ //
+ // String value = fileItem.getString();
+ //
+ String value = null;
+ if ( charset == null) {
+ value = fileItem.getString();
+ } else {
+ try {
+ value = new String(fileItem.get(), charset);
+ } catch (UnsupportedEncodingException e){
+ value = fileItem.getString();
+ }
+ }
+
+ addTextParameter(name, value);
+ } else { // fileItem is a File
+ if (fileItem.getName() != null) {
+ fileItems.put(fileItem.getFieldName(), fileItem);
+ }
+ }
+ }
+
+ //Add the query string paramters
+ for (Iterator it = request.getParameterMap().entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+
+ Object value = entry.getValue();
+
+ if(value instanceof String[])
+ {
+ String[] valuesArray = (String[])entry.getValue();
+ for (int i = 0; i < valuesArray.length; i++)
+ {
+ addTextParameter((String)entry.getKey(), valuesArray[i]);
+ }
+ }
+ else if(value instanceof String)
+ {
+ String strValue = (String)entry.getValue();
+ addTextParameter((String)entry.getKey(), strValue);
+ }
+ else if(value != null)
+ throw new IllegalStateException("value of type : "+value.getClass()+" for key : "+
+ entry.getKey()+" cannot be handled.");
+
+ }
+ }
+
+ private void addTextParameter(String name, String value){
+ if( ! parametersMap.containsKey( name ) ){
+ String[] valuesArray = {value};
+ parametersMap.put(name, valuesArray);
+ }else{
+ String[] storedValues = (String[])parametersMap.get( name );
+ int lengthSrc = storedValues.length;
+ String[] valuesArray = new String[lengthSrc+1];
+ System.arraycopy(storedValues, 0, valuesArray, 0, lengthSrc);
+ valuesArray[lengthSrc] = value;
+ parametersMap.put(name, valuesArray);
+ }
+ }
+
+ public Enumeration getParameterNames() {
+ if( parametersMap == null ) parseRequest();
+
+ return Collections.enumeration( parametersMap.keySet() );
+ }
+
+ public String getParameter(String name) {
+ if( parametersMap == null ) parseRequest();
+
+ String[] values = (String[])parametersMap.get( name );
+ if( values == null )
+ return null;
+ return values[0];
+ }
+
+ public String[] getParameterValues(String name) {
+ if( parametersMap == null ) parseRequest();
+
+ return (String[])parametersMap.get( name );
+ }
+
+ public Map getParameterMap() {
+ if( parametersMap == null ) parseRequest();
+
+ return parametersMap;
+ }
+
+ // Hook for the x:inputFileUpload tag.
+ public FileItem getFileItem(String fieldName) {
+ if( fileItems == null ) parseRequest();
+
+ return (FileItem) fileItems.get( fieldName );
+ }
+
+ /**
+ * Not used internally by MyFaces, but provides a way to handle the uploaded files
+ * out of MyFaces.
+ */
+ public Map getFileItems(){
+ if( fileItems == null ) parseRequest();
+ return fileItems;
+ }
+
+
+ public Object getAttribute(String string) {
+ if (string.equals(UPLOADED_FILES_ATTRIBUTE)) {
+ return getFileItems();
+ }
+ return super.getAttribute(string);
+ }
+
+ public String getContentType()
+ {
+ return WWW_FORM_URLENCODED_TYPE;
+ }
+}
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/PortletMultipartRequestWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java?rev=697281&r1=697280&r2=697281&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/TomahawkFacesContextWrapper.java Fri Sep 19 16:33:41 2008
@@ -38,6 +38,7 @@
import org.apache.myfaces.renderkit.html.util.AddResource;
import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
import org.apache.myfaces.tomahawk.util.ExternalContextUtils;
+import org.apache.myfaces.webapp.filter.portlet.PortletExternalContextWrapper;
import org.apache.myfaces.webapp.filter.servlet.ServletExternalContextWrapper;
/**
@@ -61,16 +62,32 @@
this.delegate = delegate;
if(ExternalContextUtils.getRequestType(delegate.getExternalContext()).isPortlet()) {
- //todo do something here - with the multipart-wrapper. rest should be fine
- //javax.portlet.PortletRequest portletRequest = (javax.portlet.PortletRequest) delegate.getExternalContext().getRequest();
- //Object portletResponse = delegate.getExternalContext().getResponse();
- //Object portletRequest = delegate.getExternalContext().getRequest();
+ Object portletResponse = delegate.getExternalContext().getResponse();
+ Object portletRequest = delegate.getExternalContext().getRequest();
- //Object extendedRequest = portletRequest;
- //Object extendedResponse = portletResponse;
+ Object extendedRequest = portletRequest;
+ Object extendedResponse = portletResponse;
- //boolean multipartContent = false;
+ // For multipart/form-data requests we need to encapsulate
+ // the request using PortletMultipartRequestWrapper. This could not be
+ // done on TomahawkFacesContextFactory.getFacesContext(...)
+ // because we need an ExternalContext instance to get
+ // the init params for the ExtensionsFilter and initialize
+ // MultipartRequestWrapper with the correct values.
+
+ boolean multipartContent = false;
+
+ if (PortletUtils.isMultipartContent(portletRequest))
+ {
+ multipartContent = true;
+ MultipartRequestWrapperConfig config = MultipartRequestWrapperConfig
+ .getMultipartRequestWrapperConfig(delegate
+ .getExternalContext());
+
+ extendedRequest = new PortletMultipartRequestWrapper( portletRequest, config.getUploadMaxFileSize(),
+ config.getUploadThresholdSize(), config.getUploadRepositoryPath());
+ }
AddResource addResource= AddResourceFactory.getInstance(this);
addResource.responseStarted();
@@ -82,8 +99,8 @@
" org.apache.myfaces.renderkit.html.util.NonBufferingAddResource.");
}
- //externalContextDelegate = new PortletExternalContextWrapper(
- // delegate.getExternalContext(), extendedRequest, extendedResponse, multipartContent);
+ externalContextDelegate = new PortletExternalContextWrapper(
+ delegate.getExternalContext(), extendedRequest, extendedResponse, multipartContent);
}
else {
HttpServletResponse httpResponse = (HttpServletResponse) delegate.getExternalContext().getResponse();
Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java?rev=697281&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java Fri Sep 19 16:33:41 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.webapp.filter.portlet;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletRequest;
+
+
+public class ActionRequestWrapper extends PortletRequestWrapper
+ implements ActionRequest
+{
+
+ public ActionRequestWrapper(PortletRequest request)
+ {
+ super(request);
+ }
+
+ private ActionRequest _getActionRequest()
+ {
+ return (ActionRequest)super.getRequest();
+ }
+
+ public String getCharacterEncoding()
+ {
+ return _getActionRequest().getCharacterEncoding();
+ }
+
+ public int getContentLength()
+ {
+ return _getActionRequest().getContentLength();
+ }
+
+ public String getContentType()
+ {
+ return _getActionRequest().getContentType();
+ }
+
+ public InputStream getPortletInputStream() throws IOException
+ {
+ return _getActionRequest().getPortletInputStream();
+ }
+
+ public BufferedReader getReader() throws UnsupportedEncodingException,
+ IOException
+ {
+ return _getActionRequest().getReader();
+ }
+
+ public void setCharacterEncoding(String s)
+ throws UnsupportedEncodingException
+ {
+ _getActionRequest().setCharacterEncoding(s);
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/ActionRequestWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java?rev=697281&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java Fri Sep 19 16:33:41 2008
@@ -0,0 +1,236 @@
+/*
+ * 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.webapp.filter.portlet;
+
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.WindowState;
+import javax.servlet.ServletResponse;
+
+public class PortletRequestWrapper implements PortletRequest
+{
+
+ public PortletRequestWrapper(PortletRequest request)
+ {
+ if(request == null)
+ {
+ throw new IllegalArgumentException("Request cannot be null");
+ } else
+ {
+ this.request = request;
+ return;
+ }
+ }
+ public PortletRequest getRequest()
+ {
+ return request;
+ }
+
+ public void setRequest(PortletRequest response)
+ {
+ if(response == null)
+ {
+ throw new IllegalArgumentException("Response cannot be null");
+ } else
+ {
+ this.request = response;
+ return;
+ }
+ }
+
+ private PortletRequest request;
+
+ public Object getAttribute(String s)
+ {
+ return request.getAttribute(s);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return request.getAttributeNames();
+ }
+
+ public String getAuthType()
+ {
+ return request.getAuthType();
+ }
+
+ public String getContextPath()
+ {
+ return request.getContextPath();
+ }
+
+ public Locale getLocale()
+ {
+ return request.getLocale();
+ }
+
+ public Enumeration getLocales()
+ {
+ return request.getLocales();
+ }
+
+ public String getParameter(String s)
+ {
+ return request.getParameter(s);
+ }
+
+ public Map getParameterMap()
+ {
+ return request.getParameterMap();
+ }
+
+ public Enumeration getParameterNames()
+ {
+ return request.getParameterNames();
+ }
+
+ public String[] getParameterValues(String s)
+ {
+ return request.getParameterValues(s);
+ }
+
+ public PortalContext getPortalContext()
+ {
+ return request.getPortalContext();
+ }
+
+ public PortletMode getPortletMode()
+ {
+ return request.getPortletMode();
+ }
+
+ public PortletSession getPortletSession()
+ {
+ return request.getPortletSession();
+ }
+
+ public PortletSession getPortletSession(boolean flag)
+ {
+ return request.getPortletSession(flag);
+ }
+
+ public PortletPreferences getPreferences()
+ {
+ return request.getPreferences();
+ }
+
+ public Enumeration getProperties(String s)
+ {
+ return request.getProperties(s);
+ }
+
+ public String getProperty(String s)
+ {
+ return request.getProperty(s);
+ }
+
+ public Enumeration getPropertyNames()
+ {
+ return request.getPropertyNames();
+ }
+
+ public String getRemoteUser()
+ {
+ return request.getRemoteUser();
+ }
+
+ public String getRequestedSessionId()
+ {
+ return request.getRequestedSessionId();
+ }
+
+ public String getResponseContentType()
+ {
+ return request.getResponseContentType();
+ }
+
+ public Enumeration getResponseContentTypes()
+ {
+ return request.getResponseContentTypes();
+ }
+
+ public String getScheme()
+ {
+ return request.getScheme();
+ }
+
+ public String getServerName()
+ {
+ return request.getServerName();
+ }
+
+ public int getServerPort()
+ {
+ return request.getServerPort();
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return request.getUserPrincipal();
+ }
+
+ public WindowState getWindowState()
+ {
+ return request.getWindowState();
+ }
+
+ public boolean isPortletModeAllowed(PortletMode portletmode)
+ {
+ return request.isPortletModeAllowed(portletmode);
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ return request.isRequestedSessionIdValid();
+ }
+
+ public boolean isSecure()
+ {
+ return request.isSecure();
+ }
+
+ public boolean isUserInRole(String s)
+ {
+ return request.isUserInRole(s);
+ }
+
+ public boolean isWindowStateAllowed(WindowState windowstate)
+ {
+ return request.isWindowStateAllowed(windowstate);
+ }
+
+ public void removeAttribute(String s)
+ {
+ request.removeAttribute(s);
+ }
+
+ public void setAttribute(String s, Object obj)
+ {
+ request.setAttribute(s, obj);
+ }
+}
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/webapp/filter/portlet/PortletRequestWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL