Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java @ 229:924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
flys-client/trunk@1681 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 14 Apr 2011 07:53:01 +0000 |
parents | e02f50a3ad59 |
children | 6de435235927 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java Tue Apr 12 13:48:11 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java Thu Apr 14 07:53:01 2011 +0000 @@ -44,16 +44,19 @@ * This method wraps the artifact operations FEED and ADVANCE. FEED is * always triggerd, ADVANCE only, if there is at least one reachable state. * - * @param serverUrl The url of the artifact server. + * @param url The url of the artifact server. + * @param locale The locale used for the request. * @param artifact The artifact that needs to be fed. * @param data An array of Data objects that contain the information that * * @return the modified artifact. */ - public Artifact go(String serverUrl, Artifact artifact, Data[] data) + public Artifact go(String url, String locale, Artifact artifact, Data[] data) throws ServerException { - Artifact afterFeed = feed(serverUrl, artifact, data); + System.out.println("StepForwardServiceImpl.go"); + + Artifact afterFeed = feed(url, locale, artifact, data); if (afterFeed == null) { System.err.println("StepForwardService.feed() - FAILED"); @@ -70,29 +73,37 @@ // We use the first reachable state as default target, maybe we need to // change this later. - return advance(serverUrl, afterFeed, reachable[0]); + return advance(url, locale, afterFeed, reachable[0]); } /** * This method triggers the FEED operation. * - * @param serverUrl The url of the artifact server. + * @param url The url of the artifact server. * @param artifact The artifact that needs to be fed. * @param data An array of Data objects that contain the information that * are used for the FEED operation. * * @return a new artifact parsed from the description of FEED. */ - protected Artifact feed(String serverUrl, Artifact artifact, Data[] data) + protected Artifact feed( + String url, + String locale, + Artifact artifact, + Data[] data) throws ServerException { + System.out.println("StepForwardServiceImpl.feed"); + Document feed = ClientProtocolUtils.newFeedDocument( artifact.getUuid(), artifact.getHash(), createKVP(data)); - HttpClient client = new HttpClientImpl(serverUrl); + XMLDebug.out(feed); + + HttpClient client = new HttpClientImpl(url, locale); try { Document description = (Document) client.feed(