You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2011/10/25 15:13:10 UTC
svn commit: r1188643 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application: ./
jsp/
Author: struberg
Date: Tue Oct 25 13:13:09 2011
New Revision: 1188643
URL: http://svn.apache.org/viewvc?rev=1188643&view=rev
Log:
MYFACES-3368 checkstyle fixes
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/StateManagerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletRequest.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletResponse.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java Tue Oct 25 13:13:09 2011
@@ -77,11 +77,16 @@ public class ActionListenerImpl implemen
}
catch (ELException e)
{
- // "... If that fails for any reason, throw an AbortProcessingException, including the cause of the failure ..."
- // -= Leonardo Uribe =- after discussing this topic on MYFACES-3199, the conclusion is the part is an advice
- // for the developer implementing a listener in a method expressions that could be wrapped by this class.
- // The spec wording is poor but, to keep this coherently with ExceptionHandler API, the spec and code on UIViewRoot we need:
- // 2a) "exception is instance of APE or any of the causes of the exception are an APE,
+ // "... If that fails for any reason, throw an AbortProcessingException,
+ // including the cause of the failure ..."
+ // -= Leonardo Uribe =- after discussing this topic on MYFACES-3199,
+ // the conclusion is the part is an advice
+ // for the developer implementing a listener in a method expressions
+ // that could be wrapped by this class.
+ // The spec wording is poor but, to keep this coherently with
+ // ExceptionHandler API, the spec and code on UIViewRoot we need:
+ // 2a) "exception is instance of APE or any of the causes of
+ // the exception are an APE,
// DON'T publish ExceptionQueuedEvent and terminate processing for current event".
// 2b) for any other exception publish ExceptionQueuedEvent and continue broadcast processing.
Throwable cause = e.getCause();
@@ -111,15 +116,18 @@ public class ActionListenerImpl implemen
// Since this ActionListener is the one who handles navigation, if we have another different exception
// here we can't queue it on ExceptionHandler stack, instead throw it as a FacesException.
- throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e);
+ throw new FacesException("Error calling action method of component with id "
+ + actionEvent.getComponent().getClientId(facesContext), e);
}
catch (RuntimeException e)
{
- throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e);
+ throw new FacesException("Error calling action method of component with id "
+ + actionEvent.getComponent().getClientId(facesContext), e);
}
}
- else if (methodBinding != null) {
+ else if (methodBinding != null)
+ {
fromAction = methodBinding.getExpressionString();
try
{
@@ -138,12 +146,14 @@ public class ActionListenerImpl implemen
throw (AbortProcessingException)cause;
}
- throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e);
+ throw new FacesException("Error calling action method of component with id "
+ + actionEvent.getComponent().getClientId(facesContext), e);
}
catch (RuntimeException e)
{
- throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e);
+ throw new FacesException("Error calling action method of component with id "
+ + actionEvent.getComponent().getClientId(facesContext), e);
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java Tue Oct 25 13:13:09 2011
@@ -177,13 +177,15 @@ public class ApplicationImpl extends App
// synchronize, uses ConcurrentHashMap to allow concurrent read of map
private final Map<String, Object> _converterIdToClassMap = new ConcurrentHashMap<String, Object>();
- private final Map<Class<?>, Object> _converterTargetClassToConverterClassMap = new ConcurrentHashMap<Class<?>, Object>();
+ private final Map<Class<?>, Object> _converterTargetClassToConverterClassMap
+ = new ConcurrentHashMap<Class<?>, Object>();
private final Map<String, Object> _componentClassMap = new ConcurrentHashMap<String, Object>();
private final Map<String, Object> _validatorClassMap = new ConcurrentHashMap<String, Object>();
- private final Map<Class<? extends SystemEvent>, SystemListenerEntry> _systemEventListenerClassMap = new ConcurrentHashMap<Class<? extends SystemEvent>, SystemListenerEntry>();
+ private final Map<Class<? extends SystemEvent>, SystemListenerEntry> _systemEventListenerClassMap
+ = new ConcurrentHashMap<Class<? extends SystemEvent>, SystemListenerEntry>();
private final Map<String, String> _defaultValidatorsIds = new HashMap<String, String>();
@@ -201,8 +203,11 @@ public class ApplicationImpl extends App
private volatile boolean _firstRequestProcessed = false;
- private final Map<Class<?>, List<ListenerFor>> _classToListenerForMap = new HashMap<Class<?>, List<ListenerFor>>() ;
- private final Map<Class<?>, List<ResourceDependency>> _classToResourceDependencyMap = new HashMap<Class<?>, List<ResourceDependency>>() ;
+ private final Map<Class<?>, List<ListenerFor>> _classToListenerForMap
+ = new HashMap<Class<?>, List<ListenerFor>>() ;
+
+ private final Map<Class<?>, List<ResourceDependency>> _classToResourceDependencyMap
+ = new HashMap<Class<?>, List<ResourceDependency>>() ;
private List<Class<? extends Converter>> _noArgConstructorConverterClasses
= new ArrayList<Class<? extends Converter>>();
@@ -259,7 +264,8 @@ public class ApplicationImpl extends App
log.finest("New Application instance created");
}
- String configParam = getFaceContext().getExternalContext().getInitParameter(DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME);
+ String configParam = getFaceContext().getExternalContext().
+ getInitParameter(DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME);
if (configParam != null && configParam.toLowerCase().equals("true"))
{
_dateTimeConverterDefaultTimeZoneIsSystemTimeZone = true;
@@ -398,7 +404,8 @@ public class ApplicationImpl extends App
}
catch (MissingResourceException e1)
{
- throw new FacesException("Could not load resource bundle for name '" + name + "': " + e.getMessage(), e1);
+ throw new FacesException("Could not load resource bundle for name '"
+ + name + "': " + e.getMessage(), e1);
}
}
}
@@ -519,7 +526,8 @@ public class ApplicationImpl extends App
}
@Override
- public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> systemEventClass, Class<?> sourceBaseType, Object source)
+ public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> systemEventClass,
+ Class<?> sourceBaseType, Object source)
{
checkNull(systemEventClass, "systemEventClass");
checkNull(source, "source");
@@ -774,7 +782,8 @@ public class ApplicationImpl extends App
//On Google App Engine, javax.naming.Context is a restricted class.
//In that case, NoClassDefFoundError is thrown. stageName needs to be configured
//below by context parameter.
- //It can be done with changing the order to look first at context param, but it is defined in the spec.
+ //It can be done with changing the order to look first at
+ // context param, but it is defined in the spec.
//http://java.sun.com/javaee/6/docs/api/javax/faces/application/Application.html#getProjectStage()
//no-op
}
@@ -843,7 +852,8 @@ public class ApplicationImpl extends App
if(isFirstRequestProcessed())
{
- throw new IllegalStateException("setResourceHandler may not be executed after a lifecycle request has been completed");
+ throw new IllegalStateException(
+ "setResourceHandler may not be executed after a lifecycle request has been completed");
}
_resourceHandler = resourceHandler;
}
@@ -917,7 +927,8 @@ public class ApplicationImpl extends App
if(isFirstRequestProcessed())
{
- throw new IllegalStateException("setViewHandler may not be executed after a lifecycle request has been completed");
+ throw new IllegalStateException(
+ "setViewHandler may not be executed after a lifecycle request has been completed");
}
_viewHandler = viewHandler;
if (log.isLoggable(Level.FINEST))
@@ -1084,7 +1095,8 @@ public class ApplicationImpl extends App
}
else
{
- _converterTargetClassToConverterClassMap.put(targetClass, ClassUtils.simpleClassForName(converterClass));
+ _converterTargetClassToConverterClassMap.put(targetClass,
+ ClassUtils.simpleClassForName(converterClass));
}
if (log.isLoggable(Level.FINEST))
@@ -1186,7 +1198,8 @@ public class ApplicationImpl extends App
*/
UIViewRoot view = context.getViewRoot();
Application application = context.getApplication();
- ViewDeclarationLanguage vdl = application.getViewHandler().getViewDeclarationLanguage(context, view.getViewId());
+ ViewDeclarationLanguage vdl
+ = application.getViewHandler().getViewDeclarationLanguage(context, view.getViewId());
/*
* Obtain a reference to the composite component metadata for this composite component by calling
@@ -1251,27 +1264,32 @@ public class ApplicationImpl extends App
String className = name.substring(0, name.lastIndexOf('.'));
fqcn = componentResource.getLibraryName() + "." + className;
- if (isProduction) {
+ if (isProduction)
+ {
componentClass = (Class<? extends UIComponent>) _componentClassMap.get(fqcn);
}
- if (componentClass == null) {
+ if (componentClass == null)
+ {
try
{
componentClass = ClassUtils.classForName(fqcn);
- if (isProduction) {
+ if (isProduction)
+ {
_componentClassMap.put(fqcn, componentClass);
}
}
catch (ClassNotFoundException e)
{
// Remember here that classForName did not find Class
- if (isProduction) {
+ if (isProduction)
+ {
_componentClassMap.put(fqcn, NOTHING.getClass());
}
}
}
- if (componentClass != null && NOTHING.getClass() != componentClass) {
+ if (componentClass != null && NOTHING.getClass() != componentClass)
+ {
try
{
component = componentClass.newInstance();
@@ -1485,7 +1503,8 @@ public class ApplicationImpl extends App
// Get EnumConverter for enum classes with no special converter, check
// here as recursive call with java.lang.Enum will not work
- if (converterClassOrClassName == null && targetClass.isEnum()) {
+ if (converterClassOrClassName == null && targetClass.isEnum())
+ {
converterClassOrClassName = _converterTargetClassToConverterClassMap.get(Enum.class);
}
@@ -1625,7 +1644,8 @@ public class ApplicationImpl extends App
private void _handleAttachedResourceDependencyAnnotations(FacesContext context, Object inspected)
{
- if (inspected == null) {
+ if (inspected == null)
+ {
return;
}
@@ -1670,7 +1690,8 @@ public class ApplicationImpl extends App
String name = annotation.name();
if (name != null && name.length() > 0)
{
- name = ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
+ name = ELText.parse(getExpressionFactory(),
+ context.getELContext(), name).toString(context.getELContext());
}
// Obtain the renderer-type for the resource name by passing name to
@@ -1690,7 +1711,8 @@ public class ApplicationImpl extends App
String library = annotation.library();
if (library != null && library.length() > 0)
{
- library = ELText.parse(getExpressionFactory(), context.getELContext(), library).toString(context.getELContext());
+ library = ELText.parse(getExpressionFactory(),
+ context.getELContext(), library).toString(context.getELContext());
// If library is non-null, store it under the key "library".
attributes.put("library", library);
}
@@ -1699,7 +1721,8 @@ public class ApplicationImpl extends App
String target = annotation.target();
if (target != null && target.length() > 0)
{
- target = ELText.parse(getExpressionFactory(), context.getELContext(), target).toString(context.getELContext());
+ target = ELText.parse(getExpressionFactory(),
+ context.getELContext(), target).toString(context.getELContext());
// If target is non-null, store it under the key "target".
attributes.put("target", target);
context.getViewRoot().addComponentResource(context, output, target);
@@ -1835,7 +1858,8 @@ public class ApplicationImpl extends App
if(isFirstRequestProcessed())
{
- throw new IllegalStateException("setStateManager may not be executed after a lifecycle request has been completed");
+ throw new IllegalStateException(
+ "setStateManager may not be executed after a lifecycle request has been completed");
}
_stateManager = stateManager;
@@ -1903,7 +1927,8 @@ public class ApplicationImpl extends App
_handleResourceDependencyAnnotations(context, inspectedClass, component, isProduction);
}
- private void _handleListenerForAnnotations(FacesContext context, Object inspected, Class<?> inspectedClass, UIComponent component, boolean isProduction)
+ private void _handleListenerForAnnotations(FacesContext context, Object inspected, Class<?> inspectedClass,
+ UIComponent component, boolean isProduction)
{
List<ListenerFor> listenerForList = null;
boolean isCachedList = false;
@@ -1951,7 +1976,8 @@ public class ApplicationImpl extends App
if(isProduction && !isCachedList) //if we're in production and the list is not yet cached, store it
{
- _classToListenerForMap.put(inspectedClass, listenerForList); //null value stored for listenerForList means no annotations were found
+ //null value stored for listenerForList means no annotations were found
+ _classToListenerForMap.put(inspectedClass, listenerForList);
}
}
@@ -2021,10 +2047,12 @@ public class ApplicationImpl extends App
}
}
- private void _handleResourceDependencyAnnotations(FacesContext context, Class<?> inspectedClass, UIComponent component, boolean isProduction)
+ private void _handleResourceDependencyAnnotations(FacesContext context, Class<?> inspectedClass,
+ UIComponent component, boolean isProduction)
{
// This and only this method handles @ResourceDependency and @ResourceDependencies annotations
- // The source of these annotations is Class<?> inspectedClass. Because Class<?> and its annotations cannot change
+ // The source of these annotations is Class<?> inspectedClass.
+ // Because Class<?> and its annotations cannot change
// during request/response, it is sufficient to process Class<?> only once per view.
RequestViewContext rvc = RequestViewContext.getCurrentInstance(context);
if (rvc.isClassAlreadyProcessed(inspectedClass))
@@ -2084,10 +2112,12 @@ public class ApplicationImpl extends App
if(isProduction && !isCachedList) //if we're in production and the list is not yet cached, store it
{
- _classToResourceDependencyMap.put(inspectedClass, dependencyList); //null value stored for dependencyList means no annotations were found
+ //null value stored for dependencyList means no annotations were found
+ _classToResourceDependencyMap.put(inspectedClass, dependencyList);
}
- if (!classAlreadyProcessed) {
+ if (!classAlreadyProcessed)
+ {
rvc.setClassProcessed(inspectedClass);
}
}
@@ -2106,7 +2136,8 @@ public class ApplicationImpl extends App
String name = annotation.name();
if (name != null && name.length() > 0)
{
- name = ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
+ name = ELText.parse(getExpressionFactory(),
+ context.getELContext(), name).toString(context.getELContext());
}
// Obtain the renderer-type for the resource name by passing name to
@@ -2127,7 +2158,8 @@ public class ApplicationImpl extends App
String library = annotation.library();
if (library != null && library.length() > 0)
{
- library = ELText.parse(getExpressionFactory(), context.getELContext(), library).toString(context.getELContext());
+ library = ELText.parse(getExpressionFactory(),
+ context.getELContext(), library).toString(context.getELContext());
// If library is non-null, store it under the key "library".
if ("this".equals(library))
{
@@ -2148,7 +2180,8 @@ public class ApplicationImpl extends App
String target = annotation.target();
if (target != null && target.length() > 0)
{
- target = ELText.parse(getExpressionFactory(), context.getELContext(), target).toString(context.getELContext());
+ target = ELText.parse(getExpressionFactory(),
+ context.getELContext(), target).toString(context.getELContext());
// If target is non-null, store it under the key "target".
attributes.put("target", target);
context.getViewRoot().addComponentResource(context, output, target);
@@ -2162,7 +2195,8 @@ public class ApplicationImpl extends App
}
}
- private void _inspectRenderer(FacesContext context, UIComponent component, String componentType, String rendererType)
+ private void _inspectRenderer(FacesContext context, UIComponent component,
+ String componentType, String rendererType)
{
/*
* The Renderer instance to inspect must be obtained by calling FacesContext.getRenderKit() and calling
@@ -2248,7 +2282,8 @@ public class ApplicationImpl extends App
if (listener.isListenerForSource(source))
{
// Otherwise, if the event to be passed to the listener instances has not yet been constructed,
- // construct the event, passing source as the argument to the one-argument constructor that takes
+ // construct the event, passing source as the argument
+ // to the one-argument constructor that takes
// an Object. This same event instance must be passed to all listener instances.
event = _createEvent(systemEventClass, source, event);
@@ -2463,14 +2498,17 @@ public class ApplicationImpl extends App
{
Object obj = classMap.get(id);
- if(obj == null){
+ if(obj == null)
+ {
return null; //object for this id wasn't found on the map
}
if(obj instanceof Class<?>)
{
return (Class<?>)obj;
- }else if (obj instanceof String ){
+ }
+ else if (obj instanceof String )
+ {
Class<?> clazz = ClassUtils.simpleClassForName((String)obj);
classMap.put(id, clazz);
return clazz;
@@ -2481,11 +2519,15 @@ public class ApplicationImpl extends App
return null;
}
- private boolean isLazyLoadConfigObjects(){
+ private boolean isLazyLoadConfigObjects()
+ {
if (_lazyLoadConfigObjects == null)
{
- String configParam = getFaceContext().getExternalContext().getInitParameter(LAZY_LOAD_CONFIG_OBJECTS_PARAM_NAME);
- _lazyLoadConfigObjects = configParam == null ? LAZY_LOAD_CONFIG_OBJECTS_DEFAULT_VALUE : Boolean.parseBoolean(configParam);
+ String configParam
+ = getFaceContext().getExternalContext().getInitParameter(LAZY_LOAD_CONFIG_OBJECTS_PARAM_NAME);
+ _lazyLoadConfigObjects = configParam == null
+ ? LAZY_LOAD_CONFIG_OBJECTS_DEFAULT_VALUE
+ : Boolean.parseBoolean(configParam);
}
return _lazyLoadConfigObjects;
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java Tue Oct 25 13:13:09 2011
@@ -104,7 +104,8 @@ public class NavigationHandlerImpl
ExternalContext externalContext = facesContext.getExternalContext();
ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
String toViewId = navigationCase.getToViewId(facesContext);
- String redirectPath = viewHandler.getRedirectURL(facesContext, toViewId, navigationCase.getParameters(), navigationCase.isIncludeViewParams());
+ String redirectPath = viewHandler.getRedirectURL(facesContext, toViewId, navigationCase.getParameters(),
+ navigationCase.isIncludeViewParams());
//Clear ViewMap if we are redirecting to other resource
UIViewRoot viewRoot = facesContext.getViewRoot();
@@ -166,7 +167,8 @@ public class NavigationHandlerImpl
if (facesContext.getViewRoot().getAttributes().containsKey("oam.CALL_PRE_DISPOSE_VIEW"))
{
facesContext.getAttributes().put(SKIP_ITERATION_HINT, Boolean.TRUE);
- facesContext.getViewRoot().visitTree(VisitContext.createVisitContext(facesContext), new PreDisposeViewCallback());
+ facesContext.getViewRoot().visitTree(VisitContext.createVisitContext(facesContext),
+ new PreDisposeViewCallback());
facesContext.getAttributes().remove(SKIP_ITERATION_HINT);
}
}
@@ -220,7 +222,8 @@ public class NavigationHandlerImpl
public VisitResult visit(VisitContext context, UIComponent target)
{
- context.getFacesContext().getApplication().publishEvent(context.getFacesContext(), PreDisposeViewEvent.class, target);
+ context.getFacesContext().getApplication().publishEvent(context.getFacesContext(),
+ PreDisposeViewEvent.class, target);
return VisitResult.ACCEPT;
}
@@ -290,7 +293,8 @@ public class NavigationHandlerImpl
navigationCase = getOutcomeNavigationCase (facesContext, fromAction, outcome);
}
- if (outcome != null && navigationCase == null && !facesContext.isProjectStage(ProjectStage.Production)) {
+ if (outcome != null && navigationCase == null && !facesContext.isProjectStage(ProjectStage.Production))
+ {
final FacesMessage facesMessage = new FacesMessage("No navigation case match for viewId " + viewId +
", action " + fromAction + " and outcome " + outcome);
facesMessage.setSeverity(FacesMessage.SEVERITY_WARN);
@@ -379,7 +383,8 @@ public class NavigationHandlerImpl
catch (UnsupportedOperationException e)
{
- // This is the case when a pre-JSF 2.0 ViewHandler is used. In this case, the default algorithm must be used.
+ // This is the case when a pre-JSF 2.0 ViewHandler is used.
+ // In this case, the default algorithm must be used.
// FIXME: I think we're always calling the "default" ViewHandler.deriveViewId() algorithm and we don't
// distinguish between pre-JSF 2.0 and JSF 2.0 ViewHandlers. This probably needs to be addressed.
}
@@ -452,7 +457,9 @@ public class NavigationHandlerImpl
return null;
}
- private NavigationCase calcMatchingNavigationCase(FacesContext context, Set<? extends NavigationCase> casesList, String actionRef,
+ private NavigationCase calcMatchingNavigationCase(FacesContext context,
+ Set<? extends NavigationCase> casesList,
+ String actionRef,
String outcome)
{
NavigationCase noConditionCase = null;
@@ -476,11 +483,13 @@ public class NavigationHandlerImpl
if(outcome == null && (cazeOutcome != null || cazeIf == null) && actionRef == null)
{
- continue; //To match an outcome value of null, the <from-outcome> must be absent and the <if> element present.
+ //To match an outcome value of null, the <from-outcome> must be absent and the <if> element present.
+ continue;
}
//If there are no conditions on navigation case save it and return as last resort
- if (cazeOutcome == null && cazeActionRef == null && cazeIf == null && noConditionCase == null && outcome != null)
+ if (cazeOutcome == null && cazeActionRef == null &&
+ cazeIf == null && noConditionCase == null && outcome != null)
{
noConditionCase = caze;
}
@@ -728,11 +737,15 @@ public class NavigationHandlerImpl
{
includeViewParams = new Boolean(includeViewParamsAttribute);
}
- apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),configCase.getRedirect().getViewParams(),true,includeViewParams));
+ apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),
+ configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),
+ configCase.getRedirect().getViewParams(),true,includeViewParams));
}
else
{
- apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),configCase.getFromOutcome(),configCase.getIf(),configCase.getToViewId(),null,false,false));
+ apiCases.add(new NavigationCase(rule.getFromViewId(),configCase.getFromAction(),
+ configCase.getFromOutcome(),configCase.getIf(),
+ configCase.getToViewId(),null,false,false));
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java Tue Oct 25 13:13:09 2011
@@ -18,7 +18,6 @@
*/
package org.apache.myfaces.application;
-import org.apache.myfaces.renderkit.ErrorPageWriter;
import org.apache.myfaces.shared.resource.ResourceHandlerCache;
import org.apache.myfaces.shared.resource.ResourceHandlerCache.ResourceValue;
import org.apache.myfaces.shared.resource.ResourceHandlerSupport;
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/StateManagerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/StateManagerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/StateManagerImpl.java Tue Oct 25 13:13:09 2011
@@ -20,7 +20,6 @@ package org.apache.myfaces.application;
import java.io.IOException;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -137,12 +136,14 @@ public class StateManagerImpl extends St
Object state = responseStateManager.getState(facesContext, viewId);
- if (state != null) {
+ if (state != null)
+ {
Object[] stateArray = (Object[])state;
TreeStructureManager tsm = new TreeStructureManager();
uiViewRoot = tsm.restoreTreeStructure(stateArray[0]);
- if (uiViewRoot != null) {
+ if (uiViewRoot != null)
+ {
facesContext.setViewRoot (uiViewRoot);
uiViewRoot.processRestoreState(facesContext, stateArray[1]);
}
@@ -191,7 +192,8 @@ public class StateManagerImpl extends St
// additional operations for save the state if is necessary.
if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
{
- StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).saveState(facesContext, serializedView);
+ StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
+ saveState(facesContext, serializedView);
}
return serializedView;
@@ -248,7 +250,8 @@ public class StateManagerImpl extends St
// additional operations for save the state if is necessary.
if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
{
- StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).saveState(facesContext, serializedView);
+ StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
+ saveState(facesContext, serializedView);
}
if (log.isLoggable(Level.FINEST))
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java Tue Oct 25 13:13:09 2011
@@ -158,7 +158,7 @@ public class TreeStructureManager
private String _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[] _facets = null; // Array of Array-tuples with Facetname and TreeStructComponent
TreeStructComponent(String componentClass, String componentId)
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java Tue Oct 25 13:13:09 2011
@@ -45,7 +45,6 @@ import javax.faces.view.ViewDeclarationL
import javax.faces.view.ViewMetadata;
import javax.servlet.http.HttpServletResponse;
-import org.apache.myfaces.renderkit.MyfacesResponseStateManager;
import org.apache.myfaces.renderkit.StateCacheUtils;
import org.apache.myfaces.shared.application.DefaultViewHandlerSupport;
import org.apache.myfaces.shared.application.InvalidViewIdException;
@@ -82,7 +81,8 @@ public class ViewHandlerImpl extends Vie
public ViewHandlerImpl()
{
- _vdlFactory = (ViewDeclarationLanguageFactory)FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
+ _vdlFactory = (ViewDeclarationLanguageFactory)
+ FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY);
if (log.isLoggable(Level.FINEST))
{
log.finest("New ViewHandler instance created");
@@ -92,7 +92,8 @@ public class ViewHandlerImpl extends Vie
@Override
public String deriveViewId(FacesContext context, String input)
{
- if(input != null){
+ if(input != null)
+ {
try
{
//TODO: JSF 2.0 - need to make sure calculateViewId follows the new algorithm from 7.5.2
@@ -109,7 +110,8 @@ public class ViewHandlerImpl extends Vie
@Override
public String deriveLogicalViewId(FacesContext context, String rawViewId)
{
- if(rawViewId != null){
+ if(rawViewId != null)
+ {
try
{
//TODO: JSF 2.0 - need to make sure calculateViewId follows the new algorithm from 7.5.2
@@ -323,11 +325,14 @@ public class ViewHandlerImpl extends Vie
// that so, check if the current one support the trick.
if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
{
- if (StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).isWriteStateAfterRenderViewRequired(context))
+ if (StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
+ isWriteStateAfterRenderViewRequired(context))
{
// Only write state marker if javascript view state is disabled
ExternalContext extContext = context.getExternalContext();
- if (!(JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())) {
+ if (!(JavascriptUtils.isJavascriptAllowed(extContext) &&
+ MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript()))
+ {
context.getResponseWriter().write(FORM_STATE_MARKER);
}
}
@@ -340,13 +345,16 @@ public class ViewHandlerImpl extends Vie
{
// Only write state marker if javascript view state is disabled
ExternalContext extContext = context.getExternalContext();
- if (!(JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())) {
+ if (!(JavascriptUtils.isJavascriptAllowed(extContext) &&
+ MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript()))
+ {
context.getResponseWriter().write(FORM_STATE_MARKER);
}
}
}
- private void setWritingState(FacesContext context, ResponseStateManager rsm){
+ private void setWritingState(FacesContext context, ResponseStateManager rsm)
+ {
// Facelets specific hack:
// Tell the StateWriter that we're about to write state
StateWriter stateWriter = StateWriter.getCurrentInstance();
@@ -375,7 +383,8 @@ public class ViewHandlerImpl extends Vie
}
- }else
+ }
+ else
{
//we're in a JSP, let the JSPStatemanager know that we need to actually write the state
}
@@ -450,6 +459,7 @@ public class ViewHandlerImpl extends Vie
}
}
}
+
if (parameterValue != null)
{
// since we have checked !parameters.containsKey(viewParameter.getName())
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletRequest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletRequest.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletRequest.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletRequest.java Tue Oct 25 13:13:09 2011
@@ -51,32 +51,37 @@ import javax.servlet.http.HttpSession;
*/
-public class _SystemEventServletRequest extends HttpServletRequestWrapper{
+public class _SystemEventServletRequest extends HttpServletRequestWrapper
+{
Map<String, Object> _attributesMap = new HashMap<String, Object>();
+
public _SystemEventServletRequest()
{
- super( (HttpServletRequest) Proxy.newProxyInstance(
+ super((HttpServletRequest) Proxy.newProxyInstance(
HttpServletRequest.class.getClassLoader(),
- new Class[] { HttpServletRequest.class },
+ new Class[]{HttpServletRequest.class},
new InvocationHandler()
{
- public Object invoke(Object proxy, Method m, Object[] args)
+ public Object invoke(Object proxy, Method m, Object[] args)
{
throw new UnsupportedOperationException("This request class is an empty placeholder");
}
}));
}
- public Object getAttribute(String s) {
- return _attributesMap.get(s);
+ public Object getAttribute(String s)
+ {
+ return _attributesMap.get(s);
}
- public void setAttribute(String s, Object o) {
+ public void setAttribute(String s, Object o)
+ {
_attributesMap.put(s, o);
}
- public void removeAttribute(String s) {
+ public void removeAttribute(String s)
+ {
_attributesMap.remove(s);
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletResponse.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletResponse.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletResponse.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/_SystemEventServletResponse.java Tue Oct 25 13:13:09 2011
@@ -34,7 +34,8 @@ import javax.servlet.http.HttpServletRes
* hence we have to provide dummy objects
*/
-public class _SystemEventServletResponse extends HttpServletResponseWrapper {
+public class _SystemEventServletResponse extends HttpServletResponseWrapper
+{
public _SystemEventServletResponse()
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java Tue Oct 25 13:13:09 2011
@@ -105,7 +105,8 @@ public class JspStateManagerImpl extends
private static final String SERIALIZE_STATE_IN_SESSION_PARAM = "org.apache.myfaces.SERIALIZE_STATE_IN_SESSION";
/**
- * Only applicable if state saving method is "server" (= default) and if <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
+ * Only applicable if state saving method is "server" (= default) and if
+ * <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
* If <code>true</code> (default) the serialized state will be compressed before it is written to the session.
* If <code>false</code> the state will not be compressed.
*/
@@ -270,9 +271,13 @@ public class JspStateManagerImpl extends
}
else
{
- Integer serverStateId = getServerStateId((Object[]) responseStateManager.getState(facesContext, uiViewRoot.getViewId()));
+ Integer serverStateId = getServerStateId((Object[])
+ responseStateManager.getState(facesContext, uiViewRoot.getViewId()));
+
+ Object[] stateObj = (Object[])( (serverStateId == null)
+ ? null
+ : getSerializedViewFromServletSession(facesContext, uiViewRoot.getViewId(), serverStateId) );
- Object[] stateObj = (Object[])( (serverStateId == null)? null : getSerializedViewFromServletSession(facesContext, uiViewRoot.getViewId(), serverStateId) );
if (stateObj == null)
{
log.severe("No serialized view found in server session!");
@@ -359,7 +364,10 @@ public class JspStateManagerImpl extends
//reconstruct tree structure from ServletSession
Integer serverStateId = getServerStateId((Object[]) responseStateManager.getState(facesContext, viewId));
- Object[] stateObj = (Object[])( (serverStateId == null)? null : getSerializedViewFromServletSession(facesContext, viewId, serverStateId) );
+ Object[] stateObj = (Object[])( (serverStateId == null)
+ ? null
+ : getSerializedViewFromServletSession(facesContext, viewId, serverStateId) );
+
if (stateObj == null)
{
if (log.isLoggable(Level.FINE))
@@ -375,7 +383,8 @@ public class JspStateManagerImpl extends
{
if (log.isLoggable(Level.FINE))
{
- log.fine("Exiting restoreTreeStructure - No tree structure state found in server session, former UIViewRoot must have been transient");
+ log.fine("Exiting restoreTreeStructure - No tree structure state found "
+ + "in server session, former UIViewRoot must have been transient");
}
return null;
}
@@ -444,17 +453,22 @@ public class JspStateManagerImpl extends
log.finest("Restoring view from session");
}
- Integer serverStateId = getServerStateId((Object[]) responseStateManager.getState(facesContext, viewId));
+ Integer serverStateId
+ = getServerStateId((Object[]) responseStateManager.getState(facesContext, viewId));
- state = (serverStateId == null) ? null : getSerializedViewFromServletSession(facesContext, viewId, serverStateId);
+ state = (serverStateId == null)
+ ? null
+ : getSerializedViewFromServletSession(facesContext, viewId, serverStateId);
}
- if (state != null) {
+ if (state != null)
+ {
Object[] stateArray = (Object[])state;
TreeStructureManager tsm = new TreeStructureManager();
uiViewRoot = tsm.restoreTreeStructure(stateArray[0]);
- if (uiViewRoot != null) {
+ if (uiViewRoot != null)
+ {
facesContext.setViewRoot (uiViewRoot);
uiViewRoot.processRestoreState(facesContext, stateArray[1]);
}
@@ -698,7 +712,8 @@ public class JspStateManagerImpl extends
{
UIViewRoot uiViewRoot = facesContext.getViewRoot();
String viewId = uiViewRoot.getViewId();
- ViewDeclarationLanguage vdl = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
+ ViewDeclarationLanguage vdl
+ = facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
if (vdl != null)
{
StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
@@ -707,10 +722,12 @@ public class JspStateManagerImpl extends
{
if (log.isLoggable(Level.FINEST))
{
- log.finest("Calling saveView of StateManagementStrategy from getViewState: " + sms.getClass().getName());
+ log.finest("Calling saveView of StateManagementStrategy from getViewState: "
+ + sms.getClass().getName());
}
- return facesContext.getRenderKit().getResponseStateManager().getViewState(facesContext, saveView(facesContext));
+ return facesContext.getRenderKit().getResponseStateManager().
+ getViewState(facesContext, saveView(facesContext));
}
}
Object[] savedState = (Object[]) saveView(facesContext);
@@ -760,7 +777,8 @@ public class JspStateManagerImpl extends
}
else
{
- log.severe("ResponseStateManager of render kit " + uiViewRoot.getRenderKitId() + " is no MyfacesResponseStateManager and does not support saving state in url parameters.");
+ log.severe("ResponseStateManager of render kit " + uiViewRoot.getRenderKitId()
+ + " is no MyfacesResponseStateManager and does not support saving state in url parameters.");
}
}
@@ -948,7 +966,7 @@ public class JspStateManagerImpl extends
/**
* Reads the value of the <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> context parameter.
- * @see SERIALIZE_STATE_IN_SESSION_PARAM
+ * @see #SERIALIZE_STATE_IN_SESSION_PARAM
* @param context <code>FacesContext</code> for the request we are processing.
* @return boolean true, if the server state should be serialized in the session
*/
@@ -966,7 +984,7 @@ public class JspStateManagerImpl extends
/**
* Reads the value of the <code>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</code> context parameter.
- * @see COMPRESS_SERVER_STATE_PARAM
+ * @see #COMPRESS_SERVER_STATE_PARAM
* @param context <code>FacesContext</code> for the request we are processing.
* @return boolean true, if the server state steam should be compressed
*/
@@ -993,7 +1011,8 @@ public class JspStateManagerImpl extends
{
if (log.isLoggable(Level.FINEST))
{
- log.finest("Processing deserializeView - deserializing serialized state. Bytes : " + ((byte[]) state).length);
+ log.finest("Processing deserializeView - deserializing serialized state. Bytes : "
+ + ((byte[]) state).length);
}
try
@@ -1016,7 +1035,7 @@ public class JspStateManagerImpl extends
{
public Object[] run() throws PrivilegedActionException, IOException, ClassNotFoundException
{
- return new Object[] {in.readObject(), in.readObject()};
+ return new Object[] {in.readObject(), in.readObject()};
}
});
}
@@ -1067,12 +1086,14 @@ public class JspStateManagerImpl extends
}
else
{
- log.severe("Exiting deserializeView - this method should not be called with a state of type : "+state.getClass());
+ log.severe("Exiting deserializeView - this method should not be called with a state of type : "
+ + state.getClass());
return null;
}
}
- private boolean isLegacyResponseStateManager(ResponseStateManager instance) {
+ private boolean isLegacyResponseStateManager(ResponseStateManager instance)
+ {
Method[] methods = instance.getClass().getMethods();
for (Method m : methods)
@@ -1105,7 +1126,7 @@ public class JspStateManagerImpl extends
while (_keys.remove(key))
{
- ;
+ // nothing to do
}
_keys.add(key);
@@ -1124,7 +1145,7 @@ public class JspStateManagerImpl extends
/**
* Reads the amount (default = 20) of views to be stored in session.
- * @see NUMBER_OF_VIEWS_IN_SESSION_PARAM
+ * @see #NUMBER_OF_VIEWS_IN_SESSION_PARAM
* @param context FacesContext for the current request, we are processing
* @return Number vf views stored in the session
*/
@@ -1193,7 +1214,7 @@ public class JspStateManagerImpl extends
* @since 1.2.5
* @param context
* @return constant indicating caching mode
- * @see CACHE_OLD_VIEWS_IN_SESSION_MODE
+ * @see #CACHE_OLD_VIEWS_IN_SESSION_MODE
*/
protected String getCacheOldViewsInSessionMode(FacesContext context)
{
@@ -1263,10 +1284,10 @@ public class JspStateManagerImpl extends
@Override
public int hashCode()
{
- final int PRIME = 31;
+ final int prime = 31;
int result = 1;
- result = PRIME * result + ((_sequenceId == null) ? 0 : _sequenceId.hashCode());
- result = PRIME * result + ((_viewId == null) ? 0 : _viewId.hashCode());
+ result = prime * result + ((_sequenceId == null) ? 0 : _sequenceId.hashCode());
+ result = prime * result + ((_viewId == null) ? 0 : _viewId.hashCode());
return result;
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java Tue Oct 25 13:13:09 2011
@@ -350,7 +350,8 @@ public class JspViewHandlerImpl extends
response.setLocale(locale);
Config.set(request, Config.FMT_LOCALE, facesContext.getViewRoot().getLocale());
- if(!buildView(response, externalContext, viewId)) {
+ if(!buildView(response, externalContext, viewId))
+ {
//building the view was unsuccessful - an exception occurred during rendering
//we need to jump out
return;
@@ -414,8 +415,8 @@ public class JspViewHandlerImpl extends
// Final step - we output any content in the wrappedResponse response from above to the response,
// removing the wrappedResponse response from the request, we don't need it anymore
- ServletViewResponseWrapper afterViewTagResponse = (ServletViewResponseWrapper) externalContext.getRequestMap().get(
- AFTER_VIEW_TAG_CONTENT_PARAM);
+ ServletViewResponseWrapper afterViewTagResponse
+ = (ServletViewResponseWrapper) externalContext.getRequestMap().get(AFTER_VIEW_TAG_CONTENT_PARAM);
externalContext.getRequestMap().remove(AFTER_VIEW_TAG_CONTENT_PARAM);
if (afterViewTagResponse != null)
@@ -430,8 +431,8 @@ public class JspViewHandlerImpl extends
/**
* Render the view now - properly setting and resetting the response writer
*/
- private void actuallyRenderView(FacesContext facesContext,
- UIViewRoot viewToRender) throws IOException {
+ private void actuallyRenderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException
+ {
// Set the new ResponseWriter into the FacesContext, saving the old one aside.
ResponseWriter responseWriter = facesContext.getResponseWriter();
@@ -462,23 +463,12 @@ public class JspViewHandlerImpl extends
* @param externalContext
* @return
*/
- private ResponseWriter hookInStateAwareWriter(ResponseWriter oldResponseWriter, StateMarkerAwareWriter stateAwareWriter, RenderKit renderKit, ExternalContext externalContext) {
+ private ResponseWriter hookInStateAwareWriter(ResponseWriter oldResponseWriter,
+ StateMarkerAwareWriter stateAwareWriter,
+ RenderKit renderKit,
+ ExternalContext externalContext)
+ {
return oldResponseWriter.cloneWithWriter(stateAwareWriter);
- /*
- ResponseWriter newResponseWriter;
- if (oldResponseWriter != null)
- {
- newResponseWriter = oldResponseWriter.cloneWithWriter(stateAwareWriter);
- }
- else
- {
- if (log.isTraceEnabled())
- log.trace("Creating new ResponseWriter");
- newResponseWriter = renderKit.createResponseWriter(stateAwareWriter, null,
- ((HttpServletRequest) externalContext.getRequest()).getCharacterEncoding());
- }
- return newResponseWriter;
- */
}
/**Build the view-tree before rendering.
@@ -487,13 +477,16 @@ public class JspViewHandlerImpl extends
* will happen later while rendering), attaching these components
* to the component tree, and buffering any content after the view-root.
*
- * @param response The current response - it will be replaced while the view-building happens (we want the text in the component tree, not on the actual servlet output stream)
+ * @param response The current response - it will be replaced while the view-building happens
+ * (we want the text in the component tree, not on the actual servlet output stream)
* @param externalContext The external context where the response will be replaced while building
* @param viewId The view-id to dispatch to
* @return true if successfull, false if an error occurred during rendering
* @throws IOException
*/
- private boolean buildView(ServletResponse response, ExternalContext externalContext, String viewId) throws IOException {
+ private boolean buildView(ServletResponse response, ExternalContext externalContext, String viewId)
+ throws IOException
+ {
ServletViewResponseWrapper wrappedResponse = new ServletViewResponseWrapper((HttpServletResponse) response);
externalContext.setResponse(wrappedResponse);
@@ -565,7 +558,9 @@ public class JspViewHandlerImpl extends
{
// Only write state marker if javascript view state is disabled
ExternalContext extContext = facesContext.getExternalContext();
- if (!(JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())) {
+ if (!(JavascriptUtils.isJavascriptAllowed(extContext) &&
+ MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript()))
+ {
facesContext.getResponseWriter().write(FORM_STATE_MARKER);
}
}
@@ -601,9 +596,12 @@ public class JspViewHandlerImpl extends
public void write(char[] cbuf, int off, int len) throws IOException
{
if ((off < 0) || (off > cbuf.length) || (len < 0) ||
- ((off + len) > cbuf.length) || ((off + len) < 0)) {
+ ((off + len) > cbuf.length) || ((off + len) < 0))
+ {
throw new IndexOutOfBoundsException();
- } else if (len == 0) {
+ }
+ else if (len == 0)
+ {
return;
}
buf.append(cbuf, off, len);
@@ -632,11 +630,15 @@ public class JspViewHandlerImpl extends
String state = stateWriter.getBuffer().toString();
ExternalContext extContext = facesContext.getExternalContext();
- if (JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript()) {
+ if (JavascriptUtils.isJavascriptAllowed(extContext) &&
+ MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())
+ {
// If javascript viewstate is enabled no state markers were written
write(contentBuffer, 0, contentBuffer.length(), writer);
writer.write(state);
- } else {
+ }
+ else
+ {
// If javascript viewstate is disabled state markers must be replaced
int lastFormMarkerPos = 0;
int formMarkerPos = 0;
@@ -651,7 +653,8 @@ public class JspViewHandlerImpl extends
lastFormMarkerPos = formMarkerPos;
}
// Write content after last state marker
- if (lastFormMarkerPos < contentBuffer.length()) {
+ if (lastFormMarkerPos < contentBuffer.length())
+ {
write(contentBuffer, lastFormMarkerPos, contentBuffer.length(), writer);
}
}
@@ -668,7 +671,8 @@ public class JspViewHandlerImpl extends
* @param writer the <code>Writer</code> to write to
* @throws IOException if an error occurs writing to specified <code>Writer</code>
*/
- private void write(StringBuilder contentBuffer, int beginIndex, int endIndex, Writer writer) throws IOException {
+ private void write(StringBuilder contentBuffer, int beginIndex, int endIndex, Writer writer) throws IOException
+ {
int index = beginIndex;
int bufferSize = 2048;
char[] bufToWrite = new char[bufferSize];
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java?rev=1188643&r1=1188642&r2=1188643&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java Tue Oct 25 13:13:09 2011
@@ -206,7 +206,8 @@ public class ServletViewResponseWrapper
* @param encoding
* @throws IOException
*/
- private void writeTo(Writer out, String encoding) throws IOException{
+ private void writeTo(Writer out, String encoding) throws IOException
+ {
//Get the charset based on the encoding or return the default if
//encoding == null
Charset charset = (encoding == null) ?
@@ -215,7 +216,8 @@ public class ServletViewResponseWrapper
CharBuffer decodedBuffer = decoder.decode(
ByteBuffer.wrap(_byteArrayOutputStream.getInnerArray(),
0,_byteArrayOutputStream.getInnerCount()));
- if (decodedBuffer.hasArray()){
+ if (decodedBuffer.hasArray())
+ {
out.write(decodedBuffer.array());
}
}
@@ -231,21 +233,26 @@ public class ServletViewResponseWrapper
* in WrappedServletOutputStream.writeTo and avoid buffer
* duplication.
*/
- static class WrappedByteArrayOutputStream extends ByteArrayOutputStream{
+ static class WrappedByteArrayOutputStream extends ByteArrayOutputStream
+ {
- public WrappedByteArrayOutputStream(){
+ public WrappedByteArrayOutputStream()
+ {
super();
}
- public WrappedByteArrayOutputStream(int size){
+ public WrappedByteArrayOutputStream(int size)
+ {
super(size);
}
- private byte[] getInnerArray(){
+ private byte[] getInnerArray()
+ {
return buf;
}
- private int getInnerCount(){
+ private int getInnerCount()
+ {
return count;
}
}