interesting,
here, with Firefox 3.0.10 on Linux, it worked fine.. at work I tested
with IExplorer 6.0.. A friend commented that recently the browsers
changed the way they encode the URLs but I didn't checked that info..
the service interface code:
@Path("user")
public class UserResource {
@EJB
private FpAbstractUserFacade abstractUserFacade;
@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("search")
public Collection<FpAbstractUser> search(@QueryParam("name") String name,
@QueryParam("organization") Integer organization,
@PathParam("limit") Integer limit) {
return abstractUserFacade.findByName(name);
}
}
------------
the persistence layer code:
@Stateless
public class FpAbstractUserFacadeImpl extends CRUDEntityFacade<FpAbstractUser>
implements FpAbstractUserFacade {
public List<FpAbstractUser> findByName(String name) {
List<FpAbstractUser> results = null;
if (name == null || name.trim().length() == 0) {
results = new ArrayList<FpAbstractUser>();
} else {
Query query = manager
.createNamedQuery(FpAbstractUser.SQL.SEARCH_BY_CRITERIA);
query.setParameter(FpAbstractUser.SQL.PARAM_USER_NAME, "%"
+ sqlEscape(name) + "%");
results = doQuery(query);
}
return results;
}
}
On Tue, May 26, 2009 at 10:29 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On May 26, 2009, at 12:33 AM, Felipe Gaúcho wrote:
>
>> I implemented a search method in my web-service, a simple query using
>> LIKE %foo%, and then I experimented a strange result:
>>
>> this URL returns some db rows:
>> http://fgaucho.dyndns.org:8080/footprint-service/user/search?name=Gaucho
>>
>> this URL doesn't:
>> http://fgaucho.dyndns.org:8080/footprint-service/user/search?name=Gaúcho
>>
>> Notice the correct value of the name field in the database is "Felipe
>> Gaúcho"
>>
>> so, why "Gaucho" matches the name and "Gaúcho" (with character ú) doesn't
>> ?
>>
>
> The URI containing the ú character will actually be:
>
> http://fgaucho.dyndns.org:8080/footprint-service/user/search?name=Ga%C3%BAcho
>
> Jersey will correctly decode this with "@QueryParam("name") String name".
>
> How are you extracting out the query parameter?
>
> Paul.
>
>> somewhere between the URL and the database query the character is
>> being transformed.. now I need to find where........
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
--
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces