public boolean exists () { return m_aRes.exists (); }
private void _checkKeyStoreAttributes () { if (m_aKeyStoreRes == null) throw new IllegalStateException ("KeyStore resources is not configured."); if (!m_aKeyStoreRes.exists ()) throw new IllegalStateException ("KeyStore resources does not exist: " + m_aKeyStoreRes.getPath ()); if (m_aKeyStoreType == null) throw new IllegalStateException ("KeyStore type is not configured."); if (m_sKeyStorePassword == null) throw new IllegalStateException ("KeyStore password is not configured."); if (StringHelper.hasNoText (m_sKeyStoreAlias)) throw new IllegalStateException ("KeyStore alias is not configured."); if (m_sKeyStoreKeyPassword == null) throw new IllegalStateException ("Key password is not configured."); }
@Nullable public URL getResource (@Nonnull final String sPath) throws MalformedURLException { final IReadableResource aResource = m_aResourceProvider.getReadableResource (getResourceLocation (sPath)); if (!aResource.exists ()) return null; return aResource.getAsURL (); }
@Nullable public InputStream getResourceAsStream (@Nonnull final String sPath) { final IReadableResource aResource = m_aResourceProvider.getReadableResource (getResourceLocation (sPath)); if (!aResource.exists ()) return null; return aResource.getInputStream (); }
public static void _readMetaElements (@Nonnull final IReadableResource aRes, @Nonnull final MetaElementList aTarget) { ValueEnforcer.notNull (aRes, "Res"); ValueEnforcer.notNull (aTarget, "Target"); if (aRes.exists ()) { final ICommonsOrderedMap <String, String> aMetaElements = new CommonsLinkedHashMap <> (); if (XMLMapHandler.readMap (aRes, aMetaElements).isFailure ()) LOGGER.error ("Failed to read meta element file " + aRes.getPath ()); for (final Map.Entry <String, String> aEntry : aMetaElements.entrySet ()) aTarget.addMetaElement (MetaElement.createMeta (aEntry.getKey (), aEntry.getValue ())); } }
public CryptoProperties (@Nonnull final IReadableResource aRes) { ValueEnforcer.notNull (aRes, "Resource"); if (aRes.exists ()) try { m_aProps = new NonBlockingProperties (); try (final InputStream aIS = aRes.getInputStream ()) { m_aProps.load (aIS); } } catch (final Throwable t) { throw new InitializationException ("Failed to init CryptoProperties from resource " + aRes + "!", t); } }
if (!aXSLTResource.exists ())
if (!aXSLTResource.exists ())
if (aRes != null && aRes.exists ()) return TransformSourceFactory.create (aRes);
@Override @OverridingMethodsMustInvokeSuper public EContinue initRequestState (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) { // Check for valid filenames, path traversal etc. if (super.initRequestState (aRequestScope, aUnifiedResponse).isBreak ()) return EContinue.BREAK; // Resolve the resource from the passed filename final String sFilename = aRequestScope.attrs ().getAsString (REQUEST_ATTR_OBJECT_DELIVERY_FILENAME); final IReadableResource aRes = getResource (aRequestScope, sFilename); if (!aRes.exists ()) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Not streaming '" + sFilename + "' because no such resource exists."); m_aStatsNotFound.increment (sFilename); aUnifiedResponse.setStatus (HttpServletResponse.SC_NOT_FOUND); return EContinue.BREAK; } // Resource exists - save in request scope aRequestScope.attrs ().putIn (REQUEST_ATTR_OBJECT_DELIVERY_RESOURCE, aRes); return EContinue.CONTINUE; }
public static void _readJSIncludes (@Nonnull final IReadableResource aRes, @Nonnull final JSResourceSet aTarget) { ValueEnforcer.notNull (aRes, "Res"); ValueEnforcer.notNull (aTarget, "Target"); final IMicroDocument aDoc = aRes.exists () ? MicroReader.readMicroXML (aRes) : null; if (aDoc != null) for (final IMicroElement eChild : aDoc.getDocumentElement ().getAllChildElements ("js")) { final String sPath = eChild.getAttributeValue ("path"); if (StringHelper.hasNoText (sPath)) { LOGGER.error ("Found JS item without a path in " + aRes.getPath ()); continue; } // Just a consistency check to see if the resource is valid final IReadableResource aChildRes = PhotonHTMLSettings.getURIToURLConverter ().getAsResource (sPath); if (!aChildRes.exists ()) throw new IllegalStateException ("The provided global JS resource '" + sPath + "' resolved to '" + aChildRes + "' does NOT exist!"); final String sConditionalComment = eChild.getAttributeValue ("condcomment"); // Add to target aTarget.addItem (new ConstantJSPathProvider (sPath, JSFilenameHelper.getMinifiedJSFilename (sPath), sConditionalComment, IJSProvider.DEFAULT_IS_BUNDLABLE)); } }
ValueEnforcer.isTrue (aRes.exists (), () -> "Resource " + aRes + " does not exist!");
m_bResourceExists = m_aResource.exists ();
ValueEnforcer.notNull (aTransformerCustomizer, "TransformerCustomizer"); if (!aSchematronResource.exists ())
ValueEnforcer.notNull (aTransformerCustomizer, "TransformerCustomizer"); if (!aSchematronResource.exists ())
ValueEnforcer.notNull (aTarget, "Target"); final IMicroDocument aDoc = aRes.exists () ? MicroReader.readMicroXML (aRes) : null; if (aDoc != null) for (final IMicroElement eChild : aDoc.getDocumentElement ().getAllChildElements ("css")) if (!aChildRes.exists ()) throw new IllegalStateException ("The provided global CSS resource '" + sPath +