Re: Premature EOF / Broken Pipe

2009-06-19 Thread Timothy Aanerud
No, I haven't tried switching HTTP connectors.  I get the same failures for
both HTTP and HTTPS.
In another experiement, I changed the client message frequency to ~1 second
intervals and at this rate on both
Windows XP and Fedora10/Linux show now problems with the server running on
Fedora.

The various frequencies and failure rates:
1 second == no problems
1.5 seconds == ~25% failure rate
5 seconds == ~25% failure rate
10 seconds == ~3% failure rate
180 seconds == >0.5%, if any failures

I'll switch the HTTP connectors out one at a time and see what happens.
--
Timothy Aanerud


On Fri, Jun 19, 2009 at 2:02 PM, Jerome Louvel wrote:

> Hi Timothy,
>
> This looks like a bug to me. Have you tried with different Restlet HTTP
> connectors (such as Jetty on the server-side and Apache HTTP client)?
>
> If you could send us a simple standalone test case, we could easily debug
> what's going bad.
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
>
>
> -Message d'origine-
> De : Timothy Aanerud [mailto:taane...@aticonsulting.com]
> Envoyé : vendredi 19 juin 2009 18:18
> À : discuss@restlet.tigris.org
> Objet : RE: Premature EOF / Broken Pipe
>
> As a test, I moved the client code to a Windows XP machine.  With a five
> second update rate it fails regularly too, with the same exceptions and
> stack traces.
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23635
> 62
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2363638
>

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

RE: Premature EOF / Broken Pipe

2009-06-19 Thread Jerome Louvel
Hi Timothy,

This looks like a bug to me. Have you tried with different Restlet HTTP
connectors (such as Jetty on the server-side and Apache HTTP client)?
 
If you could send us a simple standalone test case, we could easily debug
what's going bad.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-Message d'origine-
De : Timothy Aanerud [mailto:taane...@aticonsulting.com] 
Envoyé : vendredi 19 juin 2009 18:18
À : discuss@restlet.tigris.org
Objet : RE: Premature EOF / Broken Pipe

As a test, I moved the client code to a Windows XP machine.  With a five
second update rate it fails regularly too, with the same exceptions and
stack traces.

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

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


Re: How do I get the contents of POST variables?

2009-06-19 Thread Schley Andrew Kutz
Jerome,

Wonderful, thank you. I am about to release a rather interesting open  
source project that makes LARGE use of Restlet, and I am glad to get  
your help.

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

On Jun 19, 2009, at 1:56 PM, Jerome Louvel wrote:

> Hi Schley,
>
> As Thierry said, we do want to make sure the developer understands  
> what's
> going on. But, there is a way in Restlet to deal with all three  
> uniformly.
>
> In Restlet 1.1, it was a bit hidden as you need to look at the Route
> instance returned when you call attach*() methods on a Router. In  
> Restlet
> 2.0 you have a new org.restlet.routing.Extractor filter.
>
> Both classes have those methods:
> - extractCookie(String attribute, String cookieName, boolean first)
> - extractEntity(String attribute, String parameter, boolean first)
> - extractQuery(String attribute, String parameter, boolean first)
>
> Once this filter is called, it extracts specified cookies, query and  
> entity
> params into the request attributes which can be processed uniformly  
> down the
> road by your resource classes.
>
> Does it solve your issue better?
>
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
>
>
> -Message d'origine-
> De : Schley Andrew Kutz [mailto:sak...@gmail.com]
> Envoyé : vendredi 19 juin 2009 13:41
> À : discuss@restlet.tigris.org
> Objet : Re: How do I get the contents of POST variables?
>
> I thought that the entity is what I should be looking at, thanks!
>
> I know that they are different, but some frameworks already provide a
> single call to fetch the data, and I have found it useful in the past.
>
> -- 
> -a
>
> "Ideally, a code library must be immediately usable by naive
> developers, easily customized by more sophisticated developers, and
> readily extensible by experts." -- L. Stein
>
> On Jun 19, 2009, at 5:08 AM, Thierry Boileau wrote:
>
>> Hello,
>>
>> if "entity" is the Representation sent via the POST request, you can
>> parse it with a Form as follow:
>> Form form = new Form(entity);
>>
>> If you want to get the cookies values, just call request#getCookies.
>>
>> For sure, there is a real distinction between the query part of an  
>> URI
>> and the content of POSTed entity.
>> The query is part of the identifier of the resource. An entity sent
>> via
>> a POST is a set of data that the resource is asked to take into
>> account
>> in order to act on its current state.
>> It seems preferable keep this distinction.
>>
>> best regards,
>> Thierry Boileau
>>> I can get GET variables via the getQueryAsForm method for a resource
>>> reference, but how do I get POST variables? Also, it would be nice  
>>> to
>>> have a getVariable() method that returned a series comprised of GET,
>>> POST, and COOKIE keys and values.
>>>
>>> Thanks!
>>>
>>>
>>
>> --
>>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23634
> 64
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23634
> 89
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2363631

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


RE: How do I get the contents of POST variables?

2009-06-19 Thread Jerome Louvel
Hi Schley,

As Thierry said, we do want to make sure the developer understands what's
going on. But, there is a way in Restlet to deal with all three uniformly. 

In Restlet 1.1, it was a bit hidden as you need to look at the Route
instance returned when you call attach*() methods on a Router. In Restlet
2.0 you have a new org.restlet.routing.Extractor filter.

Both classes have those methods:
 - extractCookie(String attribute, String cookieName, boolean first)
 - extractEntity(String attribute, String parameter, boolean first)
 - extractQuery(String attribute, String parameter, boolean first)

Once this filter is called, it extracts specified cookies, query and entity
params into the request attributes which can be processed uniformly down the
road by your resource classes.

Does it solve your issue better?

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-Message d'origine-
De : Schley Andrew Kutz [mailto:sak...@gmail.com] 
Envoyé : vendredi 19 juin 2009 13:41
À : discuss@restlet.tigris.org
Objet : Re: How do I get the contents of POST variables?

I thought that the entity is what I should be looking at, thanks!

I know that they are different, but some frameworks already provide a  
single call to fetch the data, and I have found it useful in the past.

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

On Jun 19, 2009, at 5:08 AM, Thierry Boileau wrote:

> Hello,
>
> if "entity" is the Representation sent via the POST request, you can
> parse it with a Form as follow:
> Form form = new Form(entity);
>
> If you want to get the cookies values, just call request#getCookies.
>
> For sure, there is a real distinction between the query part of an URI
> and the content of POSTed entity.
> The query is part of the identifier of the resource. An entity sent  
> via
> a POST is a set of data that the resource is asked to take into  
> account
> in order to act on its current state.
> It seems preferable keep this distinction.
>
> best regards,
> Thierry Boileau
>> I can get GET variables via the getQueryAsForm method for a resource
>> reference, but how do I get POST variables? Also, it would be nice to
>> have a getVariable() method that returned a series comprised of GET,
>> POST, and COOKIE keys and values.
>>
>> Thanks!
>>
>>
>
> --
>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23634
64

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

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


RE: Errors with 1.1.5 and IE8 - is this Restlet or IE8?

2009-06-19 Thread Jerome Louvel
Hi Serge,

Thanks for the report. Let's indeed keep an eye on this. Our internal HTTP
server that you are using here doesn't support persistent connection yet,
which may explain why IE8 doesn't like playing with it (just a thought).

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com




-Message d'origine-
De : serge [mailto:serge.i...@gmail.com] 
Envoyé : vendredi 19 juin 2009 02:30
À : discuss@restlet.tigris.org
Objet : Errors with 1.1.5 and IE8 - is this Restlet or IE8?

While using 1.1.5 with MS IE8 (not problems at all with FF) I noticed on
server console occasional errors (see below). These errors do no occur
every time, and if occur, they come as a series of warnings and errors
when the browser asks for a page. Also, same page can be accessed
without these errors. BTW, these errors do affect serving - pages are
served with or without them.

I also notices that if I touch that "compatibility" button in IE8 errors
seem to go away. It also seems that it does not matter in what mode you
are - important is to touch this button for the errors to go away.

If errors happen, they will typically start with this:

Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request

like in

Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request
java.io.IOException: Unable to parse the request method. End of stream
reached too early.
at
com.noelios.restlet.http.HttpServerCall.readRequestHead(HttpServerCall.java:
347)
at
com.noelios.restlet.http.StreamServerCall.(StreamServerCall.java:88)
at
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServ
erHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.HttpServerCall parseHost
INFO: Couldn't find the mandatory "Host" HTTP header.


Or, as I mentioned above, it can result in a longer output


Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request
java.io.IOException: An existing connection was forcibly closed by the
remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at sun.nio.ch.SocketAdaptor$SocketInputStream.read(Unknown Source)
at sun.nio.ch.ChannelInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at
com.noelios.restlet.http.HttpServerCall.readRequestHead(HttpServerCall.java:
340)
at
com.noelios.restlet.http.StreamServerCall.(StreamServerCall.java:88)
at
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServ
erHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.HttpServerCall parseHost
INFO: Couldn't find the mandatory "Host" HTTP header.
Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.HttpServerConverter commit
SEVERE: An exception occured writing the response entity
java.io.IOException: An existing connection was forcibly closed by the
remote host
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at java.nio.channels.Channels.write(Unknown Source)
at java.nio.channels.Channels.access$000(Unknown Source)
at java.nio.channels.Channels$1.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at
com.noelios.restlet.http.HttpServerCall.writeResponseHead(HttpServerCall.jav
a:553)
at
com.noelios.restlet.http.StreamServerCall.writeResponseHead(StreamServerCall
.java:201)
at
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:415
)
at
c

RE: Relative URI in GWT Restlet

2009-06-19 Thread Jerome Louvel
Thanks Bruno, I've applied your patch in both 1.1 branch and SVN trunk.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

-Message d'origine-
De : news [mailto:n...@ger.gmane.org] De la part de Bruno Harbulot
Envoyé : jeudi 18 juin 2009 19:00
À : discuss@restlet.tigris.org
Objet : Re: Relative URI in GWT Restlet

Hello,

I'm having the very same problem (regarding relative URIs).

I think I've traced the problem: it's a client-side issue, and an 
exception is currently thrown if the URI doesn't start with "http". I'd 
like to suggest the following patch to allow for relative URIs too:


diff --git 
a/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
 
b/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
index 7fd564d..8876e79 100644
--- 
a/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
+++ 
b/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
@@ -86,7 +86,9 @@ public class GwtHttpClientCall extends HttpClientCall {
  String requestUri, boolean hasEntity) {
  super(helper, method, requestUri);

-if (requestUri.startsWith("http")) {
+Reference requestRef = new Reference(requestUri);
+if (requestRef.isRelative()
+|| requestRef.getScheme().startsWith("http")) {
  this.requestBuilder = new RequestBuilder(method, requestUri) {
  };
 
this.requestBuilder.setTimeoutMillis(getHelper().getTimeout());


Best wishes,

Bruno.


Jerome Louvel wrote:
> Hi Wish,
> 
> What is your ServletContainer? There is a known bug with WebLogic regarding
> port 80:
> 
> "Locating REST resources on Port 80, Receive 404"
> http://restlet.tigris.org/issues/show_bug.cgi?id=710
> 
> We have very recently checked in a workaround in SVN trunk for this. Could
> you try again with a recent Restlet 2.0 snapshot?
> 
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
> 
> 
> -Message d'origine-
> De : wgandhi [mailto:wgan...@hotmail.com] 
> Envoyé : samedi 6 juin 2009 08:31
> À : discuss@restlet.tigris.org
> Objet : Relative URI in GWT Restlet
> 
> Hi !
> I have code that uses a GWT restlet class in the client. I generate the
> request like this:
> Request request = new
> Request(Method.GET,"http://localhost:8080/entApp-war/resources/Items/stock/";
> +symbol+"/");
> An existing web service is running on the servlet container at :8080.
> 
> When I deploy the web application, I want to use apache to serve the static
> content which will be on port :80. I have wired up my apache server to
> forward to the servlet container when I access directory /entApp-war. On the
> development platform, I use :8080 for everything and things work fine. When
> I deploy, I dont want to change my code to include the address of the
> correct server.
> Everything would work for me, if I get to specify a relative URL. example:
> Request request = new
> Request(Method.GET,"/entApp-war/resources/Items/stock/"+symbol+"/");
> 
> I tried that and it did not work. I get an "Unable to create request"-type
> message from the Restlet class. Is there a workaround this issue?
> 
> -Wish
>

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

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


RE: 2.0m3 and content negotiation

2009-06-19 Thread Jerome Louvel
Hi Bruno,

I was surprised to get your email so I've tried a similar test with SVN
trunk (no change in this area since 5104) and it works just fine. I never
get 406 because the conneg algorithm always try to fall-back on one of the
variants if it exists.

The test file uses is attached. 

Regarding annotation values, we can't unfortunately use constant class
instances, only primitive types and enumerations... 

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-Message d'origine-
De : news [mailto:n...@ger.gmane.org] De la part de Bruno Harbulot
Envoyé : jeudi 18 juin 2009 14:37
À : discuss@restlet.tigris.org
Objet : Re: 2.0m3 and content negotiation

Hi Jerome,

I've just upgraded to revision 5104. (I've have looked in details at the 
changes in the code.)

I'm still not clear what should work with annotations. The simple 
test-case I'm using tries to do content-type negotiation between 
text/plain and application/xml.


public class TestResource extends ServerResource {
 @Override
 public void doInit() throws ResourceException {
 setNegotiated(true);
 }

 @Get("xml")
 public Representation toXml() {
 return new OutputRepresentation(MediaType.APPLICATION_XML) {
 /* ... */
 }
 }
}



Making a GET request with "Accept: text/plain" produces a "406 Not 
Acceptable" (which makes sense).
However, I get the same error with "Accept: text/xml, application/xml".
I do get a successful response (200 with the XML representation 
intended) with "Accept: */*" (however, there's nothing being negotiated 
since there's only @Get("xml") here).



I believe the problem comes from the fact that 
ServerResource.getAvailableVariants(...) assumes that 'Representation' 
implies the media type is going to be application/octet-stream.


This example works as intended when declaring the return type to be 
DomRepresentation instead of Representation:

public class TestResource extends ServerResource {
 @Override
 public void doInit() throws ResourceException {
 setNegotiated(true);
 }

 @Get("xml")
 public DomRepresentation toXml() {
 return /* some DomRepresentation */
 }
}


It seems a bit restrictive not to allow to use Representation and to 
expect a specific subclass (as there are more potential media types than 
subclasses of Representation).



Regarding the annotation parameters and media types, perhaps it would be 
useful to allow for both the extension and the actual media types, for 
example @Get(extension = "txt") and @Get(mediatype = MediaType.TEXT_PLAIN).


Best wishes,

Bruno.


Jerome Louvel wrote:
> Hi Bruno,
> 
> Thanks for looking into this part of the code base. 
> 
> As said in other emails, many enhancements and refactorings were done
> recently on ServerResource, ConverterService and content negotiation. 
> 
> Previously, annotation values weren't taken into account, leading to
strange
> results as you observed. They are now taken into account to result
> representation, only media types for now based on extensions declared in
> MetadataService.
> 
> The ConverterService has been enhanced to allow better selection of
> ConverterHelpers via a scoring logic. Previously, a converter such as
> XStream could convert anything to representation and could prevent other
> (more specific) converters from being selected. I think that the target
> variant is now better taken into account by existing converters.
> 
> Could you have another look at the code and let me know what you think of
> the changed recently made?  
> 
> Best regards,
> Jerome Louvel
> --
> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
> 
>

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

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

TestServerResource.java
Description: Binary data


RE: Premature EOF / Broken Pipe

2009-06-19 Thread Timothy Aanerud
As a test, I moved the client code to a Windows XP machine.  With a five second 
update rate it fails regularly too, with the same exceptions and stack traces.

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


Premature EOF / Broken Pipe

2009-06-19 Thread Timothy Aanerud
Hi,
I'm having a communications problem between a client/server application both 
using Restlet 1.1.1 (and since upgraded to 1.1.5).  The client and server are 
both running on Fedora 10, OpenJDK-6 build 14.

The client posts a status resource message to the server to exchange status 
information at regular intervals.   The message send works most of the time.  
But, some times I'll get an exception on both the server and client side.  

The client side throws a Premature EOF IOException while trying to parse the 
response entity as Sax; while the server side sees an IOException with the 
message Broken Pipe.  (stack traces are attached using Restlet 1.1.1)

If the client sends the status resource message once every three minutes, I'll 
hardly ever get this exception pair.  If I send it every 10 seconds, the error 
rate is ~ 3%.  At 5 second intervals, the error rate is in the 25-50% range.

I was first seeing this error going over a wide area connection, but the error 
will occur on my local area network too.

I upgraded to Restlet-1.1.5 from 1.1.1 but that didn't help. :-(

Could HTTP caching be biting me here? The POST data doesn't change much from 
message to message.

I'm running out of ideas as to what to look at next for the cause of this 
problem.INFO: Starting the HTTP client
Jun 18, 2009 7:54:02 AM com.noelios.restlet.http.HttpClientCall 
getResponseEntity
INFO: The length of the message body is unknown. The entity must be handled 
carefully and consumed entirely in order to surely release the connection.
ERROR:  'Premature EOF'
javax.xml.transform.TransformerException: java.io.IOException: Premature EOF
at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:724)
at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:317)
at 
org.restlet.resource.SaxRepresentation.parse(SaxRepresentation.java:189)
at 
com.atilabs.rtikiosk.server.StatusResponseHandler.(StatusResponseHandler.java:24)
at 
com.atilabs.rtikiosk.server.StatusTransaction.parseResponse(StatusTransaction.java:48)
at com.atilabs.rtikiosk.server.Server$1.run(Server.java:122)
Caused by: java.io.IOException: Premature EOF
at 
sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:556)
at 
sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:600)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:687)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2411)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2915)
at 
com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:302)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1719)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipSpaces(XMLEntityScanner.java:1469)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(XMLDocumentScannerImpl.java:1373)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:624)
at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:486)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740)
at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)
at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:712)
... 5 more
-
java.io.IOException: Premature EOF
at 
sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:556)
at 
sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:600)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:687)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2411)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2915)
at 
com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:302)
at 
com.sun

Re: How do I get the contents of POST variables?

2009-06-19 Thread Schley Andrew Kutz
I thought that the entity is what I should be looking at, thanks!

I know that they are different, but some frameworks already provide a  
single call to fetch the data, and I have found it useful in the past.

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

On Jun 19, 2009, at 5:08 AM, Thierry Boileau wrote:

> Hello,
>
> if "entity" is the Representation sent via the POST request, you can
> parse it with a Form as follow:
> Form form = new Form(entity);
>
> If you want to get the cookies values, just call request#getCookies.
>
> For sure, there is a real distinction between the query part of an URI
> and the content of POSTed entity.
> The query is part of the identifier of the resource. An entity sent  
> via
> a POST is a set of data that the resource is asked to take into  
> account
> in order to act on its current state.
> It seems preferable keep this distinction.
>
> best regards,
> Thierry Boileau
>> I can get GET variables via the getQueryAsForm method for a resource
>> reference, but how do I get POST variables? Also, it would be nice to
>> have a getVariable() method that returned a series comprised of GET,
>> POST, and COOKIE keys and values.
>>
>> Thanks!
>>
>>
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2363464

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


Re: How do I get the contents of POST variables?

2009-06-19 Thread Thierry Boileau
Hello,

if "entity" is the Representation sent via the POST request, you can 
parse it with a Form as follow:
Form form = new Form(entity);

If you want to get the cookies values, just call request#getCookies.

For sure, there is a real distinction between the query part of an URI 
and the content of POSTed entity.
The query is part of the identifier of the resource. An entity sent via 
a POST is a set of data that the resource is asked to take into account 
in order to act on its current state.
It seems preferable keep this distinction.

best regards,
Thierry Boileau
> I can get GET variables via the getQueryAsForm method for a resource  
> reference, but how do I get POST variables? Also, it would be nice to  
> have a getVariable() method that returned a series comprised of GET,  
> POST, and COOKIE keys and values.
>
> Thanks!
>
>

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


How do I get the contents of POST variables?

2009-06-19 Thread Schley Andrew Kutz
I can get GET variables via the getQueryAsForm method for a resource  
reference, but how do I get POST variables? Also, it would be nice to  
have a getVariable() method that returned a series comprised of GET,  
POST, and COOKIE keys and values.

Thanks!

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

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


Errors with 1.1.5 and IE8 - is this Restlet or IE8?

2009-06-19 Thread serge
While using 1.1.5 with MS IE8 (not problems at all with FF) I noticed on
server console occasional errors (see below). These errors do no occur
every time, and if occur, they come as a series of warnings and errors
when the browser asks for a page. Also, same page can be accessed
without these errors. BTW, these errors do affect serving - pages are
served with or without them.

I also notices that if I touch that "compatibility" button in IE8 errors
seem to go away. It also seems that it does not matter in what mode you
are - important is to touch this button for the errors to go away.

If errors happen, they will typically start with this:

Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request

like in

Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request
java.io.IOException: Unable to parse the request method. End of stream
reached too early.
at
com.noelios.restlet.http.HttpServerCall.readRequestHead(HttpServerCall.java:347)
at
com.noelios.restlet.http.StreamServerCall.(StreamServerCall.java:88)
at
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jun 18, 2009 12:54:10 PM com.noelios.restlet.http.HttpServerCall parseHost
INFO: Couldn't find the mandatory "Host" HTTP header.


Or, as I mentioned above, it can result in a longer output


Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.StreamServerCall 
WARNING: Unable to parse the HTTP request
java.io.IOException: An existing connection was forcibly closed by the
remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at sun.nio.ch.SocketAdaptor$SocketInputStream.read(Unknown Source)
at sun.nio.ch.ChannelInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at
com.noelios.restlet.http.HttpServerCall.readRequestHead(HttpServerCall.java:340)
at
com.noelios.restlet.http.StreamServerCall.(StreamServerCall.java:88)
at
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.HttpServerCall parseHost
INFO: Couldn't find the mandatory "Host" HTTP header.
Jun 18, 2009 12:53:10 PM com.noelios.restlet.http.HttpServerConverter commit
SEVERE: An exception occured writing the response entity
java.io.IOException: An existing connection was forcibly closed by the
remote host
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at java.nio.channels.Channels.write(Unknown Source)
at java.nio.channels.Channels.access$000(Unknown Source)
at java.nio.channels.Channels$1.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at
com.noelios.restlet.http.HttpServerCall.writeResponseHead(HttpServerCall.java:553)
at
com.noelios.restlet.http.StreamServerCall.writeResponseHead(StreamServerCall.java:201)
at
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:415)
at
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:391)
at
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
at
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Wor