/*
 * Copyright (c) 2006-2012 by Public Library of Science
 * http://plos.org
 * http://ambraproject.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ambraproject.rhino.rest.controller;

import org.ambraproject.rhino.identity.AssetIdentity;
import org.ambraproject.rhino.rest.MetadataFormat;
import org.ambraproject.rhino.rest.controller.abstr.DoiBasedCrudController;
import org.ambraproject.rhino.service.AssetCrudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class AssetMetadataController extends DoiBasedCrudController {

  private static final String ASSET_META_NAMESPACE = "/asset-meta/";
  private static final String ASSET_META_TEMPLATE = ASSET_META_NAMESPACE + "**";

  @Override
  protected String getNamespacePrefix() {
    return ASSET_META_NAMESPACE;
  }

  @Override
  protected AssetIdentity parse(HttpServletRequest request) {
    return AssetIdentity.create(getIdentifier(request));
  }

  @Autowired
  private AssetCrudService assetCrudService;

  @RequestMapping(value = ASSET_META_TEMPLATE, method = RequestMethod.GET)
  public void read(HttpServletRequest request, HttpServletResponse response,
                   @RequestParam(value = METADATA_FORMAT_PARAM, required = false) String format)
      throws IOException {
    AssetIdentity id = parse(request);
    MetadataFormat mf = MetadataFormat.getFromParameter(format, true);
    assetCrudService.readMetadata(response, id, mf);
  }

}

@@ -1010,16 +1010,66 @@
 owired;%0A
+import org.springframework.stereotype.Controller;%0A
 import o
@@ -1369,16 +1369,28 @@
 ption;%0A%0A
+@Controller%0A
 public c

Debug Spring config for AssetMetadataController