diff --git a/src/org/json/Json4Uws.java b/src/org/json/Json4Uws.java index 676c237f34470618bbc5ffb96a169fe7225d9b4b..e6a6b271b2f026bf1678231e58e3a0e9ad3ee4af 100644 --- a/src/org/json/Json4Uws.java +++ b/src/org/json/Json4Uws.java @@ -37,7 +37,7 @@ import uws.service.UWSUrl; * Useful conversion functions from UWS to JSON. * * @author Grégory Mantelet (CDS;ARI) - * @version 4.2 (09/2017) + * @version 4.3 (09/2017) */ public final class Json4Uws { @@ -55,6 +55,7 @@ public final class Json4Uws { JSONObject json = new JSONObject(); if (uws != null){ json.put("name", uws.getName()); + json.put("version", UWS.VERSION); json.put("description", uws.getDescription()); JSONArray jobLists = new JSONArray(); @@ -83,6 +84,7 @@ public final class Json4Uws { JSONObject json = new JSONObject(); if (jobsList != null){ json.put("name", jobsList.getName()); + json.put("version", UWS.VERSION); JSONArray jsonJobs = new JSONArray(); UWSUrl jobsListUrl = jobsList.getUrl(); Iterator<UWSJob> it = jobsList.getJobs(owner); @@ -119,6 +121,7 @@ public final class Json4Uws { public final static JSONObject getJson(final UWSJob job, final UWSUrl jobsListUrl, final boolean reference) throws JSONException{ JSONObject json = new JSONObject(); if (job != null){ + json.put("version", UWS.VERSION); json.put(UWSJob.PARAM_JOB_ID, job.getJobId()); json.put(UWSJob.PARAM_PHASE, job.getPhase()); if (reference){ diff --git a/src/uws/job/serializer/XMLSerializer.java b/src/uws/job/serializer/XMLSerializer.java index 3386b61ef49c713b4ce65d26529ad3c1e7185226..b8a2e96f73762598edf79a7e54e866de98dfe5ae 100644 --- a/src/uws/job/serializer/XMLSerializer.java +++ b/src/uws/job/serializer/XMLSerializer.java @@ -40,7 +40,7 @@ import uws.service.request.UploadFile; * Lets serializing any UWS resource in XML. * * @author Grégory Mantelet (CDS;ARI) - * @version 4.2 (09/2017) + * @version 4.3 (09/2017) */ public class XMLSerializer extends UWSSerializer { private static final long serialVersionUID = 1L; @@ -150,7 +150,7 @@ public class XMLSerializer extends UWSSerializer { String name = uws.getName(), description = uws.getDescription(); StringBuffer xml = new StringBuffer(getHeader()); - xml.append("<uws").append(getUWSNamespace(true)); + xml.append("<uws version=\"").append(UWS.VERSION).append('"').append(getUWSNamespace(true)); if (name != null) xml.append(" name=\"").append(escapeXMLAttribute(name)).append('"'); xml.append(">\n"); @@ -161,10 +161,14 @@ public class XMLSerializer extends UWSSerializer { xml.append("\t<jobLists>\n"); for(JobList jobList : uws){ UWSUrl jlUrl = jobList.getUrl(); - xml.append("\t\t<jobListRef name=\"").append(escapeXMLAttribute(jobList.getName())).append("\" href=\""); + xml.append("\t\t<jobListRef name=\"").append(escapeXMLAttribute(jobList.getName())).append('"'); + + /* The XLink attributes are optional. So if no URL is available for + * this Job List reference, none is written here: */ if (jlUrl != null && jlUrl.getRequestURL() != null) - xml.append(escapeXMLAttribute(jlUrl.getRequestURL())); - xml.append("\" />\n"); + xml.append(" xlink:type=\"simple\" xlink:href=\"").append(escapeXMLAttribute(jlUrl.getRequestURL())).append('"'); + + xml.append(" />\n"); } xml.append("\t</jobLists>\n"); @@ -177,7 +181,7 @@ public class XMLSerializer extends UWSSerializer { public String getJobList(final JobList jobsList, final JobOwner owner, final boolean root){ StringBuffer xml = new StringBuffer(getHeader()); - xml.append("<jobs").append(getUWSNamespace(true)); + xml.append("<jobs version=\"").append(UWS.VERSION).append('"').append(getUWSNamespace(true)); /* NOTE: NO ATTRIBUTE "name" IN THE XML SCHEMA! * String name = jobsList.getName(); * if (name != null) @@ -201,7 +205,7 @@ public class XMLSerializer extends UWSSerializer { String newLine = "\n\t"; // general information: - xml.append("<job").append(getUWSNamespace(root)).append('>'); + xml.append("<job version=\"").append(UWS.VERSION).append('"').append(getUWSNamespace(root)).append('>'); xml.append(newLine).append(getJobID(job, false)); if (job.getRunId() != null) xml.append(newLine).append(getRunID(job, false)); diff --git a/src/uws/service/UWS.java b/src/uws/service/UWS.java index 08ce2c7a55d2e458568832b3e0c79a86b187656e..00c6e1d7b0a123cc00a6053a9b03af71107a5728 100644 --- a/src/uws/service/UWS.java +++ b/src/uws/service/UWS.java @@ -64,13 +64,17 @@ import uws.service.request.UWSRequestParser; * </b></p> * * @author Grégory Mantelet (CDS;ARI) - * @version 4.2 (09/2017) + * @version 4.3 (09/2017) */ public interface UWS extends Iterable<JobList> { /** Version of the UWS protocol used in this library. * @since 4.2 */ - public final static String VERSION = "1.0"; + public final static String VERSION = "1.1"; + + /** IVOA standardID of a UWS service currently generated by this library. + * @since 4.2 */ + public final static String STANDARD_ID = "ivo://ivoa.net/std/UWS#rest-1.1"; /** Attribute of the HttpServletRequest to set and to get in order to access the request ID set by the UWS library. * @since 4.1 */