Permalink
Browse files

Add default value for format parameter

  • Loading branch information...
oucs0130 committed Feb 9, 2011
1 parent bdd8134 commit bdec08d5df3e445a02c5de79c2340b96b4580b13
@@ -46,17 +46,13 @@
@Produces({"application/x-javascript", MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response/*String*/ get(
@QueryParam("id") String openurl,
- @QueryParam("format") String format,
+ @QueryParam("format") @DefaultValue("json") String format,
@QueryParam("callback") @DefaultValue("callback") String callback) {
log.debug(openurl+":"+format+":"+callback);
try {
- if (null == format) {
- throw new Exception("Response format not specified");
- }
-
SFXService service = new SFXService(openurl);
OpenURI uri = new OpenURI(URLEncoder.encode(openurl, "UTF-8"));
ResponseBean bean = service.getResource(uri.getURI().toString());
@@ -51,16 +51,12 @@
@Produces({"application/x-javascript", MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response get(
@QueryParam("id") String id,
- @QueryParam("format") String format,
+ @QueryParam("format") @DefaultValue("json") String format,
@QueryParam("callback") @DefaultValue("callback") String callback) {
log.debug(id+":"+format+":"+callback);
try {
-
- if (null == format) {
- throw new Exception("Response format not specified");
- }
PrimoService service = new PrimoService(getProperties().getWebResourseURL());
DaiaURI uri = new DaiaURI(id);
@@ -3,8 +3,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
@@ -9,9 +9,6 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
-import uk.ac.ox.oucs.sirlouie.daia.Department;
-import uk.ac.ox.oucs.sirlouie.daia.Item;
-import uk.ac.ox.oucs.sirlouie.daia.Message;
import uk.ac.ox.oucs.sirlouie.reply.SearError;
import uk.ac.ox.oucs.sirlouie.reply.SearLibrary;
import uk.ac.ox.oucs.sirlouie.reply.SearLink;

0 comments on commit bdec08d

Please sign in to comment.