<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
<?php | |
/** | |
* Varnish Cache Cleaner. | |
* | |
* @package Cache_Cleaner | |
* @author Eni Sinanaj <[email protected]> | |
* @link https://enisinanal.com | |
* @copyright 2013-2019 Eni Sinanaj | |
* |
# | |
# This is an example VCL file for Varnish. | |
# | |
# It does not do anything by default, delegating control to the | |
# builtin VCL. The builtin VCL is called when there is no explicit | |
# return statement. | |
# | |
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ | |
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. |
# | |
# This is an example VCL file for Varnish. | |
# | |
# It does not do anything by default, delegating control to the | |
# builtin VCL. The builtin VCL is called when there is no explicit | |
# return statement. | |
# | |
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ | |
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. |
public static String getRealFilePath(final Context context, final Uri uri) { | |
if (null == uri) return null; | |
final String scheme = uri.getScheme(); | |
String data = null; | |
if (scheme == null) | |
data = uri.getPath(); | |
else if (ContentResolver.SCHEME_FILE.equals(scheme)) { | |
data = uri.getPath(); | |
} else if (ContentResolver.SCHEME_CONTENT.equals(scheme)) { | |
final Cursor cursor = context.getContentResolver().query(uri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null); |
public byte[] getNextFileChunk() throws IOException { | |
FileInputStream fileReader = new FileInputStream(file); | |
byte[] b; | |
int realLength = CHUNK_SIZE; | |
// assuming chunk index starts from 1 | |
if (currentChunk - 1 == chunksLength) { | |
b = new byte[lastChunkSize]; | |
realLength = lastChunkSize; |
// You have a very very large video file you need to upload to a server while your app is backgrounded. | |
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload. | |
class Networking { | |
static let sharedInstance = Networking() | |
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager | |
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this | |
private init() { | |
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default) | |
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer")) |