55 URL (
const URL&) =
default;
56 URL& operator= (
const URL&) =
default;
58 URL& operator= (
URL&&) =
default;
70 bool operator== (
const URL&)
const;
71 bool operator!= (
const URL&)
const;
80 String toString (
bool includeGetParameters)
const;
83 bool isEmpty() const noexcept;
86 bool isWellFormed() const;
100 String getSubPath (
bool includeGetParameters = false) const;
105 String getQueryString() const;
114 bool isLocalFile() const;
146 URL withNewDomainAndPath (const
String& newFullPath) const;
153 URL withNewSubPath (const
String& newPath) const;
158 URL getParentURL() const;
170 URL getChildURL (const
String& subPath) const;
182 URL withParameter (const
String& parameterName,
183 const
String& parameterValue) const;
202 URL withFileToUpload (const
String& parameterName,
203 const
File& fileToUpload,
204 const
String& mimeType) const;
215 URL withDataToUpload (const
String& parameterName,
218 const
String& mimeType) const;
230 const
StringArray& getParameterNames() const noexcept {
return parameterNames; }
258 URL withPOSTData (
const String& postData)
const;
284 bool launchInDefaultBrowser()
const;
290 static bool isProbablyAWebsiteURL (
const String& possibleURL);
295 static bool isProbablyAnEmailAddress (
const String& possibleEmailAddress);
347 InputStream* createInputStream (
bool doPostLikeRequest,
349 void* progressCallbackContext =
nullptr,
351 int connectionTimeOutMs = 0,
353 int* statusCode =
nullptr,
354 int numRedirectsToFollow = 5,
355 String httpRequestCmd = {})
const;
362 OutputStream* createOutputStream()
const;
383 virtual void progress (
URL::DownloadTask* task, int64 bytesDownloaded, int64 totalLength);
413 int64 contentLength = -1, downloaded = 0;
414 bool finished =
false, error =
false;
431 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
DownloadTask)
446 bool usePostCommand =
false);
462 bool readEntireBinaryStream (
MemoryBlock& destData,
463 bool usePostCommand =
false)
const;
479 String readEntireTextStream (
bool usePostCommand =
false)
const;
497 std::unique_ptr<XmlElement> readEntireXmlStream (
bool usePostCommand =
false)
const;
518 static String addEscapeChars (
const String& stringToAddEscapeCharsTo,
520 bool roundBracketsAreLegal =
true);
531 static String removeEscapeChars (
const String& stringToRemoveEscapeCharsFrom);
537 static URL createWithoutParsing (
const String& url);
547 static File fileFromFileSchemeURL (
const URL&);
548 String getDomainInternal (
bool)
const;
553 String parameterName, filename, mimeType;
555 std::unique_ptr<MemoryBlock> data;
557 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Upload)
573 Bookmark::Ptr bookmark;
575 friend void setURLBookmark (URL&,
void*);
576 friend void* getURLBookmark (URL&);
579 URL (
const String&,
int);
581 void addParameter (
const String&,
const String&);
582 void createHeadersAndPostData (String&, MemoryBlock&)
const;
583 URL withUpload (Upload*)
const;
585 JUCE_LEAK_DETECTOR (URL)
Represents a local file or directory.
A class to hold a resizable block of raw data.
A base class which provides methods for reference-counting.
A special array for holding a list of strings.
A container for holding a set of strings which are keyed by another string.
Represents a download task.
bool hadError() const
Returns true if there was an error.
int64 getLengthDownloaded() const
Returns the number of bytes that have been downloaded so far.
bool isFinished() const
Returns true if the download finished or there was an error.
File getTargetLocation() const
Returns the target file location that was provided in URL::downloadToFile.
int statusCode() const
Returns the status code of the server's response.
static void juce_iosURLSessionNotify(const String &)
internal
int64 getTotalLength() const
Returns the total length of the download task.
Represents a URL and has a bunch of useful functions to manipulate it.
const StringArray & getParameterValues() const noexcept
Returns an array of the values of all the URL's parameters.
const MemoryBlock & getPostDataAsMemoryBlock() const noexcept
Returns the data that was set using withPOSTData() as MemoryBlock.
String getPostData() const
Returns the data that was set using withPOSTData().
bool(void *context, int bytesSent, int totalBytes) OpenStreamProgressCallback
This callback function can be used by the createInputStream() method.
~URL()=default
Destructor.
DownloadTask * downloadToFile(const File &targetLocation, String extraHeaders=String(), DownloadTask::Listener *listener=nullptr, bool usePostCommand=false)
Download the URL to a file.
#define JUCE_API
This macro is added to all JUCE public class declarations.
Used to receive callbacks for download progress.
virtual void finished(URL::DownloadTask *task, bool success)=0
Called when the download has finished.