lib/org.restlet.ext.ssl.jar missing from 2.2.2 zip

2014-08-20 Thread Robert Barnett
The 2.2.2 documentation states that to enable https one must add 
lib/org.restlet.ext.ssl.jar to the class path. (source: 
http://restlet.com/learn/guide/2.2/core/security/https)  But no such jar 
appears in the distribution.  Omitting this jar appears to lead to the runtime 
exception:

java.lang.ClassNotFoundException: org.restlet.ext.ssl.PkixSslContextFactory

Please advise.

Thanks.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3086969


RE: Re: Restlet 2.2.1 only serves from one thread

2014-08-06 Thread Robert Barnett
Hi Thierry,

Can you help me understand why the out of the box configuration is not 
appropriate for production?

Best,
Matt

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3086334


Restlet 2.2.1 only serves from one thread

2014-08-05 Thread Robert Barnett
I had a very strange latency issue pop up today which I have isolated to an 
apparent issue with 2.2.1.  I can take the Hello World stand alone example 
from Restlet.com and modify the Resource to be:

package firstSteps;

import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class HelloWorldResource extends ServerResource {

@Get
public String represent() throws InterruptedException
{
System.out.println(Thread.currentThread().getId());
Thread.sleep(1);
return hello, world;
}
}

I then take two browsers, Firefox and Chrome, and make a request from each.  
Firefox shows Hello World after 10 seconds and Chrome after 20.  Looking at the 
console I see that both requests were serviced by the same thread.  I can the 
take my load generator, jMeter, and send a lot of requests in parallel to 
Restlet.  Restlet processes them one at a time and always with the same thread. 
It is as if the default thread pool size is one. When I downgrade to 2.1 and 
run the same tests, the issue goes away with a variety of threads servicing the 
requests in parallel.

Please advise.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3086285


Restlet.com download broken.

2014-07-31 Thread Robert Barnett
When attempting to download Restlet binaries from 
http://restlet.com/download/2.2/restlet-jse-2.2.1.zip the download only makes 
it to about 10 megs and then has a network error.

Please advise.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3086063


ClientConnectionHelper hanging

2013-10-25 Thread Robert Fischer
I'm using Restlet 2.2-M3. I'm getting into cases where the Restlet client is 
hanging. It's hanging on the latch.await() on line 444 in 
ClientConnectionHelper.java:

// Prepare the latch to block the caller thread
CountDownLatch latch = new CountDownLatch(1);
request.getAttributes().put(CONNECTOR_LATCH, latch);

// Add the message to the outbound queue for processing
addOutboundMessage(response);

// Await on the latch
latch.await();


The addOutboundMessage(response) code looks like it's trying to wake up a 
selector to handle the message, so I suspect that the selector must be null or 
empty...but why is that? Is there a way to work around things?

I saw this issue on Stack Overflow:
http://stackoverflow.com/questions/12832381/resourceclient-hanging-on-locksupport-park-on-sunos-when-connecting-to-restlet

Based on that, I added the timeouts as specified here:
https://github.com/restlet/restlet-framework-java/issues/669#issuecomment-9154393

But what's the underlying issue?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3067097


RE: Apparently-random UnknownHostException while attempting POST operation

2013-09-25 Thread Robert Dodier
Problem solved, I hope -- apparently IPv6 causes trouble for the Java VM -- 
this is a bug in Java, but a workaround is to put 
-Djava.net.preferIPv4Stack=true on the Java command line. It seems to have made 
the UnknownHostException go away, so I am happy!

Others have bumped into this bug; see:
http://stackoverflow.com/questions/1608503/domain-name-resolution-not-working-in-java-applications-on-ubuntu64-9-04-machine

and also:
http://www-01.ibm.com/support/docview.wss?uid=nas8N1011363

Hope this helps,

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3065253


Apparently-random UnknownHostException while attempting POST operation

2013-09-24 Thread Robert Dodier
Hi, I am working with Restlet 2.1.2 on Linux (RHEL 6 on x86_64). java
-version reports:

java version 1.6.0_24
OpenJDK Runtime Environment (IcedTea6 1.11.3) (rhel-1.48.1.11.3.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

I have a thread which executes a POST every few seconds. Every now and
then (happens irregularly, perhaps varying from a few minutes to an
hour) I get UnknownHostException for a while (varies, perhaps about a
minute) and then POST succeeds for some time after that. The
UnknownHostException is puzzling because the host name is always the
same, and if I try resolving the name another way (namely, using the
host program on the command line) then the host name is resolved.

I've appended a typical stack trace below. Thanks in advance for any
light you can shed on this question.

best

Robert Dodier

PS.
An error occurred during the communication with the remote HTTP server.

java.net.UnknownHostException: innovmdmtest.cloudapp.net
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
at java.net.InetAddress.getAllByName(InetAddress.java:1128)
at java.net.InetAddress.getAllByName(InetAddress.java:1064)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at 
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at 
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at 
org.restlet.ext.httpclient.internal.HttpMethodCall.sendRequest(HttpMethodCall.java:336)
at org.restlet.engine.adapter.ClientAdapter.commit(ClientAdapter.java:114)
at 
org.restlet.engine.adapter.HttpClientHelper.handle(HttpClientHelper.java:112)
at org.restlet.Client.handle(Client.java:180)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1136)
at 
org.restlet.resource.ClientResource.handleOutbound(ClientResource.java:1225)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1025)
at org.restlet.resource.ClientResource.post(ClientResource.java:1418)
at foo.bar.RelayToRestServer.postToRestServer(RelayToRestServer.java:183)
at foo.bar.RelayToRestServer.relay(RelayToRestServer.java:114)
at foo.bar.RelayToRestServer.recalculate(RelayToRestServer.java:101)
at foo.bar.MyTimerTask.run(MyTimerTask.java:126)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Communication Error (1001) - The connector failed to complete the
communication with the server
at org.restlet.resource.ClientResource.doError(ClientResource.java:612)
at 
org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1202)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1026)
at org.restlet.resource.ClientResource.post(ClientResource.java:1418)
at foo.bar.RelayToRestServer.postToRestServer(RelayToRestServer.java:183)
at foo.bar.RelayToRestServer.relay(RelayToRestServer.java:114)
at foo.bar.RelayToRestServer.recalculate(RelayToRestServer.java:101)
at foo.bar.MyTimerTask.run(MyTimerTask.java:126)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Caused by: java.net.UnknownHostException: innovmdmtest.cloudapp.net
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
at java.net.InetAddress.getAllByName(InetAddress.java:1128)
at java.net.InetAddress.getAllByName(InetAddress.java:1064)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149

RE: endless Too many open files exceptions

2013-06-17 Thread Robert Dodier
Following up on my own message here -- after switching
to the Restlet client based on Apache HttpClient, the
Too many open files exceptions seemed to have gone away. 
Hurray!

best

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3058296


RE: How to tell which client connector library is being used

2013-06-10 Thread Robert Dodier
 It seems that you are missing the
 org.restlet.ext.httpclient.jar in the classpath which
 will actually support the Apache HTTP client library.

Thanks for the tip. I've updated the classpath.
I realize now that I didn't pay attention to the
lib/readme.txt which has the list of jars for
the Apache Httpclient extension.

Incidentally lib/readme.txt doesn't mention that
the SSL library is needed by the Httpclient extension.
I found out by getting a ClassNotFoundException
for SslUtils (used by HttpClientHelper). I suppose
that's a bug.

I have to say this business of changing the
connectors based on what's in the classpath is
really a disaster. Surely it would be better to
name the connector class somewhere.

best

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3057410


How to tell which client connector library is being used

2013-05-31 Thread Robert Dodier
Hello,

I am using Restlet as a client (and also as a server, but I am not
having problems with that). I ran into a problem in which Restlet
would start throwing Exceptions after running for a few days --
too many open files at first, for a while, then after a while,
UnknownHostException. Dunno what's going on there.

Anyway I tried to replace the default client connector
with the connector based on Apache HttpClient.
From what I can tell, if I put the Apache HttpClient jars
in the classpath, it will be used automatically.
Is that right? How can I tell which client connector is
being used? I don't see any kind of log output which tells
the client connector class.

I've appended the first too many open files exception;
many more are thrown after that. I don't see any org.apache
classes in the stack trace -- should I expect to see some
if the Apache HttpClient is in use?

Thanks for any light you can shed on this problem.

Robert Dodier

PS. Here are the jars relevant to Restlet in the classpath:

org.json.jar
org.restlet.ext.json.jar
org.restlet.jar
org.eclipse.jetty.server.jar
org.eclipse.jetty.io.jar
org.eclipse.jetty.continuation.jar
org.eclipse.jetty.http.jar
org.eclipse.jetty.ajp.jar
org.eclipse.jetty.util.jar
org.restlet.ext.jetty.jar
org.apache.httpclient.jar
org.apache.commons.logging.jar
org.apache.commons.codec.jar
javax.servlet.jar

PPS.
Communication Error (1001) - The connector failed to complete the
communication with the server
at org.restlet.resource.ClientResource.doError(ClientResource.java:612)
at 
org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1202)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1026)
at org.restlet.resource.ClientResource.post(ClientResource.java:1418)
[snip my code which is kicked off by a timer and calls Restlet]
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Caused by: java.net.SocketException: Too many open files
at sun.nio.ch.Net.socket0(Native Method)
at sun.nio.ch.Net.socket(Net.java:115)
at sun.nio.ch.SocketChannelImpl.init(SocketChannelImpl.java:102)
at 
sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:55)
at java.nio.channels.SocketChannel.open(SocketChannel.java:122)
at 
org.restlet.engine.connector.ClientConnectionHelper.createSocketChannel(ClientConnectionHelper.java:128)
at 
org.restlet.engine.connector.ClientConnectionHelper.getBestConnection(ClientConnectionHelper.java:316)
at 
org.restlet.engine.connector.ClientConnectionHelper.doHandleOutbound(ClientConnectionHelper.java:194)
at 
org.restlet.engine.connector.BaseHelper.handleOutbound(BaseHelper.java:627)
at 
org.restlet.engine.connector.ClientConnectionHelper.handleOutbound(ClientConnectionHelper.java:466)
at org.restlet.engine.connector.BaseHelper.control(BaseHelper.java:240)
at org.restlet.engine.connector.Controller.doRun(Controller.java:88)
at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:162)
at org.restlet.engine.connector.Controller.run(Controller.java:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3056810


Re: endless Too many open files exceptions

2013-05-15 Thread Robert Dodier
 You should try to use the Jetty or Simple connector
 extensions instead, they are more stable
 at this point.

OK, thanks for the advice.
I don't suppose it makes much difference, but
I'm curious to know whether the particular
kind of error which I observed is anything which
has been observed before. Also whether the
too many open files error is a consequence
of some known weakness. What I'm trying to
find is some assurance that the problem will
go away if I use some other classes.

Thanks for your help, I appreciate it very much.

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3055617


endless Too many open files exceptions

2013-05-14 Thread Robert Dodier
Hi,

I am working with Restlet 2.1.2, using both client and server
code as parts of a larger applications.

After working correctly for some time (maybe days),
a GET request causes an endless succession of
Too many open files exceptions. As it happens,
those are being written into a log file (by nohup) and
eventually exhaust all available disk space -- it appears
the exceptions just keep pouring out, one after another.
Maybe the failed connection is retried immediately, so that
fails again with the same error? Just guessing. I looked at
the source code but I can't tell what's going on.

Here is one such exception. The message is printed by
ServerConnectionController.onSelected.

  Unexpected error while accepting new connection

  java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at 
sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:163)
at 
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerConnectionController.java:103)
at 
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:308)
at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:171)
at org.restlet.engine.connector.Controller.run(Controller.java:159)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)

(Yes, maybe I could rework the logging configuration so
that it would only fill up a certain amount and then rotate
the log file. That doesn't address the underlying problem.)

It might (or might not) be the case that the error occurs
after a long time in which there are no requests -- i.e.
that it happens on the first request after a long pause.
Not sure about that.

Has anyone seen such a problem? Yes, it would really
help if I could narrow down the problem in time  space.
Yes, I certainly want to do that, and I have not yet
succeeded at it.

Host OS is RedHat Enterprise Linux 6.
java -version says:

  java version 1.6.0_24
  OpenJDK Runtime Environment (IcedTea6 1.11.3) (rhel-1.48.1.11.3.el6_2-x86_64)
  OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Thanks for any light you can shed on this problem.

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3055447


Re: Serving static files using Directory and CLAP from a jar

2013-01-11 Thread Robert Brewer
Hmm, I could not clap and jars for a directory to work. Do you have
the test code that worked available? I will try reducing my code to a
bare minimum to see what is going on, but another project has come up
so I have to investigate later.

Thanks for your help.

On Wed, Jan 9, 2013 at 10:36 PM, Thierry Boileau tboil...@restlet.com wrote:
 Hi Robert,

 I've just tried the clap connector using a jar file and it works for me (I
 mean such url works : http://localhost:8182/stat/index.html;,
 http://localhost:8182/stat/;). Just take care to complete properly the
 classpath when lauching your application from the command line.

 Best regards,
 Thierry Boileau


 2013/1/10 Thierry Boileau tboil...@restlet.com

 Hello Robert,

 from what I notice, the resolution of a file is more or less based on
 the ability to discover ressources having the same base name. A file
 directory is perfect because it is possible to list all ressources within
 the same parent directory.
 A classloader is more retrictive and gives access to a single resource...
 which explains the behaviour of the indexName attribute of a Directory.
 I check why it does not work from a jar file.

 You can also connect the Directory with the jar file using the JAR
 protocol or the ZIP protocol. Such protocol is based on the JDK ZipEntry
 class which has the ability to list files (such as a directory).
 directory = new Directory(getContext(), zip: +
 LocalReference.createFileReference(new File(/your/path)) + !/ );
 Of course, it obliges you to reference the jarfile from itself. You can
 consider this as a workaround.

 Best regards,
 Thierry Boileau


 2013/1/10 Robert Brewer rbre...@lava.net

 Hello Restlet folks. I have a problem serving static files using
 Restlet's Directory class and the CLAP pseudo protocol (apparently a
 popular topic right now :)

 I have a standalone web application that uses Restlet to provide a
 RESTful API. Some students taking a class have written a nice client
 for the web application as a Single Page Application (SPA) consisting
 of HTML5/CSS/Javascript. I would like to store a directory containing
 the static SPA files in my web application's jar file and to serve
 them under a specific URI so the SPA client and server are
 self-contained

 The way I am trying to do this is:

   public synchronized Restlet createInboundRoot() {
 ...
 Directory directory = new Directory(getContext(),
 clap://class/spa/);
 router.attach(/spa/, directory);
 ...

 Unfortunately, this doesn't work. When I run the server from my jar
 file and point a browser at /spa/, the browser downloads an empty
 file (Chrome calls it download, Safari calls it spa) rather than
 rendering the page. Browsing to /spa/index.html does work, but I
 don't want users to have to remember to add the index.html.

 Am I doing something wrong here? It seems like this should work. I'm
 open to other ways to accomplish this goal.

 Annoyingly, the server behaves differently when running from Eclipse
 than when running from a jar file, which makes troubleshooting this
 problem more painful since I have to build the jar file to test
 fixes.For example, when running from Eclipse, /spa/ gives a 404
 error, instead of downloading an empty file.

 I also tried playing with setIndexName(). If I set it to index.html
 (including the extension despite the Javadoc saying the parameter
 should be without extension), then it works when run from Eclipse but
 not from the jar file.

 Thanks in advance for any suggestions on how to make this work!

 --
 Robert Brewer
 http://excitedcuriosity.wordpress.com/
 https://www.facebook.com/kukuicup

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3042270

--
Robert Brewer
http://excitedcuriosity.wordpress.com/
https://www.facebook.com/kukuicup

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3042617


Serving static files using Directory and CLAP from a jar

2013-01-09 Thread Robert Brewer
Hello Restlet folks. I have a problem serving static files using
Restlet's Directory class and the CLAP pseudo protocol (apparently a
popular topic right now :)

I have a standalone web application that uses Restlet to provide a
RESTful API. Some students taking a class have written a nice client
for the web application as a Single Page Application (SPA) consisting
of HTML5/CSS/Javascript. I would like to store a directory containing
the static SPA files in my web application's jar file and to serve
them under a specific URI so the SPA client and server are
self-contained

The way I am trying to do this is:

  public synchronized Restlet createInboundRoot() {
...
Directory directory = new Directory(getContext(), clap://class/spa/);
router.attach(/spa/, directory);
...

Unfortunately, this doesn't work. When I run the server from my jar
file and point a browser at /spa/, the browser downloads an empty
file (Chrome calls it download, Safari calls it spa) rather than
rendering the page. Browsing to /spa/index.html does work, but I
don't want users to have to remember to add the index.html.

Am I doing something wrong here? It seems like this should work. I'm
open to other ways to accomplish this goal.

Annoyingly, the server behaves differently when running from Eclipse
than when running from a jar file, which makes troubleshooting this
problem more painful since I have to build the jar file to test
fixes.For example, when running from Eclipse, /spa/ gives a 404
error, instead of downloading an empty file.

I also tried playing with setIndexName(). If I set it to index.html
(including the extension despite the Javadoc saying the parameter
should be without extension), then it works when run from Eclipse but
not from the jar file.

Thanks in advance for any suggestions on how to make this work!

--
Robert Brewer
http://excitedcuriosity.wordpress.com/
https://www.facebook.com/kukuicup

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3042270


Re: Empty server response in 2.1 RC5

2012-07-11 Thread Robert Brewer
Ioannis Mavroukakis wrote:
 Hi Robert, you say most so that makes me assume some of them work.
 What are the functional differences between the ones that do work and the
 ones that don't ?

I tracked down the problem to some code I used to add an additional HTTP 
header. I found the code here:

http://blog.arc90.com/2008/09/15/custom-http-response-headers-with-restlet/

Here is the offending code:

Form responseHeaders =
(Form) 
getResponse().getAttributes().get(HeaderConstants.ATTRIBUTE_HEADERS);
if (responseHeaders == null) {
  responseHeaders = new Form();
  getResponse().getAttributes().put(HeaderConstants.ATTRIBUTE_HEADERS, 
responseHeaders);
}
// The following line causes server to send empty replies on Restlet 2.1 RC5
responseHeaders.add(Access-Control-Allow-Origin, *);

I switched to the method explained here:

http://restlet-discuss.1400322.n2.nabble.com/Adding-response-headers-in-restlet-2-1-x-td7240340.html

and now things work OK. Should I open a bug for the previous method? At the 
very least it should be mentioned in the 2.1 migration guide.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2982983


Empty server response in 2.1 RC5

2012-07-09 Thread Robert Brewer
In troubleshooting a Restlet problem (see the thread Restlet thread
pool exhaustion), I am trying a switch from Restlet 2.0.14 to 2.1
RC5. The only migration guide I could find was here:

http://wiki.restlet.org/docs_2.1/13-restlet/21-restlet/171-restlet/155-restlet.html

I fixed up a few minor errors and deprecation warnings, but now most
of my ServerResources (which work fine in 2.0.14) return empty replies
to clients: no HTTP response headers, nothing. I have traced them in
the Eclipse debugger, and my code seems to generate the XML response
body just fine, but somewhere in the long call chain the client just
gets disconnected.

Has anyone seen this before? Is there any other documentation
migrating to 2.1 I should be aware of?

Thanks!

-- 
Robert Brewer
http://excitedcuriosity.wordpress.com/
https://www.facebook.com/kukuicup

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2980726


Restlet thread pool exhaustion

2012-07-06 Thread Robert Brewer
Hello Restlet folks. I'm the lead developer on the WattDepot system,
which collects and stores energy data, and we use Restlet on both
server and client sides. We recently switched from Restlet 1.1.8 to
2.0.11 and now have some pretty severe stability problems.

Our sensor client spawns multiple threads (one per power meter being
polled), each of which does PUTs to our server. The problem we have
run into is that after a period of time (about 2-3 days), the server
stops accepting connections. The ending log file entries on the server
look something like this:

Jul 5, 2012 3:48:33 PM org.restlet.engine.http.connector.BaseHelper$1
rejectedExecution
WARNING: Unable to run the following server-side task: Read connection
messages: true
Jul 5, 2012 3:48:33 PM org.restlet.engine.http.connector.BaseHelper$1
rejectedExecution
INFO: Worker service state: Full
Jul 5, 2012 3:48:33 PM org.restlet.engine.http.connector.BaseHelper$1
rejectedExecution
INFO: Worker service tasks: 0 queued, 10 active, 71196 completed,
71206 scheduled.
Jul 5, 2012 3:48:33 PM org.restlet.engine.http.connector.BaseHelper$1
rejectedExecution
INFO: Worker service thread pool: 1 core size, 10 largest size, 10
maximum size, 10 current size
Jul 5, 2012 3:48:33 PM org.restlet.engine.http.connector.Controller run
INFO: Stop accepting new connections and transactions. Consider
increasing the maximum number of threads.

At this point, using netstat, I can see many established TCP
connections to the server, and the server does not respond to further
connections. Terminating the client causes the TCP connections to go
away (as one would expect), but the server still does not respond to
new connections.

I've created a client that sends bogus data very quickly so that I can
more easily reproduce the problem (and test fixes). The amount of time
before the problem occurs seems to vary from as little as 5 minutes,
to 35 minutes (or more) so the time to failure is not deterministic.

I've searched this mailing list, and found helpful threads like this
one that explain how to increase the maximum number of threads for
HTTP listening:

http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447viewType=browseAlldsMessageId=2625612

However, increasing maxThreads from the default of 10 seems like it
would just postpone the thread exhaustion, rather than solve the
underlying problem.

Another classic cause of thread exhaustion appears to be a failure to
release ClientResources after use, as discussed in this very helpful
thread:

http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447viewType=browseAlldsMessageId=2885182#messagefocus

The SimpleServerPut example code given in that thread produces log
messages very similar to the ones we see, and when a call to
clientResource.release() is added to SimpleServerPut the problems go
away. I've read over our relevant client code, and I think we are
calling clientResource.release() after each use, but it is possible
there is some path where it isn't getting called.

So here are my questions:

1) What's going on when the server gets wedged? If a client was
holding open too many connections, I could see how the server would
stop accepting new ones, but when I stop the client, the server
remains wedged. Is Restlet leaking threads somehow? It seems like this
should never happen.

2) Is there a good way to tell if we are failing to release a
ClientResource somewhere?

3) Is it legal to call ClientResource.release() more than once? I
might try wrapping the client methods in a big try/catch/finally to
ensure that release() is always being called.

4) Having to ensure that each ClientResource is explicitly released
seems like a pain. Is there a way to avoid this?

This stability problem is preventing us starting a beta test of a
project that relies on WattDepot, so I'm eager to resolve this
quickly. I'm open to any suggestions on how to debug, fix, or
workaround this problem. Would upgrading to Restlet 2.1 help?

Thank you!

-- 
Robert Brewer
http://excitedcuriosity.wordpress.com/
https://www.facebook.com/kukuicup

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2976364


Re: Restlet thread pool exhaustion

2012-07-06 Thread Robert Brewer
On 6 Jul 2012, at 06:06:38, Ioannis Mavroukakis imavrouka...@gmail.com wrote:

 Hi Robert, neat project you have going on there. I will answer a tiny part
 of your question, I've load tested 2.1-RC5 heavily and after careful tweaking
 I've yet to reach the worker limit scenario you detail here.

 My setup is: 150 maxThreads, 10 minThreads, 145 lowThreads, maxQueued 20
 but ofc YMMV.

Thanks for the reply Ioannis. So did the careful tweaking you did come down to 
just those parameters above?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2977064


Deploying restlets on a commercial hosting service?

2011-03-24 Thread Robert P Futrelle
I work in Java for servers and clients. They all work fine on my local
machine (most of the time   ;-).

Is anyone familiar with the issues (limitations?) that could arise in
attempting to create a java restlet server and then deploying it/them on a
commercial hosting site?

They all have Apache available, but I'm not familiar enough with web
software architecture to know what can be put behind Apache.

 - Bob Futrelle
   BioNLP.org
   Northeastern University


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Deploying-restlets-on-a-commercial-hosting-service-tp6204385p6204385.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2713845

how to deal with 2d arrays in the request?

2010-03-18 Thread Robert
hey!

the clientrequest contains an array[][].

in my resource I want to get this data:

getRequest().getEntityAsForm().getValues(myArray[][])

this gives me a flattened string.
but how can I get this array into or map? is there already an appropriate 
method or do I have to parse this string?

thanks in advance!

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2461664


RE: Re: how to deal with 2d arrays in the request?

2010-03-18 Thread Robert
this is what firebug says:

http://dl.dropbox.com/u/1266822/array.png

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2461713


RE: Re: setting up a server as a proxy

2010-01-07 Thread Robert
Hey Thierry!

Thanks for your fast answer. At the moment I am running my application in a 
servlet container inside a j2ee webapplication. Here you can see the code:
http://pastebin.com/m5da09472

I don't get it how to change the code :(
Would be really nice if you could help me.
Thanks again!

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2435226


setting up a server as a proxy

2010-01-06 Thread Robert
Hello!

I tried to create a resource that behaves like a proxy. The client sends an url 
and the server loads the url and sends the data to the client.

I extended a ServerResource and created a new ClientResource inside to fetch a 
specific url and pass the data to the client. But this doesn't work:
The protocol used by this request is not declared in the list of client 
connectors. (HTTP)

Where is the mistake? Is there an easier/better way to behave like a proxy?

Thank you very much :)

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2435202


need some help with my project design

2009-12-16 Thread Robert
Hey!

I want to develop a webapplication with the following functionality:

0) overview: http://dl.dropbox.com/u/1266822/overview.jpg

1) The html,css,javascript content is delivered by the server.
2) The page consists of 2 frames. the second one loads the webpages the user 
wants to open.
3) The server receives the DOM of the loaded page.
4) The client receives data in the form of rdf or xml.


Is restlet appropriate for this needs? How would you realize the communication 
between Client (Javascript) and Server (Java) with the help of restlet? 
Would be really nice if you could give me a short overview of what I have to 
take care of.

Thanks in advance,
Robert

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2430835


Extension tunneling and matching route by extension

2009-07-14 Thread Robert Binna
Hi,

I am developing a restlet based application and I am using the router  
restlet to dispatch to the target resources.
My problem is, that after the tunnel service  has removed the  
extension, the rule that matches the url is no longer applicable.

The code that is used is:

router.attach(/js/, new Directory(context, directory));
router.attach(/js/lang.{lang}.js, LanguageResource.class); //causes  
trouble
Route route = router.attach(/js/{relurl}.html,  
HTMLResource.class); // matching on relurl is done via TYPE_URI_ALL,  
causes trouble too

Is there a way to force the routing to respect the original url, and  
not the stripped one?

Kind regards,
   Robert

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2370881


build fail (revision 3932)

2008-11-01 Thread Robert Koberg

Hi,

I just checked out the latest restlet distro from subversion (revision  
3932).


I am getting the following build failure on the tests:

verify-tests:
[mkdir] Created dir: /Users/rkobergmac/Documents/workspace/ 
restlet/build/temp/test

[junit] Running com.noelios.restlet.test.NoeliosTestSuite
[junit] head
[junit]titleStatus page/title
[junit] /head
[junit] body
[junit] h3The server has not found anything matching the  
request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 
here/a.br
[junit] Please continue your visit at our a href=/home page/ 
a.

[junit] /p
[junit] /body
[junit] /html
[junit] HTTP/1.1 404 The server has not found anything matching  
the request URI

[junit] Content-Type: text/html; charset=ISO-8859-1
[junit] Content-Length: 330
[junit] Date: Sat, 01 Nov 2008 16:17:32 GMT
[junit] Accept-Ranges: bytes
[junit] Server: Noelios-Restlet-Engine/1.2.snapshot
[junit]
[junit] html
[junit] head
[junit]titleStatus page/title
[junit] /head
[junit] body
[junit] h3The server has not found anything matching the  
request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 
here/a.br
[junit] Please continue your visit at our a href=/home page/ 
a.

[junit] /p
[junit] /body
[junit] /html
[junit] ])
[junit] Tests run: 15, Failures: 1, Errors: 0, Time elapsed:  
15.312 sec


BUILD FAILED
/Users/rkobergmac/Documents/workspace/restlet/build/build.xml:1599:  
Test com.noelios.restlet.test.NoeliosTestSuite failed




Re: build fail (revision 3932)

2008-11-01 Thread Robert Koberg

Running ant build produces the following fail:


verify-tests:
[junit] Running com.noelios.restlet.test.NoeliosTestSuite
[junit] Invalid memory access of location  rip=01160767
[junit]
[junit] Running com.noelios.restlet.test.NoeliosTestSuite
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

BUILD FAILED
/Users/rkobergmac/Documents/workspace/restlet/build/build.xml:1599:  
Test com.noelios.restlet.test.NoeliosTestSuite failed (crashed)


My previous post was running the ant build default.

best,
-Rob


On Nov 1, 2008, at 12:20 PM, Robert Koberg wrote:


Hi,

I just checked out the latest restlet distro from subversion  
(revision 3932).


I am getting the following build failure on the tests:

verify-tests:
   [mkdir] Created dir: /Users/rkobergmac/Documents/workspace/ 
restlet/build/temp/test

   [junit] Running com.noelios.restlet.test.NoeliosTestSuite
   [junit] head
   [junit]titleStatus page/title
   [junit] /head
   [junit] body
   [junit] h3The server has not found anything matching the  
request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 
here/a.br
   [junit] Please continue your visit at our a href=/home page/ 
a.

   [junit] /p
   [junit] /body
   [junit] /html
   [junit] HTTP/1.1 404 The server has not found anything matching  
the request URI

   [junit] Content-Type: text/html; charset=ISO-8859-1
   [junit] Content-Length: 330
   [junit] Date: Sat, 01 Nov 2008 16:17:32 GMT
   [junit] Accept-Ranges: bytes
   [junit] Server: Noelios-Restlet-Engine/1.2.snapshot
   [junit]
   [junit] html
   [junit] head
   [junit]titleStatus page/title
   [junit] /head
   [junit] body
   [junit] h3The server has not found anything matching the  
request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 
here/a.br
   [junit] Please continue your visit at our a href=/home page/ 
a.

   [junit] /p
   [junit] /body
   [junit] /html
   [junit] ])
   [junit] Tests run: 15, Failures: 1, Errors: 0, Time elapsed:  
15.312 sec


BUILD FAILED
/Users/rkobergmac/Documents/workspace/restlet/build/build.xml:1599:  
Test com.noelios.restlet.test.NoeliosTestSuite failed






Re: Trouble with serving static files when using Tomcat.

2008-03-07 Thread Robert Bruggner
Thierry, Jerome, and Rob - 

After extending  mapping the  custom Component, I can now attach 
static directories. On a side note, I had been using the Restlet 1.0.8 
release but for Thierry's fix, I needed to use the 1.1 release. Many thanks 
for your help guys, I really appreciate it. 

-Rob-








Trouble with serving static files when using Tomcat.

2008-03-06 Thread Robert Bruggner
Hi All,
I'm having a little trouble getting my restlet application to serve static files
 (files and directories) when deploying via Tomcat and was wondering if 
anyone had any suggestions (I'm a bit of a newbie too - please bear with 
me).

I've created an Application class (myApplication) that extends 
org.restlet.Application and have configured it for Tomcat deployment in 
web.xml as described in the ServerServlet API docs. I've also  also 
attached some basic path/resource combinations to a router object that's 
returned by the createRoot() function of my application. So my class 
looks something like:

public class myApplication extends Application {
 public myApplication(){
   super(); 
 }
 public myApplication(Context c){
   super(c);
 }
 public Restlet createRoot(){
Router r = new Router(this.getContext); 
r.attach(/,MyResource.class);
return r;
 }
}

When deploying this servlet via tomcat, I have no problem accessing 
MyResource by simply going to http://localhost:8080/ (I set my 
application to be the root context).

However, I'm having trouble attaching a directory to a path.
I've tried to create and attach a directory to the router in the createRoot()
 function of my class by doing something like:

this.getConnectorService().getClientProtocols().add(Protocol.FILE);
LocalReference l = LocalReference.createFileReference(/path_to/imgdir/);
Directory d = new Directory(this.getContext,l);
router.attach(/images/,d);

However, I can't seem to access the directory or it's contents after tomcat 
deployment (http://localhost:8080/images/image.gif produces 404 errors). 
I haven't had any problems attaching a directory when using Restlet's built 
in http server. For instance, the following allows me to access a directory 
and it's contents correctly...

Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);
LocalReference l = LocalReference.createFileReference(/path/to/images_dir/);
Directory d = new Directory(component.getContext(), l);
component.getDefaultHost().attach(/images/, d);
component.start();
(http://localhost:8182/images/image.gif works)

I'm a little stumped - I don't know if I'm creating/attaching the directory 
incorrectly or maybe not adding the FILE protocol correctly. Any 
suggestions/insight would be greatly appreciated.

Many thanks,
-Rob-