Parameters for annotated resources with interface?
Is it possible to do something like this... public interface AccountResource { @Get public Account get(int id); } public class AccountServerResource implements AccountResource { public Account get(int id) { return doSomethingToGetAccount(id); } } If there is I'm missing it. I can't figure out how the framework would parse the id out of the request and pass it to the annotated method? Norm -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2993117
RE: OAuth2: How to resolve "Unable to get the template authorize.html."
Thank you for the response. I was able to use setTemplateLoader to get my own code to point at a particular directory - but I didn't see how to change what AuthPageServerResource was doing (without of course changing that code and having my own version of it - which I didn't want to do). Did you find a way to change the behavior of AuthPageServerResource? Thanks again, RB -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/OAuth2-How-to-resolve-Unable-to-get-the-template-authorize-html-tp7575959p7578246.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2993078
Re: Unable to retrieve URI query and path from link
I've used the following code successfully to proxy images. Overriding getTargetRef involves more code, but it also gives you direct control over the redirection. (This code works, but I'd love to hear from experts whether there is a better way. Also, I'm not sure, but I think it interacts badly with caching when Apache httpd is in front of it. Does that ring a bell?) @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); router.attachDefault(new Filter(getContext(), new Redirector(getContext(), "", MODE_SERVER_OUTBOUND) { @Override protected Reference getTargetRef(Request request, Response response) { String rr = request.getResourceRef().getRemainingPart(true); // Strip initial slash, if present. if (rr.startsWith("/")) { rr = rr.substring(1); } return new Reference(rr); } } ) { // We only redirect to URIs that look like images. @Override protected int beforeHandle(Request request, Response response) { String rr = request.getResourceRef().getRemainingPart(true); if (!IMG_PATTERN.matcher(rr).find()) { response.setStatus(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE, "Not an image type"); return Filter.STOP; } return Filter.CONTINUE; } }); return router; } --tim On Wed, Jul 25, 2012 at 9:02 AM, Laurens Rietveld < laurens.rietv...@gmail.com> wrote: > I'm currently dealing with the following scenario: I want to forward users > to > a different site using the Redirector class. The site to forward the user > to > is included in the url: e.g. > http://localhost/restlet/http://www.google.com?q=just-a-query. > > I'm not using TYPE_URI_ALL because I want to process the path and query > separately. I use the TYPE_URI_PATH and TYPE_URI_QUERY for this. Problem > is: > the url used above does not match this pattern. Below is the code I use. > I'm > clearly overlooking something, as this is not a strange scenario. Could > someone help me out? (ps. I use the 2.2-snapshot version) > > Router router = new Router(getContext()); > Redirector redirector = new Redirector(getContext(), "{uriPath}?{query}", > Redirector.MODE_CLIENT_FOUND); > TemplateRoute route = router.attach("/restlet/{uriPath}?{query}", > redirector); > Map routeVariables = route.getTemplate().getVariables(); > routeVariables.put("uriPath", new Variable(Variable.TYPE_URI_PATH)); > routeVariables.put("query", new Variable(Variable.TYPE_URI_QUERY)); > > > > -- > View this message in context: > http://restlet-discuss.1400322.n2.nabble.com/Unable-to-retrieve-URI-query-and-path-from-link-tp7578244.html > Sent from the Restlet Discuss mailing list archive at Nabble.com. > > -- > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992932 > -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992947
Unable to retrieve URI query and path from link
I'm currently dealing with the following scenario: I want to forward users to a different site using the Redirector class. The site to forward the user to is included in the url: e.g. http://localhost/restlet/http://www.google.com?q=just-a-query. I'm not using TYPE_URI_ALL because I want to process the path and query separately. I use the TYPE_URI_PATH and TYPE_URI_QUERY for this. Problem is: the url used above does not match this pattern. Below is the code I use. I'm clearly overlooking something, as this is not a strange scenario. Could someone help me out? (ps. I use the 2.2-snapshot version) Router router = new Router(getContext()); Redirector redirector = new Redirector(getContext(), "{uriPath}?{query}", Redirector.MODE_CLIENT_FOUND); TemplateRoute route = router.attach("/restlet/{uriPath}?{query}", redirector); Map routeVariables = route.getTemplate().getVariables(); routeVariables.put("uriPath", new Variable(Variable.TYPE_URI_PATH)); routeVariables.put("query", new Variable(Variable.TYPE_URI_QUERY)); -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Unable-to-retrieve-URI-query-and-path-from-link-tp7578244.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992932
RE: OAuth2: How to resolve "Unable to get the template authorize.html."
Hi Richard Please try the solution described here : http://stackoverflow.com/questions/9651019/cant-get-resource-files-in-my-template-files-using-restlet-and-freemarker It consiste to add the following lines in your codes : Configuration configuration = new Configuration(); configuration.setTemplateLoader( new ClassTemplateLoader(ClassInTheClasspath.class, "/rootpath/under/classpath/"); configuration.setObjectWrapper(new DefaultObjectWrapper()); I had the same problem as you and manage to get it resolved Thierry LAU Best Regards -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992867
RE: Enable only selected cipher suites
Hi all, I'm happy to report that this SSL cipher configuration issue has been fixed in both 2.1 and 2.2 branches, with the help from Jim Zuber and his team at QualityLogic. The fix, which has some similarities with the changes made by Andreas, will be available in the upcoming snapshot builds. Best regards, Jerome -- http://www.restlet.com http://twitter.com/#!/jlouvel -Message d'origine- De : Enoch [mailto:stephenen...@yahoo.co.uk] Envoyé : samedi 7 juillet 2012 03:08 À : discuss@restlet.tigris.org Objet : RE: Enable only selected cipher suites Andreas, Found org.restlet.ext.ssl.DefaultSslContextFactory in "Version 2.1 Release Candidate 5". Will try the code. Thanks, Enoch -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Enable-only-selected-cipher-sui tes-tp7578116p7578183.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=29774 78 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992862
RE: Oauth Client example
Hi Luko Please replace with the following lines. It works for me : OAuthUser u = (OAuthUser) getRequest().getClientInfo().getUser(); String token = u.getAccessToken(); Best regards Thierry -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992855