Return-Path:
X-Original-To: apmail-ace-users-archive@minotaur.apache.org
Delivered-To: apmail-ace-users-archive@minotaur.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id E0FA610936
for ;
Mon, 9 Sep 2013 18:31:17 +0000 (UTC)
Received: (qmail 95615 invoked by uid 500); 9 Sep 2013 18:31:17 -0000
Delivered-To: apmail-ace-users-archive@ace.apache.org
Received: (qmail 95500 invoked by uid 500); 9 Sep 2013 18:31:14 -0000
Mailing-List: contact users-help@ace.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: users@ace.apache.org
Delivered-To: mailing list users@ace.apache.org
Received: (qmail 95490 invoked by uid 99); 9 Sep 2013 18:31:13 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Sep 2013 18:31:13 +0000
X-ASF-Spam-Status: No, hits=2.2 required=5.0
tests=HTML_MESSAGE,SPF_PASS
X-Spam-Check-By: apache.org
Received-SPF: pass (athena.apache.org: local policy)
Received: from [134.221.1.27] (HELO fromintoutb.tno.nl) (134.221.1.27)
by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Sep 2013 18:31:09 +0000
X-IronPort-AV: E=Sophos;i="4.90,872,1371074400";
d="scan'208,217";a="2259457"
Received: from unknown (HELO mail.tno.nl) ([134.221.225.220])
by mailhost1b.tno.nl with ESMTP; 09 Sep 2013 20:30:46 +0200
Received: from EXC-MBX03.tsn.tno.nl ([169.254.3.176]) by
EXC-CASHUB01.tsn.tno.nl ([134.221.225.220]) with mapi id 14.03.0123.003; Mon,
9 Sep 2013 20:30:46 +0200
From: "Passchier, I. (Igor)"
To: ghania ferrag , "users@ace.apache.org"
Subject: Re: How to query the distributions/targets with the Client Rest API?
Thread-Topic: How to query the distributions/targets with the Client Rest
API?
Thread-Index: AQHOqloY2VXj8ucv7kWU+yIxRWNoBJm4K5IAgAPLcQCAADWrgIABSr6AgABJRes=
Date: Mon, 9 Sep 2013 18:30:45 +0000
Message-ID: <502E576EF60C794092D158A61A9D021321165437@EXC-MBX03.tsn.tno.nl>
References: <1378400654.81831.YahooMailNeo@web125002.mail.ne1.yahoo.com>
<52298120.9030408@pipesbox.de>,<1378660360.36093.YahooMailNeo@web125002.mail.ne1.yahoo.com>
,<1378742911.43682.YahooMailNeo@web125003.mail.ne1.yahoo.com>
In-Reply-To: <1378742911.43682.YahooMailNeo@web125003.mail.ne1.yahoo.com>
Accept-Language: en-US, nl-NL
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: multipart/alternative;
boundary="_000_502E576EF60C794092D158A61A9D021321165437EXCMBX03tsntnon_"
MIME-Version: 1.0
X-Virus-Checked: Checked by ClamAV on apache.org
--_000_502E576EF60C794092D158A61A9D021321165437EXCMBX03tsntnon_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hi Ghania,
To debug any rest interface, you could use the rest api plugin for chrome. =
This enables you to query any rest api on the fly, without programming the =
client side yourself. Probably something similar is also available for Fire=
fox, but I never tried to find that.
if you understand the details of the api in this way, you can implement it =
in your code afterwards.
Regards,
Igor Passchier
----- Reply message -----
Van: "ghania ferrag"
Aan: "users@ace.apache.org"
Onderwerp: How to query the distributions/targets with the Client Rest API?
Datum: ma, sep. 9, 2013 18:09
Hi Mike and Thank you very much for your response :)
I tried "left" and "right" instead of "leftEndpoint" and "rightEndpoint", a=
s parameters in the form, but it is still not working with the same error m=
essage.
I even created an other java client ( not using jersey) to communicate with=
REST API of ACE, no luck..
Is there a more suitable Client REST API than Jersey ? A sample of code wi=
ll really help.
Thank you again for your response,
My best Regards,
Ghania
________________________________
De : Mike van Dongen
=C0 : "users@ace.apache.org"
Envoy=E9 le : dimanche 8 Septembre 2013 16h24
Objet : RE: How to query the distributions/targets with the Client Rest API=
?
Hi Ghania!
I ran into the same problems when I started using ACE 1 or 2 months ago.
> Hi every one,
>
> Thank you Mike, Elmar for your response.
>
> I=92m having an exception when doing a post to client/work/rest-ID/distru=
bution2target with setting a form with the form parameters : leftEndpoint, =
rightEndpoint, leftCardinality, rightCardinality
>
> The exception is Problem accessing /client/work/rest-1/distribution2ta=
rget. Reason:
>
Unable to parse repository object!
Caused by:
<=
pre>java.io.IOException: Unable to parse repository object!
> at org.apache.ace.client.rest.RESTClientServlet.getRepositoryValueObject(=
RESTClientServlet.java:486)
> at org.apache.ace.client.rest.RESTClientServlet.doPost(RESTClientServlet.=
java:353)
> =85..Caused by: com.google.gson.JsonParseException: Expecting object foun=
d: "leftEndpoint"
If I recall correctly, you should use the parameters 'left' and 'right'.The=
values of those parameters need to be the definitions of the distribution =
and target respectively.
> Also when I do I post to Client/work, I=92m getting this with no sessionI=
D :
> ["artifact", "feature", "distribution", "target", "artifact2feature", "f=
eature2distribution", "distribution2target"]
> How to get the new Workspace with the sessionID, what I=92m missing in my=
post?
> Any idea how to fix this error?
Once a new workspace is created, the client will be redirected to this work=
space.The URL you're being redirected to is "client/work/rest-ID", where re=
st-ID is the ID of your workspace.In my case I was able to retrieve the URL=
that was last used and set it as the base URI.
I'm unfamiliar with Jersey but this might help:https://jersey.java.net/nona=
v/apidocs/1.1.1-ea/jersey/com/sun/jersey/api/client/WebResource.html#getURI=
()
Good luck!Mike.
> Thank you again for your response,
> My Best Regards,
> Ghania
>
>
>
> ________________________________
> De : Elmar Zeeb
> =C0 : users@ace.apache.org
> Envoy=E9 le : vendredi 6 Septembre 2013 3h15
> Objet : Re: How to query the distributions/targets with the Client Rest A=
PI?
>
>
> Hi Ghania,
>
> Am 05.09.2013 19:04, schrieb ghania ferrag:
> > Hi all,
> >
> > I=92m working on new web UI ( I used Vaadin for this UI) to allow our u=
sers to send distributions to specific targets.
> > In our UI we have just to display all existing distributions and I wond=
er how to query the distributions with the Client Rest API?
> > I read the following link:
> > https://cwiki.apache.org/confluence/display/ACE/Client+REST+API
> >
> >
> >
> > Some one can tell me what is wrong with this REST-client code (I used J=
ersey):
> > 1) I suspect the path is wrong: "ace/workspaceID/distribution" ?
> > 2) or may be REST-server is not set ?
> >
> > import javax.ws.rs.core.UriBuilder;
> > import com.sun.jersey.api.client.Client;
> > import com.sun.jersey.api.client.WebResource;
> > import com.sun.jersey.api.client.config.ClientConfig;
> > import com.sun.jersey.api.client.config.DefaultClientConfig;
> > public class ClientTest{
> > public static void main(String[] args) {
> > getDistributions();
> > }
> >
> > public static void getDistributions() {
> > ClientConfig config =3D new DefaultClientConfig();
> > Client client =3D Client.create(config);
> > WebResource service =3D client.resource(getBaseURI());
> > // Get JSONfor application
> > System.out.println(service.path("workspaceID").path("distribution"=
).accept(MediaType.APPLICATION_JSON).get(String.class));
> > // Get XML for application
> > System.out.println(service.path("workspaceID").path("distribution"=
).accept(MediaType.APPLICATION_XML).get(String.class));
> > }
> > private static URI getBaseURI() {
> > return UriBuilder.fromUri("http://localhost:8080/ace").build();
> > }
> >
> > Thanks and Regards,
> > Ghania
> You should create a association between a distribution and a target,
> this is called distribution2target and is a resource that can be created
> with a post to ace/workspaceID/distribution2target (see
> http://ace.apache.org/user-doc/restapi.html).
>
> Regards,
> Elmar
--_000_502E576EF60C794092D158A61A9D021321165437EXCMBX03tsntnon_--