users@jersey.java.net

[Jersey] 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 14:34:11 -0700

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!