@Override public Resource createResource(String resourceName, String libraryName) { return createResource(resourceName, libraryName, null); }
public Stream<java.lang.String> getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options) { final String localePrefix = getLocalePrefixForLocateResource(facesContext); final List<String> contracts = facesContext.getResourceLibraryContracts(); String contractPreferred = getContractNameForLocateResource(facesContext); if (this._viewSuffixes == null) { this._viewSuffixes = loadSuffixes(facesContext.getExternalContext()); } Iterator it = new FilterInvalidSuffixViewResourceIterator(new ViewResourceIterator(facesContext, getResourceHandlerSupport(), localePrefix, contracts, contractPreferred, path, maxDepth, options), facesContext, _viewSuffixes); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it,Spliterator.DISTINCT), false); }
String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); if (isResourceIdentifierExcluded(facesContext, resourceBasePath)) libraryName, isAllowSlashesLibraryName())) httpServletResponse.setContentType(_getContentType(resource, facesContext.getExternalContext())); extContext.setResponseBufferSize(this.getResourceBufferSize()); OutputStream out = httpServletResponse.getOutputStream(); byte[] buffer = new byte[this.getResourceBufferSize()]; int count = pipeBytes(in, out, buffer); if (isConnectionAbort(e))
String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); if (isResourceIdentifierExcluded(facesContext, resourceBasePath)) httpServletResponse.setContentType(_getContentType(resource, facesContext.getExternalContext())); int count = pipeBytes(in, out, buffer);
libraryName, isAllowSlashesLibraryName())) final String localePrefix = getLocalePrefixForLocateResource(facesContext); final List<String> contracts = facesContext.getResourceLibraryContracts(); String contractPreferred = getContractNameForLocateResource(facesContext); ResourceValue resourceValue = null; resourceValue = getResourceLoaderCache().getResource( resourceName, libraryName, contentType, localePrefix, contractPreferred); resourceValue = getResourceLoaderCache().getResource( resourceName, libraryName, contentType, localePrefix, contract); if (resourceValue != null) resourceValue = getResourceLoaderCache().getResource(resourceName, libraryName, contentType, localePrefix); getResourceHandlerSupport(), contentType, resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null, resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getRequestPath() : null); for (ContractResourceLoader loader : getResourceHandlerSupport().getContractResourceLoaders()) ResourceMeta resourceMeta = deriveResourceMeta(loader, resourceName, libraryName, localePrefix, contractPreferred); if (resourceMeta != null) getResourceHandlerSupport(), contentType); getResourceLoaderCache().putResource(resourceName, libraryName, contentType,
final String localePrefix = getLocalePrefixForLocateResource(); if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType, localePrefix)) ResourceValue resourceValue = getResourceLoaderCache().getResource( resourceName, libraryName, contentType, localePrefix); getResourceHandlerSupport(), contentType); for (ResourceLoader loader : getResourceHandlerSupport().getResourceLoaders()) ResourceMeta resourceMeta = deriveResourceMeta(loader, resourceName, libraryName, localePrefix); resource = new ResourceImpl(resourceMeta, loader, getResourceHandlerSupport(), contentType); getResourceLoaderCache().putResource(resourceName, libraryName, contentType, localePrefix, resourceMeta, loader); break;
final String localePrefix = getLocalePrefixForLocateResource(facesContext); String contentType = facesContext.getExternalContext().getMimeType(resourceName); final List<String> contracts = facesContext.getResourceLibraryContracts(); String contractPreferred = getContractNameForLocateResource(facesContext); ResourceValue resourceValue = null; resourceValue = getResourceLoaderCache().getViewResource( resourceName, contentType, localePrefix, contractPreferred); resourceValue = getResourceLoaderCache().getViewResource( resourceName, contentType, localePrefix, contract); if (resourceValue != null) resourceValue = getResourceLoaderCache().getViewResource( resourceName, contentType, localePrefix); getResourceHandlerSupport(), contentType, resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null, null); for (ContractResourceLoader loader : getResourceHandlerSupport().getContractResourceLoaders()) ResourceMeta resourceMeta = deriveViewResourceMeta( facesContext, loader, resourceName, localePrefix, contractPreferred); if (resourceMeta != null) getResourceHandlerSupport(), contentType); getResourceLoaderCache().putViewResource( resourceName, contentType, localePrefix, contractPreferred, resourceMeta, loader,
String localePrefix = getLocalePrefixForLocateResource(facesContext); final List<String> contracts = facesContext.getResourceLibraryContracts(); Boolean libraryFound = null; if (libraryName != null && !ResourceValidationUtils.isValidLibraryName( libraryName, isAllowSlashesLibraryName())) libraryFound = getResourceLoaderCache().libraryExists(pathToLib); if (libraryFound != null) libraryFound = getResourceLoaderCache().libraryExists(libraryName); if (libraryFound != null) for (ContractResourceLoader loader : getResourceHandlerSupport() .getContractResourceLoaders()) getResourceLoaderCache().confirmLibraryExists(pathToLib); return true; for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders()) getResourceLoaderCache().confirmLibraryExists(pathToLib); return true; for (ContractResourceLoader loader : getResourceHandlerSupport() .getContractResourceLoaders()) getResourceLoaderCache().confirmLibraryExists(libraryName);
if(getResourceLoaderCache().containsResource(resourceName, libraryName, contentType)) ResourceValue resourceValue = getResourceLoaderCache().getResource(resourceName, libraryName, contentType); resource = new ResourceImpl(resourceValue.getResourceMeta(), resourceValue.getResourceLoader(), getResourceHandlerSupport(), contentType); for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders()) ResourceMeta resourceMeta = deriveResourceMeta(loader, resourceName, libraryName); getResourceHandlerSupport(), contentType); getResourceLoaderCache().putResource(resourceName, libraryName, contentType, resourceMeta, loader); break;
String contractPreferred = getContractNameForLocateResource(facesContext); ResourceValue resourceValue = null; resourceValue = getResourceLoaderCache().getResource( resourceId, contractPreferred); resourceValue = getResourceLoaderCache().getResource(resourceId, contract); if (resourceValue != null) resourceValue = getResourceLoaderCache().getResource(resourceId); getResourceHandlerSupport(), contentType, resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getURL() : null, resourceValue.getCachedInfo() != null ? resourceValue.getCachedInfo().getRequestPath() : null); for (ContractResourceLoader loader : getResourceHandlerSupport().getContractResourceLoaders()) ResourceMeta resourceMeta = deriveResourceMeta( facesContext, loader, resourceId, contractPreferred); if (resourceMeta != null) getResourceHandlerSupport(), contentType); getResourceLoaderCache().putResource(resourceId, resourceMeta, loader, new ResourceCachedInfo(resource.getURL(), resource.getRequestPath())); getResourceHandlerSupport().getContractResourceLoaders()) ResourceMeta resourceMeta = deriveResourceMeta(
public boolean libraryExists(String libraryName) String localePrefix = getLocalePrefixForLocateResource(); for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders()) for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders())
private String _getContentType(Resource resource, ExternalContext externalContext) { String contentType = resource.getContentType(); // the resource does not provide a content-type --> determine it via mime-type if (contentType == null || contentType.length() == 0) { String resourceName = getWrappedResourceName(resource); if (resourceName != null) { contentType = externalContext.getMimeType(resourceName); } } return contentType; }
ApplicationImpl(final RuntimeConfig runtimeConfig) { if (runtimeConfig == null) { throw new IllegalArgumentException("runtimeConfig must mot be null"); } // set default implementation in constructor // pragmatic approach, no syncronizing will be needed in get methods _viewHandler = new ViewHandlerImpl(); _navigationHandler = new NavigationHandlerImpl(); _actionListener = new ActionListenerImpl(); _defaultRenderKitId = "HTML_BASIC"; _stateManager = new JspStateManagerImpl(); _elContextListeners = new ArrayList<ELContextListener>(); _resourceHandler = new ResourceHandlerImpl(); _runtimeConfig = runtimeConfig; if (log.isLoggable(Level.FINEST)) log.finest("New Application instance created"); }
@Override public boolean isResourceRequest(FacesContext facesContext) { // Since this method could be called many times we save it // on request map so the first time is calculated it remains // alive until the end of the request Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST); if (value == null) { String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); value = resourceBasePath != null && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER); facesContext.getAttributes().put(IS_RESOURCE_REQUEST, value); } return value; }
protected String getLocalePrefixForLocateResource() { return getLocalePrefixForLocateResource(FacesContext.getCurrentInstance()); }
String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); if (isResourceIdentifierExcluded(facesContext, resourceBasePath)) httpServletResponse.setContentType(_getContentType(resource, facesContext.getExternalContext())); int count = pipeBytes(in, out, buffer);
public boolean libraryExists(String libraryName) String localePrefix = getLocalePrefixForLocateResource(); for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders()) for (ResourceLoader loader : getResourceHandlerSupport() .getResourceLoaders())
private String _getContentType(Resource resource, ExternalContext externalContext) { String contentType = resource.getContentType(); // the resource does not provide a content-type --> determine it via mime-type if (contentType == null || contentType.length() == 0) { String resourceName = getWrappedResourceName(resource); if (resourceName != null) { contentType = externalContext.getMimeType(resourceName); } } return contentType; }
ApplicationImpl(final RuntimeConfig runtimeConfig) { if (runtimeConfig == null) { throw new IllegalArgumentException("runtimeConfig must mot be null"); } // set default implementation in constructor // pragmatic approach, no syncronizing will be needed in get methods _viewHandler = new ViewHandlerImpl(); _navigationHandler = new NavigationHandlerImpl(); _actionListener = new ActionListenerImpl(); _defaultRenderKitId = "HTML_BASIC"; _stateManager = new StateManagerImpl(); _elContextListeners = new ArrayList<ELContextListener>(); _resourceHandler = new ResourceHandlerImpl(); _runtimeConfig = runtimeConfig; if (log.isLoggable(Level.FINEST)) log.finest("New Application instance created"); String configParam = getFaceContext().getExternalContext().getInitParameter(DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME); if (configParam != null && configParam.toLowerCase().equals("true")) { _dateTimeConverterDefaultTimeZoneIsSystemTimeZone = true; } }
@Override public boolean isResourceRequest(FacesContext facesContext) { // Since this method could be called many times we save it //on request map so the first time is calculated it remains //alive until the end of the request Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST); if (value != null && value) { //return the saved value return value; } else { String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); if (resourceBasePath != null && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER)) { facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.TRUE); return true; } else { facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.FALSE); return false; } } }