File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 800 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementHelper.java | 166 |
}
protected void saveSerializedViewInServletSession(FacesContext context,
Object serializedView)
{
Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
SerializedViewCollection viewCollection = (SerializedViewCollection) sessionMap
.get(SERIALIZED_VIEW_SESSION_ATTR);
if (viewCollection == null)
{
viewCollection = new SerializedViewCollection();
sessionMap.put(SERIALIZED_VIEW_SESSION_ATTR, viewCollection);
}
viewCollection.add(context, serializeView(context, serializedView));
// replace the value to notify the container about the change
sessionMap.put(SERIALIZED_VIEW_SESSION_ATTR, viewCollection);
}
protected Object getSerializedViewFromServletSession(FacesContext context, String viewId, Integer sequence)
{
ExternalContext externalContext = context.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
Object serializedView = null;
if (requestMap.containsKey(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR))
{
serializedView = requestMap.get(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR);
}
else
{
SerializedViewCollection viewCollection = (SerializedViewCollection) externalContext
.getSessionMap().get(SERIALIZED_VIEW_SESSION_ATTR);
if (viewCollection != null)
{
/*
String sequenceStr = externalContext.getRequestParameterMap().get(
RendererUtils.SEQUENCE_PARAM);
Integer sequence = null;
if (sequenceStr == null)
{
// use latest sequence
Map map = externalContext.getSessionMap();
sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
}
else
{
sequence = new Integer(sequenceStr);
}
*/
if (sequence != null)
{
Object state = viewCollection.get(sequence, viewId);
if (state != null)
{
serializedView = deserializeView(state);
}
}
}
requestMap.put(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR, serializedView);
nextViewSequence(context);
}
return serializedView;
}
protected int getNextViewSequence(FacesContext context)
{
ExternalContext externalContext = context.getExternalContext();
if (!externalContext.getRequestMap().containsKey(RendererUtils.SEQUENCE_PARAM))
{
nextViewSequence(context);
}
Integer sequence = (Integer) externalContext.getRequestMap().get(RendererUtils.SEQUENCE_PARAM);
return sequence.intValue();
}
protected void nextViewSequence(FacesContext facescontext)
{
ExternalContext externalContext = facescontext.getExternalContext();
Object sessionObj = externalContext.getSession(true);
synchronized(sessionObj) // synchronized to increase sequence if multiple requests
// are handled at the same time for the session
{
Map<String, Object> map = externalContext.getSessionMap();
Integer sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
if(sequence == null || sequence.intValue() == Integer.MAX_VALUE)
{
sequence = Integer.valueOf(1);
}
else
{
sequence = Integer.valueOf(sequence.intValue() + 1);
}
map.put(RendererUtils.SEQUENCE_PARAM, sequence);
externalContext.getRequestMap().put(RendererUtils.SEQUENCE_PARAM, sequence);
}
}
protected Object serializeView(FacesContext context, Object serializedView)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering serializeView");
}
if(isSerializeStateInSession(context))
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize state in session");
}
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try
{
OutputStream os = baos;
if(isCompressStateInSession(context))
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize compressed");
}
os.write(COMPRESSED_FLAG);
os = new GZIPOutputStream(os, 1024);
}
else
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize uncompressed");
}
os.write(UNCOMPRESSED_FLAG);
}
Object[] stateArray = (Object[]) serializedView;
ObjectOutputStream out = new ObjectOutputStream(os);
out.writeObject(stateArray[0]);
out.writeObject(stateArray[1]);
out.close();
baos.close();
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting serializeView - serialized. Bytes : " + baos.size());
}
return baos.toByteArray();
}
catch (IOException e)
{
log.log(Level.SEVERE, "Exiting serializeView - Could not serialize state: " + e.getMessage(), e);
return null;
}
}
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting serializeView - do not serialize state in session.");
}
return serializedView;
}
/**
* Reads the value of the <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> context parameter.
* @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
*/
protected boolean isSerializeStateInSession(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
SERIALIZE_STATE_IN_SESSION_PARAM);
boolean serialize = DEFAULT_SERIALIZE_STATE_IN_SESSION;
if (value != null)
{
serialize = Boolean.valueOf(value);
}
return serialize;
}
/**
* Reads the value of the <code>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</code> context parameter.
* @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
*/
protected boolean isCompressStateInSession(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
COMPRESS_SERVER_STATE_PARAM);
boolean compress = DEFAULT_COMPRESS_SERVER_STATE_PARAM;
if (value != null)
{
compress = Boolean.valueOf(value);
}
return compress;
}
protected Object deserializeView(Object state)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering deserializeView");
}
if(state instanceof byte[])
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing deserializeView - deserializing serialized state. Bytes : "
+ ((byte[]) state).length);
}
try
{
ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) state);
InputStream is = bais;
if(is.read() == COMPRESSED_FLAG)
{
is = new GZIPInputStream(is);
}
ObjectInputStream ois = null;
try
{
final ObjectInputStream in = new MyFacesObjectInputStream(is);
ois = in;
Object object = null;
if (System.getSecurityManager() != null)
{
object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object []>()
{
public Object[] run() throws PrivilegedActionException, IOException, ClassNotFoundException
{
return new Object[] {in.readObject(), in.readObject()};
}
});
}
else
{
object = new Object[] {in.readObject(), in.readObject()};
}
return object;
}
finally
{
if (ois != null)
{
ois.close();
ois = null;
}
}
}
catch (PrivilegedActionException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
catch (IOException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
catch (ClassNotFoundException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
}
else if (state instanceof Object[])
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting deserializeView - state not serialized.");
}
return state;
}
else if(state == null)
{
log.severe("Exiting deserializeView - this method should not be called with a null-state.");
return null;
}
else
{
log.severe("Exiting deserializeView - this method should not be called with a state of type : "
+ state.getClass());
return null;
}
} |
File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 1109 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementHelper.java | 459 |
}
protected static class SerializedViewCollection implements Serializable
{
private static final long serialVersionUID = -3734849062185115847L;
private final List<Object> _keys = new ArrayList<Object>(DEFAULT_NUMBER_OF_VIEWS_IN_SESSION);
private final Map<Object, Object> _serializedViews = new HashMap<Object, Object>();
// old views will be hold as soft references which will be removed by
// the garbage collector if free memory is low
private transient Map<Object, Object> _oldSerializedViews = null;
public synchronized void add(FacesContext context, Object state)
{
Object key = new SerializedViewKey(context);
_serializedViews.put(key, state);
while (_keys.remove(key))
{
// do nothing
}
_keys.add(key);
int views = getNumberOfViewsInSession(context);
while (_keys.size() > views)
{
key = _keys.remove(0);
Object oldView = _serializedViews.remove(key);
if (oldView != null &&
!CACHE_OLD_VIEWS_IN_SESSION_MODE_OFF.equals(getCacheOldViewsInSessionMode(context)))
{
getOldSerializedViewsMap().put(key, oldView);
}
}
}
/**
* Reads the amount (default = 20) of views to be stored in session.
* @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
*/
protected int getNumberOfViewsInSession(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
NUMBER_OF_VIEWS_IN_SESSION_PARAM);
int views = DEFAULT_NUMBER_OF_VIEWS_IN_SESSION;
if (value != null)
{
try
{
views = Integer.parseInt(value);
if (views <= 0)
{
log.severe("Configured value for " + NUMBER_OF_VIEWS_IN_SESSION_PARAM
+ " is not valid, must be an value > 0, using default value ("
+ DEFAULT_NUMBER_OF_VIEWS_IN_SESSION);
views = DEFAULT_NUMBER_OF_VIEWS_IN_SESSION;
}
}
catch (Throwable e)
{
log.log(Level.SEVERE, "Error determining the value for " + NUMBER_OF_VIEWS_IN_SESSION_PARAM
+ ", expected an integer value > 0, using default value ("
+ DEFAULT_NUMBER_OF_VIEWS_IN_SESSION + "): " + e.getMessage(), e);
}
}
return views;
}
/**
* @return old serialized views map
*/
@SuppressWarnings("unchecked")
protected Map<Object, Object> getOldSerializedViewsMap()
{
FacesContext context = FacesContext.getCurrentInstance();
if (_oldSerializedViews == null && context != null)
{
String cacheMode = getCacheOldViewsInSessionMode(context);
if (CACHE_OLD_VIEWS_IN_SESSION_MODE_WEAK.equals(cacheMode))
{
_oldSerializedViews = new ReferenceMap(AbstractReferenceMap.WEAK, AbstractReferenceMap.WEAK, true);
}
else if (CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT_WEAK.equals(cacheMode))
{
_oldSerializedViews = new ReferenceMap(AbstractReferenceMap.SOFT, AbstractReferenceMap.WEAK, true);
}
else if (CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT.equals(cacheMode))
{
_oldSerializedViews = new ReferenceMap(AbstractReferenceMap.SOFT, AbstractReferenceMap.SOFT, true);
}
else if (CACHE_OLD_VIEWS_IN_SESSION_MODE_HARD_SOFT.equals(cacheMode))
{
_oldSerializedViews = new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.SOFT);
}
}
return _oldSerializedViews;
}
/**
* Reads the value of the <code>org.apache.myfaces.CACHE_OLD_VIEWS_IN_SESSION_MODE</code> context parameter.
*
* @since 1.2.5
* @param context
* @return constant indicating caching mode
* @see #CACHE_OLD_VIEWS_IN_SESSION_MODE
*/
protected String getCacheOldViewsInSessionMode(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
CACHE_OLD_VIEWS_IN_SESSION_MODE);
if (value == null)
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_OFF;
}
else if (value.equalsIgnoreCase(CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT))
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT;
}
else if (value.equalsIgnoreCase(CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT_WEAK))
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT_WEAK;
}
else if (value.equalsIgnoreCase(CACHE_OLD_VIEWS_IN_SESSION_MODE_WEAK))
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_WEAK;
}
else if (value.equalsIgnoreCase(CACHE_OLD_VIEWS_IN_SESSION_MODE_HARD_SOFT))
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_HARD_SOFT;
}
else
{
return CACHE_OLD_VIEWS_IN_SESSION_MODE_OFF;
}
}
public Object get(Integer sequence, String viewId)
{
Object key = new SerializedViewKey(viewId, sequence);
Object value = _serializedViews.get(key);
if (value == null)
{
Map<Object,Object> oldSerializedViewMap = getOldSerializedViewsMap();
if (oldSerializedViewMap != null)
{
value = oldSerializedViewMap.get(key);
}
}
return value;
}
}
protected static class SerializedViewKey implements Serializable
{
private static final long serialVersionUID = -1170697124386063642L;
private final String _viewId;
private final Integer _sequenceId;
public SerializedViewKey(String viewId, Integer sequence)
{
_sequenceId = sequence;
_viewId = viewId;
}
public SerializedViewKey(FacesContext context)
{
_sequenceId = RendererUtils.getViewSequence(context);
_viewId = context.getViewRoot().getViewId();
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((_sequenceId == null) ? 0 : _sequenceId.hashCode());
result = prime * result + ((_viewId == null) ? 0 : _viewId.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final SerializedViewKey other = (SerializedViewKey) obj;
if (_sequenceId == null)
{
if (other._sequenceId != null)
{
return false;
}
}
else if (!_sequenceId.equals(other._sequenceId))
{
return false;
}
if (_viewId == null)
{
if (other._viewId != null)
{
return false;
}
}
else if (!_viewId.equals(other._viewId))
{
return false;
}
return true;
}
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/el/ELText.java | 491 |
org/apache/myfaces/view/facelets/el/ELText.java | 576 |
public static ELText[] parseAsArray(ExpressionFactory fact, ELContext ctx, String in) throws ELException
{
char[] ca = in.toCharArray();
int i = 0;
char c = 0;
int len = ca.length;
int end = len - 1;
boolean esc = false;
int vlen = 0;
StringBuffer buff = new StringBuffer(128);
List<ELText> text = new ArrayList<ELText>();
ELText t = null;
ValueExpression ve = null;
while (i < len)
{
c = ca[i];
if ('\\' == c)
{
esc = !esc;
if (esc && i < end && (ca[i + 1] == '$' || ca[i + 1] == '#'))
{
i++;
continue;
}
}
else if (!esc && ('$' == c || '#' == c))
{
if (i < end)
{
if ('{' == ca[i + 1])
{
if (buff.length() > 0)
{
text.add(new ELText(buff.toString()));
buff.setLength(0);
}
vlen = findVarLength(ca, i);
if (ctx != null && fact != null)
{
ve = fact.createValueExpression(ctx, new String(ca, i, vlen), String.class);
t = new ELCacheableTextVariable(ve);
}
else
{
t = new ELCacheableTextVariable(new LiteralValueExpression(new String(ca, i, vlen)));
}
text.add(t);
i += vlen;
continue;
}
}
}
esc = false;
buff.append(c);
i++;
}
if (buff.length() > 0)
{
text.add(new ELText(new String(buff.toString())));
buff.setLength(0);
}
if (text.size() == 0)
{
return null;
}
else if (text.size() == 1)
{
return new ELText[]{text.get(0)}; |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java | 137 |
org/apache/myfaces/view/facelets/tag/composite/CompositeMetaRulesetImpl.java | 109 |
}
public MetaRuleset add(Metadata mapper)
{
ParameterCheck.notNull("mapper", mapper);
if (!_mappers.contains(mapper))
{
_mappers.add(mapper);
}
return this;
}
public MetaRuleset addRule(MetaRule rule)
{
ParameterCheck.notNull("rule", rule);
_rules.add(rule);
return this;
}
public MetaRuleset alias(String attribute, String property)
{
ParameterCheck.notNull("attribute", attribute);
ParameterCheck.notNull("property", property);
TagAttribute attr = (TagAttribute) _attributes.remove(attribute);
if (attr != null)
{
_attributes.put(property, attr);
}
return this;
}
public Metadata finish()
{
assert !_rules.isEmpty();
if (!_attributes.isEmpty())
{
MetadataTarget target = this._getMetadataTarget();
int ruleEnd = _rules.size() - 1;
// now iterate over attributes
for (Map.Entry<String, TagAttribute> entry : _attributes.entrySet())
{
Metadata data = null;
int i = ruleEnd;
// First loop is always safe
do
{
MetaRule rule = _rules.get(i);
data = rule.applyRule(entry.getKey(), entry.getValue(), target);
i--;
} while (data == null && i >= 0);
if (data == null)
{
if (log.isLoggable(Level.SEVERE))
{
log.severe(entry.getValue() + " Unhandled by MetaTagHandler for type " + _type.getName());
}
}
else
{
_mappers.add(data);
}
}
}
if (_mappers.isEmpty())
{
return NONE;
}
else
{
return new MetadataImpl(_mappers.toArray(new Metadata[_mappers.size()]));
}
}
public MetaRuleset ignore(String attribute)
{
ParameterCheck.notNull("attribute", attribute);
_attributes.remove(attribute);
return this;
}
public MetaRuleset ignoreAll()
{
_attributes.clear();
return this;
}
private final MetadataTarget _getMetadataTarget()
{ |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java | 96 |
org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java | 64 |
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
_acceptPatterns = loadAcceptPattern(externalContext);
_extension = loadFaceletExtension(externalContext);
String defaultSuffixes = WebConfigParamUtils.getStringInitParameter(externalContext,
ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ViewHandler.DEFAULT_SUFFIX );
_defaultSuffixesArray = StringUtils.splitShortString(defaultSuffixes, ' ');
boolean faceletsExtensionFound = false;
for (String ext : _defaultSuffixesArray)
{
if (_extension.equals(ext))
{
faceletsExtensionFound = true;
break;
}
}
if (!faceletsExtensionFound)
{
_defaultSuffixesArray = (String[]) ArrayUtils.concat(_defaultSuffixesArray, new String[]{_extension});
}
}
/**
* Load and compile a regular expression pattern built from the Facelet view mapping parameters.
*
* @param context
* the application's external context
*
* @return the compiled regular expression
*/
private Pattern loadAcceptPattern(ExternalContext context)
{
assert context != null;
String mappings = context.getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
if (mappings == null)
{
return null;
}
// Make sure the mappings contain something
mappings = mappings.trim();
if (mappings.length() == 0)
{
return null;
}
return Pattern.compile(toRegex(mappings));
}
private String loadFaceletExtension(ExternalContext context)
{
assert context != null;
String suffix = context.getInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME);
if (suffix == null)
{
suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
}
else
{
suffix = suffix.trim();
if (suffix.length() == 0)
{
suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
}
}
return suffix;
}
/**
* Convert the specified mapping string to an equivalent regular expression.
*
* @param mappings
* le mapping string
*
* @return an uncompiled regular expression representing the mappings
*/
private String toRegex(String mappings)
{
assert mappings != null;
// Get rid of spaces
mappings = mappings.replaceAll("\\s", "");
// Escape '.'
mappings = mappings.replaceAll("\\.", "\\\\.");
// Change '*' to '.*' to represent any match
mappings = mappings.replaceAll("\\*", ".*");
// Split the mappings by changing ';' to '|'
mappings = mappings.replaceAll(";", "|");
return mappings;
}
public boolean handles(String resourceName)
{
if (resourceName == null)
{
return false;
}
// Check extension first as it's faster than mappings
if (resourceName.endsWith(_extension))
{
// If the extension matches, it's a Facelet viewId.
return true;
}
// Otherwise, try to match the view identifier with the facelet mappings
return _acceptPatterns != null && _acceptPatterns.matcher(resourceName).matches();
} |
File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 940 |
org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java | 411 |
out.writeObject(serializedView);
out.close();
baos.close();
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting serializeView - serialized. Bytes : " + baos.size());
}
return baos.toByteArray();
}
catch (IOException e)
{
log.log(Level.SEVERE, "Exiting serializeView - Could not serialize state: " + e.getMessage(), e);
return null;
}
}
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting serializeView - do not serialize state in session.");
}
return serializedView;
}
/**
* Reads the value of the <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> context parameter.
* @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
*/
protected boolean isSerializeStateInSession(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
SERIALIZE_STATE_IN_SESSION_PARAM);
boolean serialize = DEFAULT_SERIALIZE_STATE_IN_SESSION;
if (value != null)
{
serialize = Boolean.valueOf(value);
}
return serialize;
}
/**
* Reads the value of the <code>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</code> context parameter.
* @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
*/
protected boolean isCompressStateInSession(FacesContext context)
{
String value = context.getExternalContext().getInitParameter(
COMPRESS_SERVER_STATE_PARAM);
boolean compress = DEFAULT_COMPRESS_SERVER_STATE_PARAM;
if (value != null)
{
compress = Boolean.valueOf(value);
}
return compress;
}
protected Object deserializeView(Object state)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering deserializeView");
}
if(state instanceof byte[])
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing deserializeView - deserializing serialized state. Bytes : "
+ ((byte[]) state).length);
}
try
{
ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) state);
InputStream is = bais;
if(is.read() == COMPRESSED_FLAG)
{
is = new GZIPInputStream(is);
}
ObjectInputStream ois = null;
try
{
final ObjectInputStream in = new MyFacesObjectInputStream(is);
ois = in;
Object object = null;
if (System.getSecurityManager() != null)
{
object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() |
File | Line |
---|
org/apache/myfaces/view/facelets/component/UIRepeat.java | 512 |
org/apache/myfaces/view/facelets/component/UIRepeat.java | 593 |
UIComponent child = parent.getChildren().get(i);
if (!child.isTransient())
{
// Add an entry to the collection, being an array of two
// elements. The first element is the state of the children
// of this component; the second is the state of the current
// child itself.
if (child instanceof EditableValueHolder)
{
if (childStates == null)
{
childStates = new ArrayList<Object[]>(
parent.getFacetCount()
+ parent.getChildCount()
- totalChildCount
+ childEmptyIndex);
for (int ci = 0; ci < childEmptyIndex; ci++)
{
childStates.add(LEAF_NO_STATE);
}
}
childStates.add(child.getChildCount() > 0 ?
new Object[]{new SavedState((EditableValueHolder) child),
saveDescendantComponentStates(child, saveChildFacets, true)} :
new Object[]{new SavedState((EditableValueHolder) child),
null});
}
else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0))
{
Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true);
if (descendantSavedState == null)
{
if (childStates == null)
{
childEmptyIndex++;
}
else
{
childStates.add(LEAF_NO_STATE);
}
}
else
{
if (childStates == null)
{
childStates = new ArrayList<Object[]>(
parent.getFacetCount()
+ parent.getChildCount()
- totalChildCount
+ childEmptyIndex);
for (int ci = 0; ci < childEmptyIndex; ci++)
{
childStates.add(LEAF_NO_STATE);
}
}
childStates.add(new Object[]{null, descendantSavedState});
}
}
else
{
if (childStates == null)
{
childEmptyIndex++;
}
else
{
childStates.add(LEAF_NO_STATE);
}
}
}
totalChildCount++;
}
} |
File | Line |
---|
org/apache/myfaces/application/TreeStructureManager.java | 52 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java | 1347 |
private static TreeStructComponent internalBuildTreeStructureToSave(UIComponent component)
{
TreeStructComponent structComp = new TreeStructComponent(component.getClass().getName(),
component.getId());
//children
if (component.getChildCount() > 0)
{
List<TreeStructComponent> structChildList = new ArrayList<TreeStructComponent>();
for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
{
UIComponent child = component.getChildren().get(i);
if (!child.isTransient())
{
TreeStructComponent structChild = internalBuildTreeStructureToSave(child);
structChildList.add(structChild);
}
}
TreeStructComponent[] childArray = structChildList.toArray(new TreeStructComponent[structChildList.size()]);
structComp.setChildren(childArray);
}
//facets
if (component.getFacetCount() > 0)
{
Map<String, UIComponent> facetMap = component.getFacets();
List<Object[]> structFacetList = new ArrayList<Object[]>();
for (Map.Entry<String, UIComponent> entry : facetMap.entrySet())
{
UIComponent child = entry.getValue();
if (!child.isTransient())
{
String facetName = entry.getKey();
TreeStructComponent structChild = internalBuildTreeStructureToSave(child);
structFacetList.add(new Object[] {facetName, structChild});
}
}
Object[] facetArray = structFacetList.toArray(new Object[structFacetList.size()]);
structComp.setFacets(facetArray);
}
return structComp;
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java | 171 |
org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java | 579 |
public static UIComponent findComponentChildOrFacetFrom(UIComponent parent, String id, String innerExpr)
{
if (parent.getFacetCount() > 0)
{
for (UIComponent facet : parent.getFacets().values())
{
if (id.equals(facet.getId()))
{
if (innerExpr == null)
{
return facet;
}
else if (facet instanceof NamingContainer)
{
UIComponent find = facet.findComponent(innerExpr);
if (find != null)
{
return find;
}
}
}
else if (!(facet instanceof NamingContainer))
{
UIComponent find = findComponentChildOrFacetFrom(facet, id, innerExpr);
if (find != null)
{
return find;
}
}
}
}
if (parent.getChildCount() > 0)
{
for (int i = 0, childCount = parent.getChildCount(); i < childCount; i++)
{
UIComponent child = parent.getChildren().get(i);
if (id.equals(child.getId()))
{
if (innerExpr == null)
{
return child;
}
else if (child instanceof NamingContainer)
{
UIComponent find = child.findComponent(innerExpr);
if (find != null)
{
return find;
}
}
}
else if (!(child instanceof NamingContainer))
{
UIComponent find = findComponentChildOrFacetFrom(child, id, innerExpr);
if (find != null)
{
return find;
}
}
}
}
return null;
} |
File | Line |
---|
org/apache/myfaces/application/ViewHandlerImpl.java | 189 |
org/apache/myfaces/application/jsp/JspViewHandlerImpl.java | 150 |
}
/**
* Get the locales specified as acceptable by the original request, compare them to the
* locales supported by this Application and return the best match.
*/
@Override
public Locale calculateLocale(FacesContext facesContext)
{
Application application = facesContext.getApplication();
for (Iterator<Locale> requestLocales = facesContext.getExternalContext().getRequestLocales(); requestLocales
.hasNext();)
{
Locale requestLocale = requestLocales.next();
for (Iterator<Locale> supportedLocales = application.getSupportedLocales(); supportedLocales.hasNext();)
{
Locale supportedLocale = supportedLocales.next();
// higher priority to a language match over an exact match
// that occures further down (see Jstl Reference 1.0 8.3.1)
if (requestLocale.getLanguage().equals(supportedLocale.getLanguage())
&& (supportedLocale.getCountry() == null || supportedLocale.getCountry().length() == 0))
{
return supportedLocale;
}
else if (supportedLocale.equals(requestLocale))
{
return supportedLocale;
}
}
}
Locale defaultLocale = application.getDefaultLocale();
return defaultLocale != null ? defaultLocale : Locale.getDefault();
}
@Override
public String calculateRenderKitId(FacesContext facesContext)
{
Object renderKitId = facesContext.getExternalContext().getRequestMap().get(
ResponseStateManager.RENDER_KIT_ID_PARAM);
if (renderKitId == null)
{
renderKitId = facesContext.getApplication().getDefaultRenderKitId();
}
if (renderKitId == null)
{
renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
}
return renderKitId.toString();
}
/**
* Create a UIViewRoot object and return it; the returned object has no children.
* <p>
* As required by the spec, the returned object inherits locale and renderkit settings from
* the viewRoot currently configured for the facesContext (if any). This means that on navigation
* from one view to another these settings are "inherited".
*/
@Override
public UIViewRoot createView(FacesContext facesContext, String viewId) |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 240 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 227 |
_currentKey = _i.next();
return getValue(_currentKey);
}
protected abstract E getValue(String attributeName);
}
private final class KeyIterator extends AbstractAttributeIterator<String>
{
@Override
protected String getValue(final String attributeName)
{
return attributeName;
}
}
private class Values extends AbstractAttributeSet<V>
{
@Override
public Iterator<V> iterator()
{
return new ValuesIterator();
}
@Override
public boolean contains(final Object o)
{
if (o == null)
{
return false;
}
for (final Iterator<V> it = iterator(); it.hasNext();)
{
if (o.equals(it.next()))
{
return true;
}
}
return false;
}
@Override
public boolean remove(final Object o)
{
if (o == null)
{
return false;
}
for (final Iterator<V> it = iterator(); it.hasNext();)
{
if (o.equals(it.next()))
{
it.remove();
return true;
}
}
return false;
}
}
private class ValuesIterator extends AbstractAttributeIterator<V>
{
@Override
protected V getValue(final String attributeName)
{
return AbstractThreadSafeAttributeMap.this.get(attributeName); |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 299 |
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 620 |
checkForDuplicateIds(context, kid, ids);
}
}
private static String getPathToComponent(UIComponent component)
{
StringBuffer buf = new StringBuffer();
if(component == null)
{
buf.append("{Component-Path : ");
buf.append("[null]}");
return buf.toString();
}
getPathToComponent(component,buf);
buf.insert(0,"{Component-Path : ");
buf.append("}");
return buf.toString();
}
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
{
return;
}
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf.toString());
getPathToComponent(component.getParent(),buf);
}
@Override
public void writeState(FacesContext facesContext, |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/TextUnit.java | 512 |
org/apache/myfaces/view/facelets/compiler/TextUnit.java | 646 |
if (text != null && text.length() > 0)
{
int firstCharLocation = -1;
int leftChar = 0; // 0=first char on left 1=\n 2=\r 3=\r\n
int lenght = text.length();
String leftText = null;
for (int j = 0; j < lenght; j++)
{
char c = text.charAt(j);
if (leftChar == 0)
{
if (c == '\r')
{
leftChar = 2;
if (j+1 < lenght)
{
if (text.charAt(j+1) == '\n')
{
leftChar = 3;
}
}
}
if (c == '\n')
{
leftChar = 1;
}
}
if (Character.isWhitespace(c))
{
continue;
}
else
{
firstCharLocation = j;
break;
}
}
if (firstCharLocation == -1)
{
firstCharLocation = lenght;
}
// Define the character on the left
if (firstCharLocation > 0)
{
switch (leftChar)
{
case 1:
leftText = "\n";
break;
case 2:
leftText = "\r";
break;
case 3:
leftText = "\r\n";
break;
default:
leftText = (lenght > 1) ? text.substring(0,1) : text;
break;
}
}
else
{
leftText = "";
} |
File | Line |
---|
org/apache/myfaces/application/ApplicationImpl.java | 1740 |
org/apache/myfaces/application/ApplicationImpl.java | 2287 |
if(isProduction && _classToResourceDependencyMap.containsKey(inspectedClass))
{
dependencyList = _classToResourceDependencyMap.get(inspectedClass);
if(dependencyList == null)
{
return; //class has been inspected and did not contain any resource dependency annotations
}
else if (dependencyList.isEmpty())
{
return;
}
isCachedList = true; // else annotations were found in the cache
}
if(dependencyList == null) //not in production or the class hasn't been inspected yet
{
ResourceDependency dependency = inspectedClass.getAnnotation(ResourceDependency.class);
ResourceDependencies dependencies = inspectedClass.getAnnotation(ResourceDependencies.class);
if(dependency != null || dependencies != null)
{
//resource dependencies were found using one or both annotations, create and build a new list
dependencyList = new ArrayList<ResourceDependency>();
if(dependency != null)
{
dependencyList.add(dependency);
}
if(dependencies != null)
{
dependencyList.addAll(Arrays.asList(dependencies.value()));
}
}
else
{
dependencyList = Collections.emptyList();
}
}
// resource dependencies were found through inspection or from cache, handle them
if (dependencyList != null && !dependencyList.isEmpty())
{
for (int i = 0, size = dependencyList.size(); i < size; i++)
{
ResourceDependency dependency = dependencyList.get(i);
if (!rvc.isResourceDependencyAlreadyProcessed(dependency))
{ |
File | Line |
---|
org/apache/myfaces/taglib/core/ValidatorImplTag.java | 116 |
org/apache/myfaces/taglib/core/ValidatorTag.java | 72 |
protected Validator createValidator() throws javax.servlet.jsp.JspException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
if (null != _binding)
{
Object validator;
try
{
validator = _binding.getValue(elContext);
}
catch (Exception e)
{
throw new JspException("Error while creating the Validator", e);
}
if (validator instanceof Validator)
{
return (Validator)validator;
}
}
Application application = facesContext.getApplication();
Validator validator = null;
try
{
// first check if an ValidatorId was set by a method
if (null != _validatorIdString)
{
validator = application.createValidator(_validatorIdString);
}
else if (null != _validatorId)
{
String validatorId = (String)_validatorId.getValue(elContext);
validator = application.createValidator(validatorId);
}
}
catch (Exception e)
{
throw new JspException("Error while creating the Validator", e);
}
if (null != validator)
{
if (null != _binding)
{
_binding.setValue(elContext, validator);
}
return validator;
}
throw new JspException("validatorId and/or binding must be specified");
}
} |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 114 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 102 |
return _keySet;
}
@Override
public final V put(final String key, final V value)
{
final V retval = getAttribute(key);
setAttribute(key, value);
return retval;
}
@Override
public void putAll(final Map<? extends String, ? extends V> t)
{
for (final Entry<? extends String, ? extends V> entry : t.entrySet())
{
setAttribute(entry.getKey(), entry.getValue());
}
}
@Override
public final V remove(final Object key)
{
final String keyString = key.toString();
final V retval = getAttribute(keyString);
removeAttribute(keyString);
return retval;
}
@Override
public int size()
{
int size = 0;
for (final Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
{
size++;
e.nextElement();
}
return size;
}
@Override
public Collection<V> values()
{ |
File | Line |
---|
org/apache/myfaces/config/impl/digester/elements/Attribute.java | 54 |
org/apache/myfaces/config/impl/digester/elements/Property.java | 56 |
public void addDescription(String value)
{
if(_description == null)
{
_description = new ArrayList<String>();
}
_description.add(value);
}
public Collection<? extends String> getDescriptions()
{
if(_description == null)
{
return Collections.emptyList();
}
return _description;
}
public void addDisplayName(String value)
{
if(_displayName == null)
{
_displayName = new ArrayList<String>();
}
_displayName.add(value);
}
public Collection<? extends String> getDisplayNames()
{
if(_displayName==null)
{
return Collections.emptyList();
}
return _displayName;
}
public void addIcon(String value)
{
if(_icon == null)
{
_icon = new ArrayList<String>();
}
_icon.add(value);
}
public Collection<? extends String> getIcons()
{
if(_icon == null)
{
return Collections.emptyList();
}
return _icon;
}
public void setPropertyName(String propertyName) |
File | Line |
---|
org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java | 76 |
org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java | 76 |
FacesContext facesContext = FacesContext.getCurrentInstance();
Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
if (location != null)
{
UIComponent ccParent
= CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
if (ccParent != null)
{
component.getAttributes().put(
CompositeComponentELUtils.CC_FIND_COMPONENT_EXPRESSION,
ComponentSupport.getFindComponentExpression(facesContext, ccParent));
}
}
// If this is an ajax request and the view is being refreshed and a PostAddToViewEvent
// was propagated to relocate this resource, means the header must be refreshed.
// Note ajax request does not occur on non postback requests.
if (!ExternalContextUtils.isPortlet(facesContext.getExternalContext()) &&
facesContext.getPartialViewContext().isAjaxRequest() )
{
boolean isBuildingInitialState = facesContext.getAttributes().
containsKey(IS_BUILDING_INITIAL_STATE);
// The next condition takes into account the current request is an ajax request.
boolean isPostAddToViewEventAfterBuildInitialState =
!isBuildingInitialState ||
(isBuildingInitialState &&
FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext));
if (isPostAddToViewEventAfterBuildInitialState &&
MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).
isStrictJsf2RefreshTargetAjax())
{
//!(component.getParent() instanceof ComponentResourceContainer)
RequestViewContext requestViewContext = RequestViewContext.getCurrentInstance(facesContext);
requestViewContext.setRenderTarget("head", true);
}
}
facesContext.getViewRoot().addComponentResource(facesContext,
component, "head"); |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java | 88 |
org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java | 115 |
(_default == null || _default.isLiteral() ))
{
_cacheable = true;
}
else
{
_cacheable = false;
}
}
@SuppressWarnings("unchecked")
public void apply(FaceletContext ctx, UIComponent parent)
throws IOException
{
UIComponent compositeBaseParent
= FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
CompositeComponentBeanInfo beanInfo =
(CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
.get(UIComponent.BEANINFO_KEY);
if (beanInfo == null)
{
if (log.isLoggable(Level.SEVERE))
{
log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
}
return;
}
BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
//1. Obtain the list mentioned as "targetList" on ViewDeclarationLanguage.retargetAttachedObjects
List<AttachedObjectTarget> targetList = (List<AttachedObjectTarget>)
beanDescriptor.getValue(
AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY);
if (targetList == null)
{
//2. If not found create it and set
targetList = new ArrayList<AttachedObjectTarget>();
beanDescriptor.setValue(
AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY,
targetList);
}
//3. Create the instance of AttachedObjectTarget
if (isCacheable())
{
if (_target == null)
{
_target = createAttachedObjectTarget(ctx);
}
targetList.add(_target);
}
else
{ |
File | Line |
---|
org/apache/myfaces/taglib/core/ConverterImplTag.java | 106 |
org/apache/myfaces/taglib/core/ConverterTag.java | 77 |
protected Converter createConverter() throws JspException
{
Converter converter = null;
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
// try to create the converter from the binding expression first, and then from
// the converterId
if (_binding != null)
{
try
{
converter = (Converter)_binding.getValue(elContext);
if (converter != null)
{
return converter;
}
}
catch (Exception e)
{
throw new JspException("Exception creating converter using binding", e);
}
}
if ((_converterId != null) || (_converterIdString != null))
{
try
{
if (null != _converterIdString)
{
converter = facesContext.getApplication().createConverter(_converterIdString);
}
else
{
String converterId = (String)_converterId.getValue(elContext);
converter = facesContext.getApplication().createConverter(converterId);
}
// with binding no converter was created, set its value with the converter
// created using the converterId
if (converter != null && _binding != null)
{
_binding.setValue(elContext, converter);
}
}
catch (Exception e)
{
throw new JspException("Exception creating converter with converterId: " + _converterId, e);
}
} |
File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 1045 |
org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java | 518 |
}
return object;
}
finally
{
if (ois != null)
{
ois.close();
ois = null;
}
}
}
catch (PrivilegedActionException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
catch (IOException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
catch (ClassNotFoundException e)
{
log.log(Level.SEVERE, "Exiting deserializeView - Could not deserialize state: " + e.getMessage(), e);
return null;
}
}
else if (state instanceof Object[])
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting deserializeView - state not serialized.");
}
return state;
}
else if(state == null)
{
log.severe("Exiting deserializeView - this method should not be called with a null-state.");
return null;
}
else
{
log.severe("Exiting deserializeView - this method should not be called with a state of type : "
+ state.getClass());
return null;
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java | 145 |
org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java | 199 |
{
tempBeanInfo = _createCompositeComponentMetadata(ctx, compositeBaseParent);
compositeBaseParent.getAttributes().put(
UIComponent.BEANINFO_KEY, tempBeanInfo);
try
{
mctx.pushCompositeComponentToStack(compositeBaseParent);
// Store the ccLevel key here
if (!compositeBaseParent.getAttributes().containsKey(CompositeComponentELUtils.LEVEL_KEY))
{
compositeBaseParent.getAttributes()
.put(CompositeComponentELUtils.LEVEL_KEY, mctx.getCompositeComponentLevel());
}
_nextHandler.apply(ctx, parent);
Collection<String> declaredDefaultValues = null;
for (PropertyDescriptor pd : tempBeanInfo.getPropertyDescriptors())
{
if (pd.getValue("default") != null)
{
if (declaredDefaultValues == null)
{
declaredDefaultValues = new ArrayList<String>();
}
declaredDefaultValues.add(pd.getName());
}
}
if (declaredDefaultValues == null)
{
declaredDefaultValues = Collections.emptyList();
}
tempBeanInfo.getBeanDescriptor().
setValue(UIComponent.ATTRS_WITH_DECLARED_DEFAULT_VALUES, declaredDefaultValues);
}
finally
{
mctx.popCompositeComponentToStack(); |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 53 |
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 178 |
}
@Override
protected Object getComponentStateToSave(FacesContext facesContext)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering getComponentStateToSave");
}
UIViewRoot viewRoot = facesContext.getViewRoot();
if (viewRoot.isTransient())
{
return null;
}
Object serializedComponentStates = viewRoot.processSaveState(facesContext);
//Locale is a state attribute of UIViewRoot and need not be saved explicitly
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting getComponentStateToSave");
}
return serializedComponentStates;
}
/**
* Return an object which contains info about the UIComponent type
* of each node in the view tree. This allows an identical UIComponent
* tree to be recreated later, though all the components will have
* just default values for their members.
*/
@Override
protected Object getTreeStructureToSave(FacesContext facesContext)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering getTreeStructureToSave");
}
UIViewRoot viewRoot = facesContext.getViewRoot();
if (viewRoot.isTransient())
{
return null;
}
TreeStructureManager tsm = new TreeStructureManager();
Object retVal = tsm.buildTreeStructureToSave(viewRoot);
if (log.isLoggable(Level.FINEST))
{
log.finest("Exiting getTreeStructureToSave");
}
return retVal;
}
/**
* Given a tree of UIComponent objects created the default constructor
* for each node, retrieve saved state info (from either the client or
* the server) and walk the tree restoring the members of each node
* from the saved state information.
*/
@Override |
File | Line |
---|
org/apache/myfaces/application/viewstate/RandomKeyFactory.java | 75 |
org/apache/myfaces/application/viewstate/SecureRandomKeyFactory.java | 97 |
sessionIdGenerator.getRandomBytes(array);
for (int i = 0; i < array.length; i++)
{
key[i] = array[i];
}
int value = generateCounterKey(facesContext);
key[array.length] = (byte) (value >>> 24);
key[array.length + 1] = (byte) (value >>> 16);
key[array.length + 2] = (byte) (value >>> 8);
key[array.length + 3] = (byte) (value);
return key;
}
@Override
public String encode(byte[] key)
{
return new String(Hex.encodeHex(key));
}
@Override
public byte[] decode(String value)
{
try
{
return Hex.decodeHex(value.toCharArray());
}
catch (DecoderException ex)
{
// Cannot decode, ignore silently, later it will be handled as
// ViewExpiredException
}
return null;
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/component/UIRepeat.java | 358 |
org/apache/myfaces/view/facelets/component/UIRepeat.java | 401 |
UIComponent component = parent.getChildren().get(i);
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
if (!component.isTransient())
{
if (descendantStateIndex == -1)
{
stateCollection = ((List<? extends Object[]>) state);
descendantStateIndex = stateCollection.isEmpty() ? -1 : 0;
}
if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size())
{
Object[] object = stateCollection.get(descendantStateIndex);
if (object[0] != null && component instanceof EditableValueHolder)
{
((SavedState) object[0]).restoreState((EditableValueHolder) component);
}
// If there is descendant state to restore, call it recursively, otherwise
// it is safe to skip iteration.
if (object[1] != null)
{
restoreDescendantComponentStates(component, restoreChildFacets, object[1], true);
}
else
{
restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
}
}
else
{
restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
}
descendantStateIndex++;
}
}
} |
File | Line |
---|
org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java | 185 |
org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java | 161 |
if (!facesContext.isProjectStage(ProjectStage.Production))
{
facesContext.addMessage(component.getClientId(facesContext),
new FacesMessage("Component with no name and no body content, so nothing rendered."));
}
}
}
}
@Override
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException
{
super.encodeEnd(facesContext, component); //check for NP
Map<String, Object> componentAttributesMap = component.getAttributes();
String resourceName = (String) componentAttributesMap.get(JSFAttr.NAME_ATTR);
String libraryName = (String) componentAttributesMap.get(JSFAttr.LIBRARY_ATTR);
if (resourceName == null)
{
//log.warn("Trying to encode resource represented by component" +
// component.getClientId() + " without resourceName."+
// " It will be silenty ignored.");
return;
}
if ("".equals(resourceName))
{
return;
}
String additionalQueryParams = null;
int index = resourceName.indexOf('?');
if (index >= 0)
{
additionalQueryParams = resourceName.substring(index + 1);
resourceName = resourceName.substring(0, index);
}
Resource resource;
if (libraryName == null)
{
if (ResourceUtils.isRenderedStylesheet(facesContext, libraryName, resourceName)) |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 310 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 532 |
if (inDocument && inCompositeInterface &&
!unit.getFaceletsProcessingInstructions().isConsumeXMLComments())
{
this.unit.writeComment(new String(ch, start, length));
}
}
protected TagAttributes createAttributes(Attributes attrs)
{
int len = attrs.getLength();
TagAttribute[] ta = new TagAttribute[len];
for (int i = 0; i < len; i++)
{
ta[i] = new TagAttributeImpl(this.createLocation(), attrs.getURI(i), attrs.getLocalName(i), attrs
.getQName(i), attrs.getValue(i));
}
return new TagAttributesImpl(ta);
}
protected Location createLocation()
{
return new Location(this.alias, this.locator.getLineNumber(), this.locator.getColumnNumber());
}
public void endCDATA() throws SAXException
{
if (this.inDocument && inCompositeInterface) |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 104 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 310 |
if (this.inDocument && inMetadata && !unit.getFaceletsProcessingInstructions().isConsumeXMLComments())
{
this.unit.writeComment(new String(ch, start, length));
}
}
protected TagAttributes createAttributes(Attributes attrs)
{
int len = attrs.getLength();
TagAttribute[] ta = new TagAttribute[len];
for (int i = 0; i < len; i++)
{
ta[i] = new TagAttributeImpl(this.createLocation(), attrs.getURI(i), attrs.getLocalName(i), attrs
.getQName(i), attrs.getValue(i));
}
return new TagAttributesImpl(ta);
}
protected Location createLocation()
{
return new Location(this.alias, this.locator.getLineNumber(), this.locator.getColumnNumber());
}
public void endCDATA() throws SAXException
{
if (this.inDocument && inMetadata) |
File | Line |
---|
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageStrategy.java | 100 |
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java | 135 |
if (mappings == null)
{
return null;
}
// Make sure the mappings contain something
mappings = mappings.trim();
if (mappings.length() == 0)
{
return null;
}
return Pattern.compile(toRegex(mappings));
}
private String loadFaceletExtension(ExternalContext context)
{
assert context != null;
String suffix = context.getInitParameter(ViewHandler.FACELETS_SUFFIX_PARAM_NAME);
if (suffix == null)
{
suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
}
else
{
suffix = suffix.trim();
if (suffix.length() == 0)
{
suffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
}
}
return suffix;
}
/**
* Convert the specified mapping string to an equivalent regular expression.
*
* @param mappings
* le mapping string
*
* @return an uncompiled regular expression representing the mappings
*/
private String toRegex(String mappings)
{
assert mappings != null;
// Get rid of spaces
mappings = mappings.replaceAll("\\s", "");
// Escape '.'
mappings = mappings.replaceAll("\\.", "\\\\.");
// Change '*' to '.*' to represent any match
mappings = mappings.replaceAll("\\*", ".*");
// Split the mappings by changing ';' to '|'
mappings = mappings.replaceAll(";", "|");
return mappings;
} |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 103 |
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 405 |
}
@Override
public UIViewRoot restoreView(FacesContext facesContext, String viewId, String renderKitId)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering restoreView - viewId: " + viewId + " ; renderKitId: " + renderKitId);
}
UIViewRoot uiViewRoot = null;
ViewDeclarationLanguage vdl = facesContext.getApplication().
getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
StateManagementStrategy sms = null;
if (vdl != null)
{
sms = vdl.getStateManagementStrategy(facesContext, viewId);
}
if (sms != null)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Redirect to StateManagementStrategy: " + sms.getClass().getName());
}
uiViewRoot = sms.restoreView(facesContext, viewId, renderKitId);
}
else
{
RenderKit renderKit = getRenderKitFactory().getRenderKit(facesContext, renderKitId);
ResponseStateManager responseStateManager = renderKit.getResponseStateManager();
Object state; |
File | Line |
---|
org/apache/myfaces/config/annotation/DefaultAnnotationProvider.java | 672 |
org/apache/myfaces/config/util/JarUtils.java | 34 |
public static JarFile getJarFile(URL url) throws IOException
{
URLConnection conn = url.openConnection();
conn.setUseCaches(false);
conn.setDefaultUseCaches(false);
JarFile jarFile;
if (conn instanceof JarURLConnection)
{
jarFile = ((JarURLConnection) conn).getJarFile();
}
else
{
jarFile = _getAlternativeJarFile(url);
}
return jarFile;
}
/**
* taken from org.apache.myfaces.view.facelets.util.Classpath
*
* For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile
* object all the same. Known servlet engines that function like this include Weblogic and OC4J. This is not a full
* solution, since an unpacked WAR or EAR will not have JAR "files" as such.
*/
private static JarFile _getAlternativeJarFile(URL url) throws IOException
{
String urlFile = url.getFile();
// Trim off any suffix - which is prefixed by "!/" on Weblogic
int separatorIndex = urlFile.indexOf("!/");
// OK, didn't find that. Try the less safe "!", used on OC4J
if (separatorIndex == -1)
{
separatorIndex = urlFile.indexOf('!');
}
if (separatorIndex != -1)
{
String jarFileUrl = urlFile.substring(0, separatorIndex);
// And trim off any "file:" prefix.
if (jarFileUrl.startsWith("file:"))
{
jarFileUrl = jarFileUrl.substring("file:".length());
}
return new JarFile(jarFileUrl);
}
return null;
} |
File | Line |
---|
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java | 1039 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java | 1088 |
componentAddedAfterBuildView
= (ComponentState) child.getAttributes().get(COMPONENT_ADDED_AFTER_BUILD_VIEW);
if (componentAddedAfterBuildView != null)
{
if (ComponentState.REMOVE_ADD.equals(componentAddedAfterBuildView))
{
registerOnAddRemoveList(context, child.getClientId(context));
child.getAttributes().put(COMPONENT_ADDED_AFTER_BUILD_VIEW, ComponentState.ADDED);
}
else if (ComponentState.ADD.equals(componentAddedAfterBuildView))
{
registerOnAddList(context, child.getClientId(context));
child.getAttributes().put(COMPONENT_ADDED_AFTER_BUILD_VIEW, ComponentState.ADDED);
}
else if (ComponentState.ADDED.equals(componentAddedAfterBuildView))
{
registerOnAddList(context, child.getClientId(context));
}
//Save all required info to restore the subtree.
//This includes position, structure and state of subtree
ensureClearInitialState(child);
states.put(child.getClientId(context),new AttachedFullStateWrapper(new Object[]{
component.getClientId(context), |
File | Line |
---|
org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java | 59 |
org/apache/myfaces/config/impl/digester/elements/Factory.java | 30 |
private List<String> applicationFactories = new ArrayList<String>();
private List<String> exceptionHandlerFactories = new ArrayList<String>();
private List<String> externalContextFactories = new ArrayList<String>();
private List<String> facesContextFactories = new ArrayList<String>();
private List<String> lifecycleFactories = new ArrayList<String>();
private List<String> ViewDeclarationLanguageFactories = new ArrayList<String>();
private List<String> partialViewContextFactories = new ArrayList<String>();
private List<String> renderKitFactories = new ArrayList<String>();
private List<String> tagHandlerDelegateFactories = new ArrayList<String>();
private List<String> visitContextFactories = new ArrayList<String>();
private List<String> faceletCacheFactories = new ArrayList<String>(); |
File | Line |
---|
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionActionListener.java | 54 |
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionValidator.java | 57 |
getMethodExpression().invoke(FacesContext.getCurrentInstance().getELContext(), new Object[]{event});
}
private MethodExpression getMethodExpression()
{
return getMethodExpression(FacesContext.getCurrentInstance().getELContext());
}
private MethodExpression getMethodExpression(ELContext context)
{
Object meOrVe = valueExpression.getValue(context);
if (meOrVe instanceof MethodExpression)
{
return (MethodExpression) meOrVe;
}
else if (meOrVe instanceof ValueExpression)
{
while (meOrVe != null && meOrVe instanceof ValueExpression)
{
meOrVe = ((ValueExpression)meOrVe).getValue(context);
}
return (MethodExpression) meOrVe;
}
else
{
return null;
}
}
public ValueExpression getWrapped()
{
return valueExpression;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
this.valueExpression = (ValueExpression) in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.valueExpression);
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/el/RedirectMethodExpressionValueExpressionActionListener.java | 54 |
org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java | 128 |
return valueExpression.isLiteralText();
}
private MethodExpression getMethodExpression()
{
return getMethodExpression(FacesContext.getCurrentInstance().getELContext());
}
private MethodExpression getMethodExpression(ELContext context)
{
Object meOrVe = valueExpression.getValue(context);
if (meOrVe instanceof MethodExpression)
{
return (MethodExpression) meOrVe;
}
else if (meOrVe instanceof ValueExpression)
{
while (meOrVe != null && meOrVe instanceof ValueExpression)
{
meOrVe = ((ValueExpression)meOrVe).getValue(context);
}
return (MethodExpression) meOrVe;
}
else
{
return null;
}
}
public ValueExpression getWrapped()
{
return valueExpression;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
this.valueExpression = (ValueExpression) in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.valueExpression);
}
} |
File | Line |
---|
org/apache/myfaces/application/viewstate/RandomKeyFactory.java | 45 |
org/apache/myfaces/application/viewstate/SecureRandomKeyFactory.java | 68 |
}
public Integer generateCounterKey(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Object sessionObj = externalContext.getSession(true);
Integer sequence;
synchronized (sessionObj) // are handled at the same time for the session
{
Map<String, Object> map = externalContext.getSessionMap();
sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
if (sequence == null || sequence.intValue() == Integer.MAX_VALUE)
{
sequence = Integer.valueOf(1);
}
else
{
sequence = Integer.valueOf(sequence.intValue() + 1);
}
map.put(RendererUtils.SEQUENCE_PARAM, sequence);
}
return sequence;
}
@Override
public byte[] generateKey(FacesContext facesContext)
{
byte[] array = new byte[length];
byte[] key = new byte[length + 4]; |
File | Line |
---|
org/apache/myfaces/renderkit/html/HtmlScriptRenderer.java | 135 |
org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java | 115 |
}
}
@Override
public boolean getRendersChildren()
{
return true;
}
@Override
public void encodeChildren(FacesContext facesContext, UIComponent component)
throws IOException
{
if (facesContext == null)
{
throw new NullPointerException("context");
}
if (component == null)
{
throw new NullPointerException("component");
}
Map<String, Object> componentAttributesMap = component.getAttributes();
String resourceName = (String) componentAttributesMap.get(JSFAttr.NAME_ATTR);
boolean hasChildren = component.getChildCount() > 0;
if (resourceName != null && (!"".equals(resourceName)) )
{
if (hasChildren)
{
log.info("Component with resourceName "+ resourceName +
" and child components found. Child components will be ignored.");
}
}
else
{
if (hasChildren)
{
ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HTML.STYLE_ELEM, component); |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 398 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 385 |
return AbstractThreadSafeAttributeMap.this.put(_currentKey, value);
}
@Override
public int hashCode()
{
int result = 1;
result = 31 * result + ((_currentKey == null) ? 0 : _currentKey.hashCode());
return result;
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final EntrySetEntry other = (EntrySetEntry)obj;
if (_currentKey == null)
{
if (other._currentKey != null)
{
return false;
}
}
else if (!_currentKey.equals(other._currentKey))
{
return false;
}
return true;
}
}
} |
File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 896 |
org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java | 369 |
}
protected Object serializeView(FacesContext context, Object serializedView)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Entering serializeView");
}
if(isSerializeStateInSession(context))
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize state in session");
}
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try
{
OutputStream os = baos;
if(isCompressStateInSession(context))
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize compressed");
}
os.write(COMPRESSED_FLAG);
os = new GZIPOutputStream(os, 1024);
}
else
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Processing serializeView - serialize uncompressed");
}
os.write(UNCOMPRESSED_FLAG);
} |
File | Line |
---|
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 363 |
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 548 |
sortedList.add(resource);
}
}
//Check
for (int i = 0; i < sortedList.size(); i++)
{
FacesConfig resource = sortedList.get(i);
if (resource.getOrdering() != null)
{
for (OrderSlot slot : resource.getOrdering().getBeforeList())
{
if (slot instanceof FacesConfigNameSlot)
{
String name = ((FacesConfigNameSlot) slot).getName();
if (name != null && !"".equals(name))
{
boolean founded = false;
for (int j = i-1; j >= 0; j--)
{
if (name.equals(sortedList.get(j).getName()))
{
founded=true;
break;
}
}
if (founded)
{ |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java | 81 |
org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java | 89 |
_handlers = new HashMap<String, DefineHandler>();
for (DefineHandler handler : TagHandlerUtils.findNextByType(nextHandler, DefineHandler.class))
{
_handlers.put(handler.getName(), handler);
if (log.isLoggable(Level.FINE))
{
log.fine(tag + " found Define[" + handler.getName() + "]");
}
}
Collection<ParamHandler> params = TagHandlerUtils.findNextByType(nextHandler, ParamHandler.class);
if (!params.isEmpty())
{
int i = 0;
_params = new ParamHandler[params.size()];
for (ParamHandler handler : params)
{
_params[i++] = handler;
}
}
else
{
_params = null;
}
} |
File | Line |
---|
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 912 |
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 962 |
for (OrderSlot slot : facesConfig.getOrdering().getAfterList())
{
if (slot instanceof FacesConfigNameSlot)
{
FacesConfigNameSlot nameSlot = (FacesConfigNameSlot) slot;
//The resource pointed is not added yet?
boolean alreadyAdded = false;
for (FacesConfig res : postOrderedList)
{
if (nameSlot.getName().equals(res.getName()))
{
alreadyAdded = true;
break;
}
}
if (!alreadyAdded)
{
int indexSlot = -1;
//Find it
for (int i = 0; i < appConfigResources.size(); i++)
{
FacesConfig resource = appConfigResources.get(i);
if (resource.getName() != null && nameSlot.getName().equals(resource.getName()))
{
indexSlot = i;
break;
}
}
//Resource founded on appConfigResources
if (indexSlot != -1)
{
pointingResource = true; |
File | Line |
---|
org/apache/myfaces/view/facelets/el/ELText.java | 195 |
org/apache/myfaces/view/facelets/el/ELText.java | 336 |
}
public void write(Writer out, ELContext ctx) throws ELException, IOException
{
Object v = this.ve.getValue(ctx);
if (v != null)
{
out.write((String) v);
}
}
public String toString(ELContext ctx) throws ELException
{
Object v = this.ve.getValue(ctx);
if (v != null)
{
return v.toString();
}
return null;
}
public void writeText(ResponseWriter out, ELContext ctx) throws ELException, IOException
{
Object v = this.ve.getValue(ctx);
if (v != null)
{
out.writeText((String) v, null);
}
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | 1050 |
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | 1683 |
ValueExpression methodSignatureExpression
= (ValueExpression) propertyDescriptor.getValue("method-signature");
String methodSignature = null;
if (methodSignatureExpression != null)
{
// Check if the value expression holds a method signature
// Note that it could be null, so in that case we don't have to do anything
methodSignature = (String) methodSignatureExpression.getValue(elContext);
}
String targetAttributeName = null;
ValueExpression targetAttributeNameVE = (ValueExpression)
propertyDescriptor.getValue("targetAttributeName");
if (targetAttributeNameVE != null)
{
targetAttributeName = (String) targetAttributeNameVE.getValue(context.getELContext());
if (targetAttributeName == null)
{
targetAttributeName = attributeName;
}
}
else
{
targetAttributeName = attributeName;
}
boolean isKnownTargetAttributeMethod = "action".equals(targetAttributeName)
|| "actionListener".equals(targetAttributeName)
|| "validator".equals(targetAttributeName)
|| "valueChangeListener".equals(targetAttributeName);
// either the attributeName has to be a knownMethod or there has to be a method-signature
if (isKnownTargetAttributeMethod || methodSignature != null)
{ |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 309 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 296 |
return AbstractThreadSafeAttributeMap.this.get(attributeName);
}
}
private final class EntrySet extends AbstractAttributeSet<Entry<String, V>>
{
@Override
public Iterator<Entry<String, V>> iterator()
{
return new EntryIterator();
}
@SuppressWarnings("unchecked")
@Override
public boolean contains(final Object o)
{
if (!(o instanceof Entry))
{
return false;
}
final Entry<String, V> entry = (Entry<String, V>)o;
final Object key = entry.getKey();
final Object value = entry.getValue();
if (key == null || value == null)
{
return false;
}
return value.equals(AbstractThreadSafeAttributeMap.this.get(key)); |
File | Line |
---|
org/apache/myfaces/application/TreeStructureManager.java | 146 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java | 1423 |
UIComponent child = internalRestoreTreeStructure(structChild);
facetMap.put(facetName, child);
}
}
return component;
}
public static class TreeStructComponent implements Serializable
{
private static final long serialVersionUID = 5069109074684737231L;
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
TreeStructComponent(String componentClass, String componentId)
{
_componentClass = componentClass;
_componentId = componentId;
}
public String getComponentClass()
{
return _componentClass;
}
public String getComponentId()
{
return _componentId;
}
void setChildren(TreeStructComponent[] children)
{
_children = children;
}
TreeStructComponent[] getChildren()
{
return _children;
}
Object[] getFacets()
{
return _facets;
}
void setFacets(Object[] facets)
{
_facets = facets;
}
}
} |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 320 |
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java | 421 |
}
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if (component == null)
{
return;
}
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if (component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot)component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0, intBuf.toString());
getPathToComponent(component.getParent(), buf);
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/TextUnit.java | 167 |
org/apache/myfaces/view/facelets/compiler/TextUnit.java | 219 |
ELText[] splitText = ELText.parseAsArray(s);
if (splitText.length > 1)
{
Instruction[] array = new Instruction[splitText.length];
for (int i = 0; i < splitText.length; i++)
{
ELText selText = splitText[i];
if (selText.isLiteral())
{
array[i] = new LiteralNonExcapedTextInstruction(selText.toString());
}
else
{
array[i] = new TextInstruction(this.alias, selText );
}
}
this.instructionBuffer.add(new CompositeTextInstruction(array));
}
else
{
this.instructionBuffer.add(new TextInstruction(this.alias, ELText.parse(s))); |
File | Line |
---|
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java | 403 |
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java | 484 |
protected void setAttribute(String key, Boolean value)
{
throw new UnsupportedOperationException();
}
@Override
protected void removeAttribute(String key)
{
throw new UnsupportedOperationException();
}
@Override
protected Enumeration<String> getAttributeNames()
{
Set<String> attributeNames = new HashSet<String>();
TemplateManagerImpl client;
for (int i = 0; i < _clients.size(); i++)
{
client = _clients.get(i);
if (!client.isParametersMapEmpty())
{
attributeNames.addAll(client.getParametersMap().keySet());
}
}
return new ParameterNameEnumeration(attributeNames.toArray(new String[attributeNames.size()]));
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/UILeaf.java | 243 |
org/apache/myfaces/view/facelets/compiler/_ComponentUtils.java | 423 |
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if (component == null)
{
return;
}
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if (component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot)component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0, intBuf.toString());
getPathToComponent(component.getParent(), buf);
} |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 53 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 49 |
for (String name : names)
{
removeAttribute(name);
}
}
@Override
public final boolean containsKey(final Object key)
{
return getAttribute(key.toString()) != null;
}
@Override
public boolean containsValue(final Object findValue)
{
if (findValue == null)
{
return false;
}
for (final Enumeration<String> e = getAttributeNames(); e.hasMoreElements();)
{
final Object value = getAttribute(e.nextElement());
if (findValue.equals(value))
{
return true;
}
}
return false;
}
@Override
public Set<Entry<String, V>> entrySet()
{ |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 322 |
org/apache/myfaces/view/facelets/compiler/UILeaf.java | 243 |
private void getPathToComponent(UIComponent component, StringBuffer buf)
{
if (component == null)
{
return;
}
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if (component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0, intBuf.toString());
getPathToComponent(component.getParent(), buf);
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java | 364 |
org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | 400 |
}
}
private static class ComponentConfigWrapper implements ComponentConfig
{
protected final TagConfig parent;
protected final String componentType;
protected final String rendererType;
public ComponentConfigWrapper(TagConfig parent, String componentType, String rendererType)
{
this.parent = parent;
this.componentType = componentType;
this.rendererType = rendererType;
}
public String getComponentType()
{
return this.componentType;
}
public String getRendererType()
{
return this.rendererType;
}
public FaceletHandler getNextHandler()
{
return this.parent.getNextHandler();
}
public Tag getTag()
{
return this.parent.getTag();
}
public String getTagId()
{
return this.parent.getTagId();
}
}
private static class UserTagFactory implements TagHandlerFactory |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java | 98 |
org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java | 80 |
public void apply(FaceletContext ctx, UIComponent parent)
throws IOException
{
if (((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
{
String facetName = _name.getValue(ctx);
UIComponent compositeBaseParent
= FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
CompositeComponentBeanInfo beanInfo =
(CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
.get(UIComponent.BEANINFO_KEY);
if (beanInfo == null)
{
if (log.isLoggable(Level.SEVERE))
{
log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
}
return;
}
BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
List<String> facetList = (List<String>) beanDescriptor.getValue(RENDER_FACET_USED); |
File | Line |
---|
org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java | 132 |
org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java | 292 |
= lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
if (matchingCompositeComponent != null)
{
return matchingCompositeComponent;
}
//2. Try to find it using UIComponent.getCurrentCompositeComponent().
// This one will look the direct parent hierarchy of the component,
// to see if the composite component can be found.
if (currentCompositeComponent != null)
{
currentComponent = currentCompositeComponent;
}
else
{
//Try to find the composite component looking directly the parent
//ancestor of the current component
//currentComponent = UIComponent.getCurrentComponent(facesContext);
boolean found = false;
while (currentComponent != null && !found)
{
String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
if (findComponentExpr != null)
{
UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
if (foundComponent != null)
{
Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
if (foundComponentLocation != null
&& foundComponentLocation.getPath().equals(location.getPath()) && |
File | Line |
---|
org/apache/myfaces/config/DefaultFacesConfigurationProvider.java | 371 |
org/apache/myfaces/config/FacesConfigurator.java | 439 |
String configFiles = _externalContext.getInitParameter(FacesServlet.CONFIG_FILES_ATTR);
List<String> configFilesList = new ArrayList<String>();
if (configFiles != null)
{
StringTokenizer st = new StringTokenizer(configFiles, ",", false);
while (st.hasMoreTokens())
{
String systemId = st.nextToken().trim();
if (DEFAULT_FACES_CONFIG.equals(systemId))
{
if (log.isLoggable(Level.WARNING))
{
log.warning(DEFAULT_FACES_CONFIG + " has been specified in the "
+ FacesServlet.CONFIG_FILES_ATTR
+ " context parameter of "
+ "the deployment descriptor. This will automatically be removed, "
+ "if we wouldn't do this, it would be loaded twice. See JSF spec 1.1, 10.3.2");
}
}
else
{
configFilesList.add(systemId);
}
}
}
return configFilesList;
}
private void configureFactories() |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java | 365 |
org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java | 273 |
}
private static class ComponentConfigWrapper implements ComponentConfig
{
protected final TagConfig parent;
protected final String componentType;
protected final String rendererType;
public ComponentConfigWrapper(TagConfig parent, String componentType,
String rendererType)
{
this.parent = parent;
this.componentType = componentType;
this.rendererType = rendererType;
}
public String getComponentType()
{
return this.componentType;
}
public String getRendererType()
{
return this.rendererType;
}
public FaceletHandler getNextHandler()
{
return this.parent.getNextHandler();
}
public Tag getTag()
{
return this.parent.getTag();
}
public String getTagId()
{
return this.parent.getTagId();
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java | 186 |
org/apache/myfaces/view/facelets/compiler/UITextHandler.java | 83 |
throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
}
}
}
public String toString()
{
return this.txt.toString();
}
public String getText()
{
return this.txt.toString();
}
public String getText(FaceletContext ctx)
{
Writer writer = new FastWriter(this.length);
try
{
this.txt.apply(ctx.getExpressionFactory(), ctx).write(writer, ctx);
}
catch (IOException e)
{
throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
}
return writer.toString();
}
} |
File | Line |
---|
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 87 |
org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementHelper.java | 72 |
DefaultFaceletsStateManagementHelper.class.getName() + ".RESTORED_SERIALIZED_VIEW";
/**
* Only applicable if state saving method is "server" (= default).
* Defines the amount (default = 20) of the latest views are stored in session.
*/
private static final String NUMBER_OF_VIEWS_IN_SESSION_PARAM = "org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION";
/**
* Default value for <code>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</code> context parameter.
*/
private static final int DEFAULT_NUMBER_OF_VIEWS_IN_SESSION = 20;
/**
* Only applicable if state saving method is "server" (= default).
* If <code>true</code> (default) the state will be serialized to a byte stream before it is written to the session.
* If <code>false</code> the state will not be serialized to a byte stream.
*/
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).
* 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.
*/
private static final String COMPRESS_SERVER_STATE_PARAM = "org.apache.myfaces.COMPRESS_STATE_IN_SESSION";
/**
* Default value for <code>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</code> context parameter.
*/
private static final boolean DEFAULT_COMPRESS_SERVER_STATE_PARAM = true;
/**
* Default value for <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> context parameter.
*/
private static final boolean DEFAULT_SERIALIZE_STATE_IN_SESSION = true;
/**
* Define the way of handle old view references(views removed from session), making possible to
* store it in a cache, so the state manager first try to get the view from the session. If is it
* not found and soft or weak ReferenceMap is used, it try to get from it.
* <p>
* Only applicable if state saving method is "server" (= default).
* </p>
* <p>
* The gc is responsible for remove the views, according to the rules used for soft, weak or phantom
* references. If a key in soft and weak mode is garbage collected, its values are purged.
* </p>
* <p>
* By default no cache is used, so views removed from session became phantom references.
* </p>
* <ul>
* <li> off, no: default, no cache is used</li>
* <li> hard-soft: use an ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.SOFT)</li>
* <li> soft: use an ReferenceMap(AbstractReferenceMap.SOFT, AbstractReferenceMap.SOFT, true) </li>
* <li> soft-weak: use an ReferenceMap(AbstractReferenceMap.SOFT, AbstractReferenceMap.WEAK, true) </li>
* <li> weak: use an ReferenceMap(AbstractReferenceMap.WEAK, AbstractReferenceMap.WEAK, true) </li>
* </ul>
*
*/
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE = "org.apache.myfaces.CACHE_OLD_VIEWS_IN_SESSION_MODE";
/**
* This option uses an hard-soft ReferenceMap, but it could cause a
* memory leak, because the keys are not removed by any method
* (MYFACES-1660). So use with caution.
*/
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE_HARD_SOFT = "hard-soft";
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT = "soft";
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE_SOFT_WEAK = "soft-weak";
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE_WEAK = "weak";
private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE_OFF = "off";
private static final int UNCOMPRESSED_FLAG = 0;
private static final int COMPRESSED_FLAG = 1;
private static final int JSF_SEQUENCE_INDEX = 0; |
File | Line |
---|
org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java | 682 |
org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java | 185 |
this._names.add(testName);
boolean found = false;
AbstractFaceletContext actx = new DefaultFaceletContext(
(DefaultFaceletContext) ctx, this._owner, false);
ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, actx);
try
{
actx.pushPageContext(this._pageContext);
found = this._target
.apply(actx,
parent, name);
}
finally
{
actx.popPageContext();
}
ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx);
this._names.remove(testName);
return found;
}
}
public Map<String, ValueExpression> getParametersMap() |
File | Line |
---|
org/apache/myfaces/taglib/core/DelegateActionListener.java | 60 |
org/apache/myfaces/taglib/core/DelegateValueChangeListener.java | 57 |
public DelegateValueChangeListener(ValueExpression type, ValueExpression binding)
{
super();
_type = type;
_binding = binding;
}
public boolean isTransient()
{
return false;
}
public void restoreState(FacesContext facesContext, Object state)
{
Object[] values = (Object[]) state;
_type = (ValueExpression) values[0];
_binding = (ValueExpression) values[1];
}
public Object saveState(FacesContext facesContext)
{
Object[] values = new Object[2];
values[0] = _type;
values[1] = _binding;
return values;
}
public void setTransient(boolean arg0)
{
// Do nothing
}
private ValueChangeListener _getDelegate() |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 751 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 856 |
CompositeComponentMetadataHandler handler = new CompositeComponentMetadataHandler(mngr, alias);
SAXParser parser = this.createSAXParser(handler);
parser.parse(is, handler);
}
catch (SAXException e)
{
throw new FaceletException("Error Parsing " + alias + ": " + e.getMessage(), e.getCause());
}
catch (ParserConfigurationException e)
{
throw new FaceletException("Error Configuring Parser " + alias + ": " + e.getMessage(), e.getCause());
}
finally
{
if (is != null)
{
is.close();
}
}
return new EncodingHandler(mngr.createFaceletHandler(), encoding);
} |
File | Line |
---|
org/apache/myfaces/config/annotation/AnnotationConfigurator.java | 218 |
org/apache/myfaces/config/annotation/AnnotationConfigurator.java | 486 |
+ facesBehaviorRenderer.rendererType() + ", "
+ clazz.getName() + ")");
}
org.apache.myfaces.config.impl.digester.elements.RenderKit renderKit =
(org.apache.myfaces.config.impl.digester.elements.RenderKit)
facesConfig.getRenderKit(renderKitId);
if (renderKit == null)
{
renderKit = new org.apache.myfaces.config.impl.digester.elements.RenderKit();
renderKit.setId(renderKitId);
facesConfig.addRenderKit(renderKit);
}
org.apache.myfaces.config.impl.digester.elements.ClientBehaviorRenderer cbr = |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 425 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 659 |
if (this.inDocument && inCompositeInterface)
{
if (!this.unit.getFaceletsProcessingInstructions().isConsumeCDataSections())
{
this.unit.writeInstruction("<![CDATA[");
}
else
{
this.consumingCDATA = true;
this.swallowCDATAContent = this.unit.getFaceletsProcessingInstructions().isSwallowCDataContent();
}
}
}
public void startDocument() throws SAXException
{
this.inDocument = true;
}
public void startDTD(String name, String publicId, String systemId) throws SAXException
{
// metadata does not require output doctype
this.inDocument = false;
}
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
{
if (CompositeLibrary.NAMESPACE.equals(uri)) |
File | Line |
---|
org/apache/myfaces/util/AbstractAttributeMap.java | 358 |
org/apache/myfaces/util/AbstractThreadSafeAttributeMap.java | 345 |
return AbstractThreadSafeAttributeMap.this.remove(((Entry<String, V>)o).getKey()) != null;
}
}
/**
* Not very efficient since it generates a new instance of <code>Entry</code> for each element and still internaly
* uses the <code>KeyIterator</code>. It is more efficient to use the <code>KeyIterator</code> directly.
*/
private final class EntryIterator extends AbstractAttributeIterator<Entry<String, V>>
{
@Override
protected Entry<String, V> getValue(final String attributeName)
{
// Must create new Entry every time--value of the entry must stay
// linked to the same attribute name
return new EntrySetEntry(attributeName);
}
}
private final class EntrySetEntry implements Entry<String, V>
{
private final String _currentKey;
public EntrySetEntry(final String currentKey)
{
_currentKey = currentKey;
}
public String getKey()
{
return _currentKey;
}
public V getValue()
{
return AbstractThreadSafeAttributeMap.this.get(_currentKey); |
File | Line |
---|
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 396 |
org/apache/myfaces/config/DefaultFacesConfigurationMerger.java | 579 |
}
}
}
}
for (OrderSlot slot : resource.getOrdering().getAfterList())
{
if (slot instanceof FacesConfigNameSlot)
{
String name = ((FacesConfigNameSlot) slot).getName();
if (name != null && !"".equals(name))
{
boolean founded = false;
for (int j = i+1; j < sortedList.size(); j++)
{
if (name.equals(sortedList.get(j).getName()))
{
founded=true;
break;
}
}
if (founded)
{ |
File | Line |
---|
org/apache/myfaces/view/facelets/impl/CacheELFaceletCacheImpl.java | 216 |
org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java | 288 |
}
/**
* Template method for determining if the Facelet needs to be refreshed.
*
* @param facelet
* Facelet that could have expired
* @return true if it needs to be refreshed
*/
protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
if (_refreshPeriod == NO_CACHE_DELAY)
{
return true;
}
// if set to -1, never reload
if (_refreshPeriod == INFINITE_DELAY)
{
return false;
}
long target = facelet.getCreateTime() + _refreshPeriod;
if (System.currentTimeMillis() > target)
{
// Should check for file modification
try
{
URLConnection conn = facelet.getSource().openConnection();
long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
return lastModified == 0 || lastModified > target;
}
catch (IOException e)
{
throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
}
}
return false;
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 374 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 608 |
}
}
}
public void endEntity(String name) throws SAXException
{
}
public void endPrefixMapping(String prefix) throws SAXException
{
this.unit.popNamespace(prefix);
}
public void fatalError(SAXParseException e) throws SAXException
{
if (this.locator != null)
{
throw new SAXException("Error Traced[line: " + this.locator.getLineNumber() + "] " + e.getMessage());
}
else
{
throw e;
}
}
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
{
if (this.inDocument && inCompositeInterface) |
File | Line |
---|
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | 1195 |
org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java | 1597 |
UIComponent topLevelComponentBase = topLevelComponent.getFacet(
UIComponent.COMPOSITE_FACET_NAME);
for (String target : targetsArray)
{
UIComponent innerComponent = ComponentSupport.findComponentChildOrFacetFrom(context,
topLevelComponentBase, target);
if (innerComponent == null)
{
continue;
}
// If a component is found, that means the expression should be retarget to the
// components related
if (isCompositeComponentRetarget(context, innerComponent, targetAttributeName))
{
innerComponent.getAttributes().put(targetAttributeName, attributeNameValueExpression);
mctx.clearMethodExpressionAttribute(innerComponent, targetAttributeName);
retargetMethodExpressions(context, innerComponent);
if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
{
//retargetMethodExpression occur on build view time, so it is safe to call markInitiaState here
innerComponent.markInitialState();
}
}
else
{
//Put the retarget
if (ccAttrMeRedirection) |
File | Line |
---|
org/apache/myfaces/el/unified/ResolverBuilderBase.java | 94 |
org/apache/myfaces/el/unified/ResolverBuilderBase.java | 117 |
facesContext.getExternalContext()).isSupportJSPAndFacesEL())
{
if (_config.getVariableResolver() != null)
{
resolvers.add(createELResolver(_config.getVariableResolver()));
}
else if (_config.getVariableResolverChainHead() != null)
{
resolvers.add(createELResolver(_config.getVariableResolverChainHead()));
}
if (_config.getPropertyResolver() != null)
{
resolvers.add(createELResolver(_config.getPropertyResolver()));
}
else if (_config.getPropertyResolverChainHead() != null)
{
resolvers.add(createELResolver(_config.getPropertyResolverChainHead()));
}
} |
File | Line |
---|
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 156 |
org/apache/myfaces/view/facelets/compiler/SAXCompiler.java | 376 |
}
public void endEntity(String name) throws SAXException
{
}
public void endPrefixMapping(String prefix) throws SAXException
{
this.unit.popNamespace(prefix);
}
public void fatalError(SAXParseException e) throws SAXException
{
if (this.locator != null)
{
throw new SAXException("Error Traced[line: " + this.locator.getLineNumber() + "] " + e.getMessage());
}
else
{
throw e;
}
}
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
{
if (this.inDocument && inMetadata) |
File | Line |
---|
org/apache/myfaces/application/ViewHandlerImpl.java | 264 |
org/apache/myfaces/application/jsp/JspViewHandlerImpl.java | 293 |
return getViewHandlerSupport().calculateActionURL(facesContext, viewId);
}
@Override
public String getResourceURL(FacesContext facesContext, String path)
{
if (path.length() > 0 && path.charAt(0) == '/')
{
String contextPath = facesContext.getExternalContext().getRequestContextPath();
if (contextPath == null)
{
return path;
}
else if (contextPath.length() == 1 && contextPath.charAt(0) == '/')
{
// If the context path is root, it is not necessary to append it, otherwise
// and extra '/' will be set.
return path;
}
else
{
return contextPath + path;
}
}
return path;
}
/**
* Generate output to the user by combining the data in the jsp-page specified by viewToRender
* with the existing JSF component tree (if any).
* <p>
* As described in the class documentation, this first runs the jsp-generated servlet to
* create or enhance the JSF component tree - including verbatim nodes for any non-jsf
* data in that page.
* <p>
* The component tree is then walked to generate the appropriate output for each component.
*/
@Override
public void renderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException, FacesException |
File | Line |
---|
org/apache/myfaces/application/StateManagerImpl.java | 172 |
org/apache/myfaces/application/jsp/JspStateManagerImpl.java | 492 |
UIViewRoot uiViewRoot = facesContext.getViewRoot();
String viewId = uiViewRoot.getViewId();
ViewDeclarationLanguage vdl = facesContext.getApplication().
getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
try
{
facesContext.getAttributes().put(StateManager.IS_SAVING_STATE, Boolean.TRUE);
if (vdl != null)
{
StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
if (sms != null)
{
if (log.isLoggable(Level.FINEST))
{
log.finest("Calling saveView of StateManagementStrategy: " + sms.getClass().getName());
} |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/jsf/ComponentHandler.java | 290 |
org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java | 520 |
MetaRuleset m = new MetaRulesetImpl(_delegate.getTag(), type);
// ignore standard component attributes
m.ignore("binding").ignore("id");
// add auto wiring for attributes
m.addRule(ComponentRule.INSTANCE);
// if it's an ActionSource
if (ActionSource.class.isAssignableFrom(type))
{
m.addRule(ActionSourceRule.INSTANCE);
}
// if it's a ValueHolder
if (ValueHolder.class.isAssignableFrom(type))
{
m.addRule(ValueHolderRule.INSTANCE);
// if it's an EditableValueHolder
if (EditableValueHolder.class.isAssignableFrom(type))
{
m.ignore("submittedValue");
m.ignore("valid");
m.addRule(EditableValueHolderRule.INSTANCE);
}
}
return m;
} |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java | 210 |
org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java | 75 |
(CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
.get(UIComponent.BEANINFO_KEY);
if (beanInfo == null)
{
if (log.isLoggable(Level.SEVERE))
{
log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
}
return;
}
BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
Map<String, PropertyDescriptor> facetPropertyDescriptorMap =
(Map<String, PropertyDescriptor>) beanDescriptor.getValue(UIComponent.FACETS_KEY);
if (facetPropertyDescriptorMap == null)
{
facetPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>();
beanDescriptor.setValue(UIComponent.FACETS_KEY, facetPropertyDescriptorMap);
} |
File | Line |
---|
org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java | 97 |
org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java | 86 |
@JSFFaceletAttribute(name="displayName",
className="javax.el.ValueExpression",
deferredValueType="java.lang.String")
private final TagAttribute _displayName;
/**
* Indicate if the attribute is required or not
* <p>
* Myfaces specific feature: this attribute is checked only if project stage is
* not ProjectStage.Production when a composite component is created.
* </p>
*/
@JSFFaceletAttribute(name="required",
className="javax.el.ValueExpression",
deferredValueType="boolean")
private final TagAttribute _required;
/**
* Only available if ProjectStage is Development.
*/
@JSFFaceletAttribute(name="preferred",
className="javax.el.ValueExpression",
deferredValueType="boolean")
private final TagAttribute _preferred;
/**
* Only available if ProjectStage is Development.
*/
@JSFFaceletAttribute(name="expert",
className="javax.el.ValueExpression",
deferredValueType="boolean")
private final TagAttribute _expert;
/**
* Only available if ProjectStage is Development.
*/
@JSFFaceletAttribute(name="shortDescription",
className="javax.el.ValueExpression",
deferredValueType="java.lang.String")
private final TagAttribute _shortDescription;
/**
* The "hidden" flag is used to identify features that are intended only
* for tool use, and which should not be exposed to humans.
* Only available if ProjectStage is Development.
*/
@JSFFaceletAttribute(name="hidden", |
File | Line |
---|
org/apache/myfaces/taglib/core/ConverterImplTag.java | 128 |
org/apache/myfaces/taglib/core/DelegateConverter.java | 132 |
throw new ConverterException("Exception creating converter using binding", e);
}
}
if ((_converterId != null) || (_converterIdString != null))
{
try
{
if (null != _converterIdString)
{
converter = facesContext.getApplication().createConverter(_converterIdString);
}
else
{
String converterId = (String) _converterId.getValue(elContext);
converter = facesContext.getApplication().createConverter(converterId);
}
// with binding no converter was created, set its value with the converter
// created using the converterId
if (converter != null && _binding != null)
{
_binding.setValue(elContext, converter);
}
}
catch (Exception e)
{
throw new ConverterException("Exception creating converter with converterId: " + _converterId, e); |
File | Line |
---|
org/apache/myfaces/config/annotation/DefaultLifecycleProviderFactory.java | 170 |
org/apache/myfaces/config/annotation/DefaultLifecycleProviderFactory.java | 196 |
{
List<String> classList = ServiceProviderFinderFactory.getServiceProviderFinder(extContext).
getServiceProviderList(LIFECYCLE_PROVIDER);
Iterator<String> iter = classList.iterator();
while (iter.hasNext())
{
String className = iter.next();
Object obj = createClass(className,extContext);
if (DiscoverableLifecycleProvider.class.isAssignableFrom(obj.getClass()))
{
DiscoverableLifecycleProvider discoverableLifecycleProvider
= (DiscoverableLifecycleProvider) obj;
if (discoverableLifecycleProvider.isAvailable())
{
extContext.getApplicationMap().put(LIFECYCLE_PROVIDER_INSTANCE_KEY,
discoverableLifecycleProvider);
return (Boolean) true; |