--
Weinan Li
On Wednesday, September 4, 2013 at 4:58 AM, Jakub Narloch wrote:
Hi,
I was actually curiouse if there is a similar functionality in RESTeasy
to the Jersey InjectableProvider?
If I didn't make any mistake, seems RESTEasy doesn't have similar functions.
RESTEasy's @Context let you inject:
javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.UriInfo,
javax.ws.rs.core.Request, javax.servlet.HttpServletRequest,
javax.servlet.HttpServletResponse, javax.servlet.ServletConfig,
javax.servlet.ServletContext, and javax.ws.rs.core.SecurityContext objects.
If you want to use something like:
public String uppercase(@Context Locale locale) { return this is
lowercase.toUppercase(locale); }
and:
@Provider
public class LocaleProvider
extends AbstractHttpContextInjectableLocale
implements InjectableProviderContext, Type {
@Override
public InjectableE getInjectable(ComponentContext ic, Context a, Type c) {
if (c.equals(Locale.class)) {
return this;
}
return null;
}
@Override
public ComponentScope getScope() {
return ComponentScope.PerRequest;
}
@Override
public Locale getValue(HttpContext c) {
final Locales locales = c.getRequest().getAcceptableLanguages();
if (locales.isEmpty()) {
return Locale.US;
}
return locales.get(0);
}
}
in Jersey.
I don't know how to do this in RESTEasy(I wonder if there is a way). Please
blame me if there *is* a way to do this in RESTEasy and I don't know how
because of my lack of knowledge :-)
The interface basically allows to
define provider for custom object injection.
Thanks in advance,
Jakub Narloch
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
(mailto:Resteasy-users@lists.sourceforge.net)
https://lists.sourceforge.net/lists/listinfo/resteasy-users
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users