@Nullable public String getAddressProtocol () { final URL aURL = URLHelper.getAsURL (m_sAddress); return aURL == null ? null : aURL.getProtocol (); }
public MockSMPClient () { super (URLHelper.getAsURI (MockWebServer.BASE_URI_HTTP)); } }
@Override @Nonnull protected IReadableResource getResource (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final String sFilename) { // URL decode is required because requests contain e.g. "%20" final String sFilename1 = URLHelper.urlDecode (sFilename); return new ClassPathResource (sFilename1); } }
final URI aURI = URLHelper.getAsURI (RequestHelper.getWithoutSessionID (sRequestURL)); if (aURI != null) setParameters (URLHelper.getParsedQueryParameters (aURI.getQuery ())); return this;
aSB.append (m_eContentDispositionType.getID ()) .append ("; filename=") .append (URLHelper.urlEncode (m_sContentDispositionFilename, aCharsetToUse));
@Nonnull public static ResourceStreamSource create (@Nonnull final URI aURI) { return create (URLHelper.getAsURL (aURI)); }
public MockSMPClient () { super (URLHelper.getAsURI (MockWebServer.BASE_URI_HTTP)); } }
/** * Get the user data object matching the passed request and filename * * @param aRequestScope * HTTP request * @param sFilename * Filename as extracted from the URL * @return Never <code>null</code>. */ @Nonnull @OverrideOnDemand protected UserDataObject getUserDataObject (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final String sFilename) { // URL decode is required because requests contain e.g. "%20" final String sFilename1 = URLHelper.urlDecode (sFilename); return new UserDataObject (sFilename1); }
@Nonnull public static InputSource create (@Nonnull final URI aURI) { return create (URLHelper.getAsURL (aURI)); }
/** * Constructor with a direct PEPPOL Directory URL. * * @param sPDHost * The address of the PEPPOL Directory Server including the application * server context path but without the REST interface. May be http or * https. Example: https://directory.peppol.eu/ */ public PDClient (@Nonnull final String sPDHost) { this (URLHelper.getAsURI (sPDHost)); }
@Override @OverridingMethodsMustInvokeSuper public EContinue initRequestState (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) { // cut the leading "/" final String sFilename = URLHelper.urlDecode (aRequestScope.getPathWithinServlet ()); if (StringHelper.hasNoText (sFilename) || !isValidFilenameAccordingToTheRules (sFilename) || isPossibleDirectoryTraversalRequest (sFilename)) { // Send the same error code as if it is simply not found to confuse // attackers :) LOGGER.warn ("Illegal delivery request '" + sFilename + "'"); aUnifiedResponse.setStatus (HttpServletResponse.SC_NOT_FOUND); return EContinue.BREAK; } // Filename seems to be safe aRequestScope.attrs ().putIn (REQUEST_ATTR_OBJECT_DELIVERY_FILENAME, sFilename); return EContinue.CONTINUE; }
public BDMSLClient (@Nonnull final ISMLInfo aSMLInfo) { super (URLHelper.getAsURL (aSMLInfo.getManagementServiceURL () + "/bdmslservice")); }
/** * Check if the given identifier is valid. It is valid if it is empty or a * valid URI.<br> * The scheme of the participant identifier MUST be in the form of a URI.<br> * The scheme of the document identifier MUST be in the form of a URI. * * @param sScheme * The scheme to check. * @return <code>true</code> if the passed scheme is a valid identifier * scheme, <code>false</code> otherwise. */ public static boolean isValidIdentifierScheme (@Nullable final String sScheme) { if (StringHelper.hasNoText (sScheme)) return true; return URLHelper.getAsURI (sScheme) != null; }
final String sDocumentTypeID = URLHelper.urlDecode (sHref.substring (nIndex + URL_PART_SERVICES.length ()), StandardCharsets.UTF_8); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.parseDocumentTypeIdentifier (sDocumentTypeID);
@Nonnull public static IReadableResource getAsResourceStatic (@Nonnull @Nonempty final String sURI) { ValueEnforcer.notEmpty (sURI, "URI"); IReadableResource ret; // If the URL is absolute, use it if (LinkHelper.hasKnownProtocol (sURI)) { ret = new URLResource (URLHelper.getAsURL (sURI)); } else { // Absolute paths are project relative files and therefore are relative to // the servlet context directory if (isProjectRelativeURI (sURI)) { // Cut "/" to avoid recognition as absolute file on Linux! ret = WebFileIO.getServletContextIO ().getResource (sURI.substring (1)); } else { // Defaults to class path ret = new ClassPathResource (sURI); } } return ret; }
/** * @return The fixed SMP URI to be used to retrieve business cards. This * document should only be used when setting up a new network and * SML/DNS are not (yet) available in the system. Because it is * special, it is not documented. */ @Nullable public static URI getFixedSMPURI () { final String sSMPURI = getConfigFile ().getAsString ("smp.uri"); return URLHelper.getAsURI (sSMPURI); }
final String sDocumentTypeID = URLHelper.urlDecode (sHref.substring (nIndex + URL_PART_SERVICES.length ()), StandardCharsets.UTF_8); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.parseDocumentTypeIdentifier (sDocumentTypeID);
if (URLHelper.getAsURL (sToken) != null) aProfileData.add (sToken); else
@Nonnull public URI getCurrentURI () { if (m_bUseStaticServerInfo && StaticServerInfo.isSet ()) { // Do not decode params - '#' lets URI parser fail! return URLHelper.getAsURI (StaticServerInfo.getInstance ().getFullContextPath () + "/" + m_aUriInfo.getPath (false)); } if (false) { // First version in ROOT, second in context "/test" // http://127.0.0.1:90/ // http://127.0.0.1:90/test/ m_aUriInfo.getBaseUri (); // iso6523-actorid-upis:0088:5798000000112 m_aUriInfo.getPath (); // http://127.0.0.1:90/iso6523-actorid-upis%3A0088%3A5798000000112 // http://127.0.0.1:90/test/iso6523-actorid-upis%3A0088%3A5798000000112 m_aUriInfo.getAbsolutePath (); } return m_aUriInfo.getAbsolutePath (); }
else final URL aURL = URLHelper.getAsURL (sManagementAddressURL); if (aURL == null) aFormErrors.addFieldError (FIELD_MANAGEMENT_ADDRESS_URL, "The Management Address URL is not a valid URL!");