Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Fetching Stems with Umlauts

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Fetching Stems with Umlauts


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Mirko Tasler <>, "" <>
  • Subject: RE: [grouper-users] Fetching Stems with Umlauts
  • Date: Tue, 15 Sep 2009 12:30:36 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

OK, this is now fixed. Please get the latest grouper WS and client, and try
it.

https://bugs.internet2.edu/jira/browse/GRP-318

The issue was with the content type in the HTTP reader response from web
service.
I think SOAP was not a problem since Axis sets the content type to UTF-8.
In rest, the content type is based on which format of message (e.g. xml,
json, etc).
So there is a new config param in grouper-ws.properties:

# will add the charset to the content type, blank to omit
ws.restHttpContentTypeCharset = UTF-8

This will append a charset to the content type used due to message type.

Also, in the client, the charset in config now defaults to UTF-8, and it is
used to parse the web service responses.

Now it seems to work


[mchyzer@flash
pennGroupsClient-1.4.2]$ java -jar grouperClient.jar --operation=findStemsWs
--stemQueryFilterType=FIND_BY_STEM_NAME --stemName=aStem:newStemä
Index 0: name: aStem:newStemä, displayName: aStem:newStemä
[mchyzer@flash
pennGroupsClient-1.4.2]$ java -jar grouperClient.jar --operation=stemSaveWs
--name=aStem:newStemä
Success: T: code: SUCCESS_NO_CHANGES_NEEDED: aStem:newStemä
[mchyzer@flash
pennGroupsClient-1.4.2]$

Thanks,
Chris

cvs
-d:pserver::/home/cvs/i2mi
login

cvs
-d:pserver::/home/cvs/i2mi
export -r GROUPER_1_4_BRANCH grouper-ws

cvs
-d:pserver::/home/cvs/i2mi
export -r GROUPER_1_4_BRANCH grouper-misc/grouperClient


> -----Original Message-----
> From: Mirko Tasler
> [mailto:]
> Sent: Tuesday, September 15, 2009 5:01 AM
> To: Chris Hyzer;
>
> Subject: Re: [grouper-users] Fetching Stems with Umlauts
>
>
> Since I haven't tested this with group names, I'm not sure about the
> results there. Here's something similar to the Java class I use for
> testing. (To run this, you'll need grouperClient.jar and dependencies
> as
> well as grouper.client.properties).
>
> *** snip ***
> import edu.internet2.middleware.grouperClient.api.GcFindStems;
> import edu.internet2.middleware.grouperClient.api.GcStemSave;
> import edu.internet2.middleware.grouperClient.ws.GcTransactionType;
> import
> edu.internet2.middleware.grouperClient.ws.beans.WsFindStemsResults;
> import edu.internet2.middleware.grouperClient.ws.beans.WsStem;
> import edu.internet2.middleware.grouperClient.ws.beans.WsStemLookup;
> import
> edu.internet2.middleware.grouperClient.ws.beans.WsStemQueryFilter;
> import edu.internet2.middleware.grouperClient.ws.beans.WsStemToSave;
>
> public class GrouperClientUmlautTest {
>
> public static void saveStem(String stemName) throws Exception {
> System.out.println("Saving stem: " + stemName);
> GcStemSave gcStemSave = new GcStemSave();
> WsStem wsStem = new WsStem();
> wsStem.setName(stemName);
> WsStemToSave wsStemToSave = new WsStemToSave();
> wsStemToSave.setWsStemLookup(new WsStemLookup(stemName,
> null));
> wsStemToSave.setWsStem(wsStem);
> gcStemSave.addStemToSave(wsStemToSave);
> gcStemSave.assignTxType(GcTransactionType.NONE).execute();
> }
>
> public static void getStems(String parentStem) throws Exception {
> String queryFilterType="FIND_BY_PARENT_STEM_NAME";
> String parentStemScope="ALL_IN_SUBTREE";
> WsStemQueryFilter filter = new WsStemQueryFilter();
> filter.setParentStemName(parentStem);
> filter.setStemQueryFilterType(queryFilterType);
> filter.setParentStemNameScope(parentStemScope);
> GcFindStems finder = new GcFindStems();
> finder.assignStemQueryFilter(filter);
> WsFindStemsResults results = finder.execute();
> WsStem[] found=results.getStemResults();
> if (found!=null) {
> String stemName;
> int umlautValue;
> for (WsStem s : found) {
> stemName=s.getName();
> // umlaut is last char and should be 228
> umlautValue=stemName.charAt(stemName.length()-1);
> System.out.println("Found stem: " + stemName);
> System.out.println("Umlaut has value: " +
> umlautValue);
> }
> }
> }
>
> public static void main(String[] args) throws Exception {
> GrouperClientUmlautTest.saveStem("test:umlauts");
>
> GrouperClientUmlautTest.saveStem("test:umlauts:itIs"+(char)228);
> GrouperClientUmlautTest.getStems("test:umlauts");
> }
>
> }
> *** snap ***
>
> This results - for me - in the following output:
>
> Saving stem: test:umlauts
> Saving stem: test:umlauts:itIsä
> Found stem: test:umlauts:itIs[crudeSign]
> Umlaut has value: 65533
>
> This is clearly wrong, since the char's value was set to 228.
>
> Kind regards,
>
> Mirko
>
>
> Am 14.09.2009 16:39, schrieb Chris Hyzer:
> > Ok, I think this already works, just need to adjust the encoding of
> > the terminal. In Putty, and SecureCRT I switched to UTF-8 encoding,
> > and it works fine. If you see the right result in the web service
> > response, then you don’t need to upgrade the WS.
> >
> >
> >
> > [mchyzer@flash
> > pennGroupsClient-1.4.2]$ java -jar grouperClient.jar
> > --operation=groupSaveWs --name=aStem:newGroup0ä
> >
> > Success: T: code: SUCCESS_NO_CHANGES_NEEDED: aStem:newGroup0ä
> >
> > [mchyzer@flash
> > pennGroupsClient-1.4.2]$
> >
> >
> >
> >>
> >
> >> Btw., the UI displays the umlaut correctly...
> >
> >> <span class="browseStemsLocationHere">[...]umlautä</span>
> >
> >> ...but should better escape it (in this case to umlaut&auml; or to
> >
> >> umlaut&#228;).
> >
> >
> >
> > Good. I think this is easier to do in a UI than a console. But with
> > the LANG set properly (mine is UTF8), and the terminal encoding set
> > properly (again UTF8), then I think it is fine.
> >
> > Ok?
> >
> >
> >
> > Thanks,
> >
> > Chris
>
> --
> Mirko Tasler
> ZE für Datenverarbeitung, Compute- & Medien Service
> Freie Universität Berlin



Archive powered by MHonArc 2.6.16.

Top of Page