Is it possible to use the HTTP Content Type to determine weather it is XML or JSON instead of using a HTTP parameter?
Supun.. On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <[email protected] > wrote: > Hi Saminda and Amila, > > Thanks for quick replies, @Saminda what you mean is extend Workflow object > by adding another parse(Json) method to parse the JSON data right?. Yes > that can be done, here we need to know that incoming string is in XML > format of JSON format before we call relevant parse(..) method. For that we > can add another boolean parameter (isJSON) to the resource method and set > default value as false to support backward compatibility. > > eg: public Response addWorkflow(*@DefaultValue("false") > @FormParam("isJSON") boolean isJSON*, > > @FormParam("workflowName") String workflowName, > > @FormParam("workflowGraphXml") String workflowGraphXml) { > > Thanks, > Shameera. > > > On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <[email protected]>wrote: > >> Well as you said there is no restriction on the format of the workflow we >> save in the registry. The API does not enforce a format of the string also. >> Only the model "Workflow" is enforced when the string (xml/json) is parsed. >> >> How about you extend the Workflow model object to support graph data in >> JSON format when parsing? >> >> >> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka < >> [email protected]> wrote: >> >>> Hi Devs, >>> >>> Currently graph data (Content of .xwf file) is being stored in XML >>> fromat. In GSoC master project what we have is graph data in JSON format. >>> Therefore we need a way to store this JSON data on registry. First i >>> thought to convert the json data to xml in registry rest api and store it. >>> But it seems we can store this in JSON fromat too. To do that what i am >>> going to do is, add following methods to UserWorkflowRegistry interface and >>> implement those methods in implementation classes. It would be great to >>> know your ideas about this. Please suggest if there any other way to >>> handle this. >>> >>> public void addWorkflowInJSON(String workflowName, String >>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException, >>> RegistryException; >>> public void updateWorkflowInJSON(String workflowName, String >>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException, >>> RegistryException; >>> public String getWorkflowGraphJSON(String workflowName) throws >>> UserWorkflowDoesNotExistsException, RegistryException; >>> >>> Thanks, >>> Shameera. >>> >>> >>> -- >>> Best Regards, >>> Shameera Rathnayaka. >>> >>> email: shameera AT apache.org , shameerainfo AT gmail.com >>> Blog : http://shameerarathnayaka.blogspot.com/ >>> >> >> > > > -- > Best Regards, > Shameera Rathnayaka. > > email: shameera AT apache.org , shameerainfo AT gmail.com > Blog : http://shameerarathnayaka.blogspot.com/ > -- Supun Kamburugamuva Member, Apache Software Foundation; http://www.apache.org E-mail: [email protected]; Mobile: +1 812 369 6762 Blog: http://supunk.blogspot.com
