Get media request path to media library
@param mediaRequest Media request
@param mediaHandlerConfig Media handler config (can be null, but should not be null)
@return Path or null if not present
194391
@SuppressWarnings("null")
  protected final @Nullable String getMediaRef(@NotNull MediaRequest mediaRequest,
      @Nullable MediaHandlerConfig mediaHandlerConfig) {
    if (StringUtils.isNotEmpty(mediaRequest.getMediaRef())) {
      return mediaRequest.getMediaRef();
    }
    else if (mediaRequest.getResource() != null) {
      String refProperty = getMediaRefProperty(mediaRequest, mediaHandlerConfig);
      return mediaRequest.getResource().getValueMap().get(refProperty, String.class);
    }
    else {
      return null;
    }
  }
597490
public MpNews getMpNews(String mediaId) {
        String url = WxEndpoint.get("url.material.mpnews.get");

        String json = String.format("{\"media_id\":\"%s\"}", mediaId);
        logger.info("get mpnews: {}", json);
        String response = wxClient.post(url, json);
        return JsonMapper.defaultMapper().fromJson(response, MpNews.class);
    }
934514
private String getPathPrefix(HttpServletRequest request, JawrConfig config) {

		if (request.isSecure()) {
			if (null != config.getContextPathSslOverride()) {
				return config.getContextPathSslOverride();
			}
		} else {
			if (null != config.getContextPathOverride()) {
				return config.getContextPathOverride();
			}
		}

		String mapping = null == config.getServletMapping() ? "" : config.getServletMapping();
		String path = PathNormalizer.joinPaths(request.getContextPath(), mapping);
		path = path.endsWith("/") ? path : path + '/';
		return path;
	}
229120
private URLStreamHandler getURLStreamHandler(final String protocol) {
        try {
            final Method method = URL.class.getDeclaredMethod("getURLStreamHandler", String.class);
            method.setAccessible(true);
            return (URLStreamHandler) method.invoke(null, protocol);
        } catch (final Exception e) {
            if (logger.isWarnEnabled()) {
                logger.warn("could not access URL.getUrlStreamHandler");
            }
            return null;
        }
    }
665691
@Deprecated
    public static Optional<SerializationFormat> fromMediaType(@Nullable String mediaType) {
        if (mediaType == null) {
            return Optional.empty();
        }

        try {
            return find(MediaType.parse(mediaType));
        } catch (IllegalArgumentException e) {
            // Malformed media type
            return Optional.empty();
        }
    }
372393
@SuppressWarnings("unchecked")
    private Setup createSetup(Media media)
    {
        final Configurer configurer = new Configurer(media);
        try
        {
            final FeaturableConfig config = FeaturableConfig.imports(configurer);
            final String setup = config.getSetupName();
            final Class<? extends Setup> setupClass;
            if (setup.isEmpty())
            {
                final Class<?> clazz = classLoader.loadClass(config.getClassName());
                final Constructor<?> constructor = UtilReflection.getCompatibleConstructorParent(clazz, new Class<?>[]
                {
                    Services.class, Setup.class
                });
                setupClass = (Class<? extends Setup>) constructor.getParameterTypes()[SETUP_INDEX];
            }
            else
            {
                setupClass = (Class<? extends Setup>) classLoader.loadClass(config.getSetupName());
            }
            return UtilReflection.create(setupClass, new Class<?>[]
            {
                Media.class
            }, media);
        }
        catch (final ClassNotFoundException exception)
        {
            throw new LionEngineException(exception, ERROR_SETUP_CLASS);
        }
        catch (final NoSuchMethodException exception)
        {
            throw new LionEngineException(exception, ERROR_CONSTRUCTOR_MISSING + media.getPath());
        }
    }
957650
@NonNull
    public static String randomMP4Path(Context context) {
        if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
            return randomMP4Path(context.getCacheDir());
        }
        return randomMP4Path();
    }
390780
protected function prepareRequestMediaVersionFromUrlPath () {
		$requestPath = $this->request->GetPath(TRUE);
		$requestPathExploded = explode('/', trim($requestPath, '/'));
		$requestPathFirstPart = mb_strtolower($requestPathExploded[0]);
		foreach ($this->allowedMediaVersionsAndUrlValues as $mediaSiteVersion => $mediaSiteUrlValue) {
			$mediaSiteUrlPrefix = mb_strtolower($mediaSiteUrlValue);
			if ($requestPathFirstPart === $mediaSiteUrlPrefix) {
				//$this->prepareSetUpRequestMediaSiteVersionIfValid($mediaSiteVersion);
				$this->requestMediaSiteVersion = $mediaSiteVersion;
				if (mb_strlen($mediaSiteUrlPrefix) > 0) 
					$this->request->SetPath(
						mb_substr($requestPath, mb_strlen('/' . $mediaSiteUrlPrefix))	
					);
				break;
			}
		}
	}
1085003
@SuppressWarnings("unchecked")
    public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException {
        checkNotNull(type, "Type (Class<T>) cannot be null.");
        checkNotNull(mediaType, "Media-Type cannot be null.");

        final String typeName = getClassName(type);
        final Key key = new Key(typeName, mediaType);

        logger.log(Level.FINE, "Querying for Serializer of type '" + typeName + "' and " + "media-type '" + mediaType
                + "'.");

        ArrayList<SerializerHolder> holders = serializers.get(typeName);
        if (holders != null) {
            for (SerializerHolder holder : holders) {
                if (holder.key.matches(key)) {
                    logger.log(Level.FINE, "Serializer for type '" + holder.serializer.handledType() + "' and " +
                            "media-type '" + Arrays.toString(holder.serializer.mediaType()) + "' matched: " +
                            holder.serializer.getClass().getName());
                    return (Serializer<T>) holder.serializer;
                }
            }
        }

        logger.log(Level.WARNING, "There is no Serializer registered for type " + type.getName() +
                " and media-type " + mediaType + ". If you're relying on auto-generated serializers," +
                " please make sure you imported the correct GWT Module.");

        return null;
    }
862315
public RestHandlerExceptionResolverBuilder defaultContentType(String mediaType) {
        defaultContentType( hasText(mediaType) ? MediaType.parseMediaType(mediaType) : null );
        return this;
    }
546699
public static FilePathMapping buildFilePathMapping(String path,
			ResourceReaderHandler rsHandler) {

		return buildFilePathMapping(null, path, rsHandler);
	}
292709
private String buildNativeMediaUrl() {
    String path = null;

    Resource parentResource = this.resource.getParent();
    if (JcrBinary.isNtFile(parentResource)) {
      // if parent resource is nt:file and its node name equals the detected filename, directly use the nt:file node path
      if (StringUtils.equals(parentResource.getName(), getFileName())) {
        path = parentResource.getPath();
      }
      // otherwise use nt:file node path with custom filename
      else {
        path = parentResource.getPath() + "./" + getFileName();
      }
    }
    else {
      // nt:resource node does not have a nt:file parent, use its path directly
      path = this.resource.getPath() + "./" + getFileName();
    }

    // build externalized URL
    UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
    return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
  }
948453
private static String getHandler(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    return pathInfo == null ? "" : pathInfo.substring(1);
  }
1049865
public static Observable<String> getPathFromUriForFileDocument(final Context context,
      final Uri contentUri) {
    return Observable.fromCallable(new Func0<String>() {
      @Override
      public String call() {
        String pathFound = null;
        Cursor cursor = context.getContentResolver().query(contentUri, null, null, null, null);
        if (cursor != null) {
          if (cursor.moveToFirst()) {
            pathFound =
                cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA));
          }
          cursor.close();
          logDebug("Path found:" + pathFound);
        }
        return pathFound;
      }
    });
  }
940739
private function getRequestOptionsForSearchChannelsEndpoint(
        $videoManagerId,
        ChannelsRequestParameters $parameters = null
    ) {
        $options = [
            'documentType' => 'channel',
            'videoManagerIds' => [$videoManagerId],
        ];

        $queryParams = [
            'videoManagerId' => $videoManagerId,
        ];

        if ($parameters) {
            $queryParams += [
                $parameters->getSearchInField() => $parameters->getSearchTerm(),
            ];

            $options += [
                'size' => $parameters->getLimit(),
                'from' => $parameters->getOffset(),
                'orderBy' => $parameters->getOrderProperty(),
                'order' => $parameters->getOrder(),
            ];

            if ($parameters->getMetadataSetKey()) {
                $options['metaDataSetKey'] = $parameters->getMetadataSetKey();
            }
        }

        $options['query'] = $this->createElasticSearchQuery($queryParams);

        return $options;
    }
723298
@Deprecated
  protected final @Nullable String getMediaRef(@NotNull MediaRequest mediaRequest) {
    return getMediaRef(mediaRequest, null);
  }
1315212
function(config) {
    var filePath = null;
    
    if(config.levelControllerConfig && config.levelControllerConfig.fileName) {
        filePath = path.join(_getLevelDir(config), config.levelControllerConfig.fileName);        
    } else {
        throw Errors.invalidConfig('Invalid configuration. Level controller file name not defined.');
    }
    return filePath;
}