users@jersey.java.net

[Jersey] Re: jersey service trouble, a _at_PathParam entry can have a "/" in it

From: phil swenson <phil.swenson_at_gmail.com>
Date: Wed, 27 Nov 2013 15:30:12 -0700

I'm now suspecting our ancient/obsolete web container for translating the
%2F to a slash before it gets to rest routing. I'm not sure though...

I'm guessing I need to switch to query params though :(


On Wed, Nov 27, 2013 at 3:13 PM, Danilo Reinert <daniloreinert_at_gmail.com>wrote:

> AFAIK, ProcessModels%2FIBO_BAMOnly1 should be recognized as you modelId
> pathparam. If this is not happening then it would be a Jersey matter.
>
> Em quarta-feira, 27 de novembro de 2013, phil swenson escreveu:
>
> I implemented a jersey web service like so:
>>
>> @GET
>> @Path("/ProcessDiagramDisplayData/{modelId}")
>> @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML})
>> public ProcessDiagramDisplayData
>> getProcessDiagramDisplayData(@PathParam("modelId") String modelId,
>> @QueryParam("timeZone") String timeZoneId,
>>
>> @QueryParam("refreshInterval") int refreshInterval,
>>
>> @QueryParam("startTime") long startTime, @QueryParam("endTime") long
>> endTime) {
>> ProcessDiagramDisplayData processDiagramDisplayData =
>> getGlueProcessAnalyticsService().getProcessDiagramDisplayData(urlDecodeString(modelId),
>> timeZoneId, refreshInterval, startTime, endTime);
>> return processDiagramDisplayData;
>> }
>>
>>
>> This is fine, however I ran into a problem today. It appears that is it
>> legit for a "modelId" PathParam to have a "/" character in it.
>>
>> If I URL encode the model ID "ProcessModels/FIBO_BAMOnly1"
>> to "ProcessModels%2FIBO_BAMOnly1", I get the URL below:
>>
>>
>> http://zoso.local:12503/services/rest/ProcessAnalytics/ProcessDiagramDisplayData/ProcessModels%2FIBO_BAMOnly1?timeZone=1&startTime=39393939&endTime=39292&interval=3
>>
>>
>> It appears that the slash gets recognized as part of the URL pathing
>> itself, so this fails.
>>
>> I *think* the only solution to this is I'm going to have to make the
>> modelId a query parameter.
>>
>> Am I correct or is there a way around this?
>>
>> Thanks!
>>
>>
>>
>
> --
> --
> D. Reinert
>
>