Jerome Louvel | 7 Feb 00:05 2014

GitHub issues reorganization

Hi all,

In preparation of the new Restlet Framework 3.0 dev cycle, some clean-up was due in our GitHub issue tracker.

I have just reorganized the tags for clarity and constency based on our recent experience. We now have six aspects/dimensions for an issue:
  • Distribution: Zip | Maven | Eclipse (p2) | Windows
  • Version: 2.1 | 2.2 | 3.0
  • Edition: Android | GAE |GWT | Java SE | Java EE | OSGi
  • Module: Restlet API | Restlet Engine | Forge | Documentation
  • Extension: Atom | Crypto | ...
  • State: new | analysis | implementation | testing | escalated
  • Type: bug | feature | enhancement | task
  • Priority: critical | high | medium | low
Work still has to be done to properly label existing issues, but when you enter new issues, please try to properly set the labels for each dimension.

I've also cleaned up our milestones so provide the realistic set of issues that we are working on instead of the desired set. We will now use the "Priority" level to express this.

Here is the current set of milestones we have:
Best regards,
Andy Dennie | 25 Jan 14:33 2014

suggestion for facilitating exception translation

All of my ServerResource subclasses have methods containing exception translation boilerplate, like
this: 

public class MyResource extends MyBaseResource { 
     <at> Get 
    public Foo getFoo() { 
        Foo result = null; 
        try { 
            result = .... 
        } 
        catch (RuntimeException e) { 
            doCatch(e) 
        } 
        return result; 
    } 
} 

and then MyBaseResource implements doCatch like this: 

    protected void doCatch(final RuntimeException e) { 
        Class<?> exceptionClass = e.getClass(); 
        if (IllegalArgumentException.class.isAssignableFrom(exceptionClass)) { 
            // chain & translate to a 400 
            throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage(), e); 
        } 

        // NotFoundException is a custom exception class I've defined
        if (NotFoundException.class.isAssignableFrom(exceptionClass)
                || IndexOutOfBoundsException.class.isAssignableFrom(exceptionClass)) {
            // chain & translate to a 404
            throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage(), e);
        }

        if (UnsupportedOperationException.class.isAssignableFrom(exceptionClass)) {
            // chain & translate to a 405
            throw new ResourceException(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED, e.getMessage(), e);
        }

        // ConflictException is a custom exception class I've defined
        if (ConflictException.class.isAssignableFrom(exceptionClass)
                || IllegalStateException.class.isAssignableFrom(exceptionClass)) {
            // chain & translate to a 409
            throw new ResourceException(Status.CLIENT_ERROR_CONFLICT, e.getMessage(), e);
        }

        throw e; 
    } 

It would be nice if I didn't have to put that try/catch boilerplate in all my  <at> Get,  <at> Put,  <at> Post, etc. methods. 

I was thinking that a method like 
    protected ResourceException translateException(final RuntimeException e) 

defined on ServerResource would be nice to have.  It could be called from ServerResource.doHandle if an
exception is thrown, giving the resource object a chance to do the translation to a ResourceException.  If
that method returned null, then ServerResource could do its own translation. 

Thoughts?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=3072077

Jerome Louvel | 21 Sep 00:46 2013

New IntelliJ IDEA license

We have received a new license for IntelliJ IDEA that was kindly offered by JetBrains. Thanks to Martin Svenson for handling the process.

Restlet committers can contact me in order to get a copy.

Best regards,
Jerome

Paul Sprague | 7 May 16:51 2013
Picon

How to implement an AMQP client+server connector?

Hello!

Can anyone on this list make some recommendations as to how a connector could be implemented that isn't
based on HTTP? I was initially think that I needed to implement a connector, connection, controller,
in/outbound ways, etc. But after looking at the code I'm not so sure this is the correct approach.

My thought was to leverage Apache Qpid as the underlying implementation. I just need some idea as to how I can
integrate it into restlet.

Thanks,
Paul

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=3055055

Juan | 7 Jan 21:11 2013
Picon

access webservice with hostname versus localhost

I have been playing with the Restlet examples, seems that the URI defined in the router.attach call
(http://localhost:8111/hello) needs to called exactly like it from the clients, including the host
name. If my local machine is named galaxy18 and i run the webservice and local client, I can only access it
via localhost:8111/hello. If I change the router.attach to http://galaxy18:8111/hello then the
client can access it with galaxy18 but not with localhost.

I don't like hardcording, especially machine names, if you can imagine this will be a pain if my webservice
is running on different machines.

Is this an instance where I need to use read the hostname into a variable then use that in the router.attach or
am i missing something basic here?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=3041554

Jerome Louvel | 1 Oct 13:46 2012

Restlet license for IntelliJ IDE

Hi all,

 

For Restlet code contributors, we have a free license available thanks to JetBrains.

 

Please contact us directly for additional information.

 

Thanks,

Jerome

--

http://www.restlet.com

http://twitter.com/#!/jlouvel

 

Cyril Lakech | 23 Jul 19:19 2012
Picon

Restlet 2.1-RC5 and GWT 2.4 POST entity issue

Hi,

We use Restlet 2.1-RC5 and GWT 2.4 with restlet gwt extension and we
face a 415 error on posting content from the GWT app to the restlet
API: "Too few tokens in RPC request" (see errors below [1])

We can't find any solution to this exception. Debugging restlet/gwt
doesn't help...

Here is a sample of an entity sent to the server :

7|0|3|/wikeo-core/business/v2/families/|null|com.adeo.wikeo.business.family.domain.Family/881681172|1|2|3|

GET works perfectly, but when we try to POST/PUT content to the server
we get a 415 error

Any idea ?

[1]

Jul 23, 2012 4:01:21 PM org.restlet.service.ConverterService toObject
WARNING: Unable to convert a
[application/x-java-serialized-object+gwt,UTF-8] representation into
an object of class com.adeo.wikeo.business.family.domain.Family
java.io.IOException: Couldn't read the GWT object representation: Too
few tokens in RPC request at
org.restlet.ext.gwt.ObjectRepresentation.getObject(ObjectRepresentation.java:126)
at org.restlet.ext.gwt.GwtConverter.toObject(GwtConverter.java:149) at
org.restlet.service.ConverterService.toObject(ConverterService.java:167)
at org.restlet.resource.Resource.toObject(Resource.java:828) at
org.restlet.resource.ServerResource.doHandle(ServerResource.java:481)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:545)
at org.restlet.resource.ServerResource.post(ServerResource.java:1178)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:430)
at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:646)
at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:341)
at org.restlet.resource.ServerResource.handle(ServerResource.java:944)
at org.restlet.resource.Finder.handle(Finder.java:246) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Router.doHandle(Router.java:431) at
org.restlet.routing.Router.handle(Router.java:648) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:154)
at org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211) at
org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)
at org.restlet.Application.handle(Application.java:381) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Router.doHandle(Router.java:431) at
org.restlet.routing.Router.handle(Router.java:648) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.routing.Router.doHandle(Router.java:431) at
org.restlet.routing.Router.handle(Router.java:648) at
org.restlet.routing.Filter.doHandle(Filter.java:159) at
org.restlet.routing.Filter.handle(Filter.java:206) at
org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211) at
org.restlet.Component.handle(Component.java:392) at
org.restlet.Server.handle(Server.java:516) at
org.restlet.engine.ServerHelper.handle(ServerHelper.java:72) at
org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)
at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1089)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at net.stax.appserver.webapp.RequestMonitorValve.invoke(RequestMonitorValve.java:35)
at net.stax.appserver.admin.StaxApplicationQueryValve.invoke(StaxApplicationQueryValve.java:49)
at net.stax.appserver.webapp.RequestSetupValve.invoke(RequestSetupValve.java:31)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662) Caused by:
com.google.gwt.user.client.rpc.SerializationException: Too few tokens
in RPC request at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.extract(ServerSerializationStreamReader.java:809)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readInt(ServerSerializationStreamReader.java:493)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:104)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:138)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:385)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeClass(ServerSerializationStreamReader.java:670)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:724)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeClass(ServerSerializationStreamReader.java:698)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:724)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:560)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:138)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:385)
at org.restlet.ext.gwt.ObjectRepresentation.getObject(ObjectRepresentation.java:122)
... 60 more Caused by: java.lang.IndexOutOfBoundsException: Index: 9,
Size: 9 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at
java.util.ArrayList.get(ArrayList.java:322) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.extract(ServerSerializationStreamReader.java:807)
... 73 more Jul 23, 2012 4:01:21 PM org.restlet.engine.log.LogFilter
afterHandle INFO: 2012-07-23 16:01:21 109.7.6.135 - 10.202.30.193 80
POST /wikeo-core/business/v2/families/ - 415 554 156 37
http://toolfamilydev-antoine.webadeo.cloudbees.net Mozilla/5.0
(Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like
Gecko) Chrome/19.0.1084.56 Safari/536.5
http://toolfamilydev-antoine.webadeo.cloudbees.net/

Cyril Lakech
0684482444

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2992464

Dencel | 15 May 16:01 2012
Picon

Filter/FilterChain

I can't get my head around, why there is no filtering capability like servlet's Filter/FilterChain
available in Restlet.Is there a specific design decision at the basis for this? 

Something like: 
Authenticator authenticator = new MyAuthenticator();
Router router = new Router()
router.attach("/secure",MyResource.class);
router.attachFilter("/secure",authenticator);
router.attach("/secure2",MyResource2.class);
router.attachFilter("/secure2",authenticator);
router.attachDefault(PublicResource.class);

Looks more meaningful to me then: 
Authenticator authenticator = new MyAuthenticator();
authenticator.setNext(MyResource.class);
router.attach("/secure",authenticator);
authenticator = new MyAuthenticator();
authenticator.setNext(MyResource2.class);
router.attach("/secure2",authenticator);

In the first method there is only one filter entity created vs the two entities on the 2nd example. I've
implemented this already in my own project, but I like to know what the downside is of this approach. Imo the
only downside is there is no default Restlet API implementation of this mechanism.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2960919

Andy Dennie | 14 May 20:49 2012

setting up git repos and branches

Hi everyone,

I want to be able to occasionally submit fixes to Restlet, while maintaining local branches on my dev
machine that (a) keep up-to-date with Restlet's branches, and (b) contain my fixes, including those that
I have not yet submitted back to Restlet, and those I have submitted but which have not yet been accepted and
merged (and maybe never will be, but nevertheless I need those changes for my own use).

I'm pretty new to git, and I'd like to get off on the right foot here.

Here's what I'm thinking, please advise on whether this makes sense or if there are preferable alternatives.

As an initial setup:

- clone "https://github.com/restlet/restlet-framework-java" to my local dev environment
- in my local repo, create branches off each of the Restlet-defined branches, e.g. branch "my-master" from
"master", "my-2.2" from "2.2", etc.
- on github, fork restlet/restlet-framework-java to adennie/restlet-framework-java so that I have a
place to push fixes, and from which I can send pull requests to restlet/restlet-framework-java.

When I want to work on a fix, I would (in my local dev environment):

- make sure "master" is up-to-date by pulling from origin/master
- merge "master" into "my-master"
create a topic branch off "master" (e.g. "issue-123")
- when ready, push my topic branch to my forked repo on github, and submit a pull request 
- back in my local environment, merge my topic branch into "my-master", so that when building my dependent
project against "my-master", I see all my fixes.
if applicable, backport my fixes to "my-2.2" or "my-2.1" branches by cherry-picking them from
"my-master", so that I can build against a specific version of the library instead of "my-master" if I
don't want to live on the bleeding edge.

Can you guys advise my on this approach?  How do you do it?  

Thanks in advance.
-Andy

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2960550

izia man | 13 May 00:56 2012
Picon

code samples

Hi
I'm new in web service and rest (I'm tried to learn it myself). I want to create a program that holds a manger
that send object (or object likes) and by the input of the object the client react. I had a little research in
the web and a lot of developer recommend your project "restlet" that he so lite simple and give a very good performance.

but when I try to learn about it, it's very hard to learn.
you say a very little instruction and a small part of the code.

is there any where a full code sample and a guide  of restlet especially whit android an xstream? 

thank you
izia man

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2959893

Michael Stein | 12 May 12:08 2012
Picon
Picon

How to use restlet with proxy and how to use extensions in general

Hi all, 
unfortunately I am not very familiar with restlet to be able to set up a
working project where to send a getRequest over a company proxy which needs
authentication. Without a proxy  this simple snippet works perfect:

ChallengeResponse authentication  = new
ChallengeResponse(ChallengeScheme.HTTP_BASIC, user, password);
ClientResource resource = new ClientResource(this.resourceUri);
resource.setChallengeResponse(authentication);
resource.get().write(byteArrayOS);

But although I googled since some days I cannnot find a clear example on how
to use proxAuthentication. What I found is that I could use the
hhtpClient-Extension from apache for example But then the question is on who
to use this extension?? Is it necesary to use the standard methods and
classe from the httpClient lib directly? Or am I able to call everything by
the use of restlet-Api. The examples of who to use HttpClient with proxy
seems clear to me, but who does this work as part of restlet?

Thanks in advance for all replies on who to solve this. Perhaps some hints
will help.
Mikel 

--
View this message in context: http://restlet-code.1609877.n2.nabble.com/How-to-use-restlet-with-proxy-and-how-to-use-extensions-in-general-tp7553140.html
Sent from the Restlet Code mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2959780


Gmane