class MediaRequestProcessor implements RequestProcessor {

    protected ResponseContext processMedia(RequestContext context, CollectionAdapter adapter) {
        String method = context.getMethod();
        if (adapter instanceof MediaCollectionAdapter) {
            MediaCollectionAdapter mcadapter = (MediaCollectionAdapter)adapter;
            if (method.equalsIgnoreCase("GET")) {
                return mcadapter.getMedia(context);
            } else if (method.equalsIgnoreCase("POST")) {
                return mcadapter.postMedia(context);
            } else if (method.equalsIgnoreCase("PUT")) {
                return mcadapter.putMedia(context);
            } else if (method.equalsIgnoreCase("DELETE")) {
                return mcadapter.deleteMedia(context);
            } else if (method.equalsIgnoreCase("HEAD")) {
                return mcadapter.headMedia(context);
            } else if (method.equalsIgnoreCase("OPTIONS")) {
                return mcadapter.optionsMedia(context);
            } else {
                return null;
            }
        } else {
            return ProviderHelper.notallowed(context);
        }
    }

}