| Method from org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl Detail: |
public UIViewRoot createView(FacesContext context,
String viewId) {
_initIfNeeded(context);
InternalView internal = _getInternalView(context, viewId);
if (internal != null)
{
UIViewRoot root = internal.createView(context, viewId);
if (root != null)
return root;
// Otherwise, fall through to default processing
}
else if (_checkTimestamp(context))
{
try
{
// Check the timestamp on the physical path
String path = _getPath(viewId);
synchronized (_timestamps)
{
Long ts = _timestamps.get(path);
if (ts != _NOT_FOUND)
{
URL url = context.getExternalContext().getResource(path);
Long modified = _getLastModified(url);
_timestamps.put(path, modified);
}
}
}
catch (IOException e)
{
_LOG.severe(e);
}
}
return super.createView(context, viewId);
}
|
public String getActionURL(FacesContext context,
String viewId) {
String actionURL = super.getActionURL(context, viewId);
RequestContext afContext = RequestContext.getCurrentInstance();
if (afContext != null)
{
actionURL = afContext.getPageResolver().encodeActionURI(actionURL);
actionURL = afContext.getPageFlowScopeProvider().
encodeCurrentPageFlowScopeURL(context, actionURL);
}
return actionURL;
}
|
public String getResourceURL(FacesContext context,
String path) {
return super.getResourceURL(context, path);
}
|
protected ViewHandler getWrapped() {
return _delegate;
}
|
public void renderView(FacesContext context,
UIViewRoot viewToRender) throws IOException, FacesException {
_initIfNeeded(context);
// See if there is a possiblity of short-circuiting the current
// Render Response
ExtendedRenderKitService service = _getExtendedRenderKitService(context);
if ((service != null) &&
service.shortCircuitRenderView(context))
{
// Yup, we don't need to do anything
;
}
else
{
try
{
if (service != null)
service.encodeBegin(context);
InternalView internal = _getInternalView(context,
viewToRender.getViewId());
if (internal != null)
{
internal.renderView(context, viewToRender);
}
else
{
super.renderView(context, viewToRender);
}
if (service != null)
service.encodeEnd(context);
}
finally
{
if (service != null)
service.encodeFinally(context);
}
}
}
|
public UIViewRoot restoreView(FacesContext context,
String viewId) {
// If we're being asked to re-run the lifecycle for a "return"
// event, always restore the "launch view", which was set
// over in RequestContextImpl
UIViewRoot launchView = (UIViewRoot)
context.getExternalContext().getRequestMap().get(
RequestContextImpl.LAUNCH_VIEW);
if (launchView != null)
{
context.getExternalContext().getRequestMap().remove(
RequestContextImpl.LAUNCH_VIEW);
TrinidadPhaseListener.markPostback(context);
return launchView;
}
InternalView internal = _getInternalView(context, viewId);
if (internal != null)
{
return internal.restoreView(context, viewId);
}
boolean uptodate = true;
if (_checkTimestamp(context))
{
try
{
// Check the timestamp on the physical path
String path = _getPath(viewId);
synchronized (_timestamps)
{
Long ts = _timestamps.get(path);
if (ts != _NOT_FOUND)
{
URL url = context.getExternalContext().getResource(path);
Long modified = _getLastModified(url);
if (modified == _NOT_FOUND)
{
_timestamps.put(path, _NOT_FOUND);
}
else if ((ts == null) ||
(modified.longValue() > ts.longValue()))
{
_timestamps.put(path, modified);
if (ts != null)
{
_LOG.fine("View document \"" + path + "\" has been modified, " +
"ignoring postback for view \"" + viewId +"\"");
}
uptodate = false;
}
}
}
}
catch (IOException e)
{
_LOG.severe(e);
}
}
if (!uptodate)
{
return null;
}
UIViewRoot result = super.restoreView(context, viewId);
// If we've successfully restored a view, then assume that
// this is a postback request.
if (result != null)
{
TrinidadPhaseListener.markPostback(context);
}
return result;
}
|
public void writeState(FacesContext context) throws IOException {
String viewId = context.getViewRoot().getViewId();
InternalView internal =
_getInternalView(context, viewId);
// As internal views whether they're stateless. If they are, don't
// bother writing anything out.
if ((internal != null) && internal.isStateless(context, viewId))
return;
ExtendedRenderKitService service = _getExtendedRenderKitService(context);
if ((service != null) &&
service.isStateless(context))
return;
super.writeState(context);
}
|