This is an FYI in case it helps others.
Converting a non-T5 REST-based application into a T5 + Tynamo RESTEasy
version. The original application used:
@Context
private UriInfo uriinfo;
to inject UriInfo to construct URLs to other REST services. but this
didin't work with Tynamo's RESTEasy. You *can* add "@Context UriInfo
uriInfo" to your method's parameters, but that ended up kind of ugly
passing it around all over the place. Since you couldn't @Inject the
UriInfo without some work, I came up with this to make it possible (add to
AppModule):
@Scope(ScopeConstants.PERTHREAD)
public static UriInfo build(HttpServletRequest request,
@Symbol(ResteasySymbols.MAPPING_PREFIX)
String restEasyPackage)
throws URISyntaxException
{
// Glue the container's context path to the T5 RESTEasy path so the
// URLs are constructed correctly.
String webServicePath = request.getContextPath() + restEasyPackage;
// Create the injectable and session-scoped UriInfo for this
request.
return new ResteasyUriInfo(request.getRequestURL().toString(),
request.getQueryString(), webServicePath);
}
With that added, you can put this in your web services implementation:
@Inject
private UriInfo uriInfo;
It works just like the @Context version, but is injected by T5. Hopefully
that will save someone some effort in the future if they need this feature.
mrg