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 2011/03/16 03:24:59 UTC
svn commit: r1082029 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
Author: lu4242
Date: Wed Mar 16 02:24:59 2011
New Revision: 1082029
URL: http://svn.apache.org/viewvc?rev=1082029&view=rev
Log:
MYFACES-3042 CCE: when running in portlet: Remove Servlet dependencies in FaceletViewDeclarationLanguage.java (thanks to Michael Freedman for provide this patch)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=1082029&r1=1082028&r2=1082029&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Wed Mar 16 02:24:59 2011
@@ -80,8 +80,6 @@ import javax.faces.view.ViewMetadata;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.ResourceResolver;
import javax.faces.view.facelets.TagDecorator;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
@@ -1549,12 +1547,10 @@ public class FaceletViewDeclarationLangu
throw new IllegalStateException("No render kit was available for id \"" + id + "\"");
}
- ServletResponse response = (ServletResponse) extContext.getResponse();
-
// set the buffer for content
if (_bufferSize != -1)
{
- response.setBufferSize(_bufferSize);
+ extContext.setResponseBufferSize(_bufferSize);
}
// get our content type
@@ -1594,13 +1590,13 @@ public class FaceletViewDeclarationLangu
encoding = getResponseEncoding(context, writer.getCharacterEncoding());
// apply them to the response
- response.setContentType(contentType + "; charset=" + encoding);
+ extContext.setResponseContentType(contentType + "; charset=" + encoding);
// removed 2005.8.23 to comply with J2EE 1.3
// response.setCharacterEncoding(encoding);
// Now, clone with the real writer
- writer = writer.cloneWithWriter(response.getWriter());
+ writer = writer.cloneWithWriter(extContext.getResponseOutputWriter());
return writer;
}
@@ -1701,9 +1697,9 @@ public class FaceletViewDeclarationLangu
// 2. get it from request
Object request = context.getExternalContext().getRequest();
- if (encoding == null && request instanceof ServletRequest)
+ if (encoding == null)
{
- encoding = ((ServletRequest) request).getCharacterEncoding();
+ encoding = context.getExternalContext().getRequestCharacterEncoding();
}
// 3. get it from the session
@@ -1732,13 +1728,9 @@ public class FaceletViewDeclarationLangu
protected void handleFaceletNotFound(FacesContext context, String viewId) throws FacesException, IOException
{
String actualId = context.getApplication().getViewHandler().getActionURL(context, viewId);
- Object respObj = context.getExternalContext().getResponse();
- if (respObj instanceof HttpServletResponse)
- {
- HttpServletResponse respHttp = (HttpServletResponse) respObj;
- respHttp.sendError(HttpServletResponse.SC_NOT_FOUND, actualId);
- context.responseComplete();
- }
+ context.getExternalContext().responseSendError(HttpServletResponse.SC_NOT_FOUND, actualId);
+ context.responseComplete();
+
}
protected void handleRenderException(FacesContext context, Exception e)
@@ -1893,12 +1885,10 @@ public class FaceletViewDeclarationLangu
@Override
protected void sendSourceNotFound(FacesContext context, String message)
{
- // This is incredibly lame, but I see no other option. -= SL =-
- HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
try
{
context.responseComplete();
- response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
+ context.getExternalContext().responseSendError(HttpServletResponse.SC_NOT_FOUND, message);
}
catch (IOException ioe)
{