RE: Post method not work when deployed to GAE

2011-01-02 Thread webpost
Hi Joe,

I don't have a solution for you but I have been having the same problem.  In my 
search through the forums, I noticed that several others have reported similar 
problems in recent weeks:


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

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

http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html
 - comment #6


I have also tried several different Restlet JARs on both the Android client and 
GAE server to no avail.

I wonder if anyone would be kind enough to post a turn-key Eclipse Android 
project folder along with an Eclipse GAE project folder so that us Restlet 
noobs would only need to change an 'x.appspot.com' value to get the sample 
working on our own machines.  I would be willing to help maintain a project on 
code.google.com for it.

It would be good to work with the others having the same problem.

Cheers,

Orville

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


RE: Is there a way to setup hierarchy of routers?

2010-12-29 Thread webpost
Thanks Jerome. This worked with the 2.0.3 version that I was using.

Regards,
RK.

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


Issues in migrating to 2.1 M2

2010-12-29 Thread webpost
Hi,

I am trying to migrate my existing 2.0.3 based Restlet framework application to 
2.1 M2. I replaced org.restlet.jar and org.restlet.ext.json.jar in my 
application and fixed a couple of router.attach related issues in pointed out 
in terms of casting of parameters.

After that I tried to run my server and client. My machine gets into an 
unresponsive state. I see that server thread is getting into some kind of 
waiting state and displaying 'detected a recoverable error and retrying after 
2000 ms.'. Nothing really happens and because of unresponsiveness, i had to 
kill the server. This is a working server and client test with 2.0.3 version I 
was using earlier. I am moving to this version mainly because of the internal 
HTTP connector performance improvements. With 2.0.3, I tried to use my own 
Client as setNext to ClientResource, but that does not seem to consistently 
work. FOr some tests it works fine without getting into this waiting state, but 
for some tests it gets into waiting state and recoverable error detected, etc.

Any help would be greatly appreciated as I am stuck right now and need to 
progress urgently.

regards,
RK.

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


RE: ClientResource Performance

2010-12-29 Thread webpost
Hi Jerome,

I have tried as you suggested, but I am having different issues in different 
tests.

I have initialized a static variable in my application with Client object one 
time and using it for all my ClientResource calls. Using these changes, if I 
now run my test that does a GET of a partcular resource 100 times, this worked 
fine. I did not see HTTP Connector start and stop messages I was seeing earlier.

Then I tried a test on another resource that does  PUT to create an object. In 
this test, it went fine for about 9 calls and then got blocked. It appeared as 
if it ran out of connections and blocked. It times out evenutally and gives me 
some errors.

Then I tried another test that does a PUT and DELETE on a resource in a loop. 
In this situation I see that first PUT and DELETE succeeded, but the next PUT 
gets blocked and I eventually get a Null Pointer Exception in the server. I am 
exchanging java object representations between client and server.

Can you shed any light on what am I doing wrong here?

Below are my client and server messages:

Dec 29, 2010 2:08:58 PM org.restlet.engine.http.connector.HttpClientHelper start
INFO: Starting the default HTTP client
 Created Organization id: 2
Dec 29, 2010 2:10:02 PM org.restlet.resource.ClientResource handle
INFO: A recoverable error was detected (1002), attempting again in 2000 ms.
Internal Server Error (500) - Internal Server Error
at org.restlet.resource.ClientResource.handle(ClientResource.java:854)
at org.restlet.resource.ClientResource.put(ClientResource.java:1264)
at 
com.sios.caspian.cmgi.client.Tenant.createOrganization(Tenant.java:62)
at 
com.sios.caspian.cmgi.client.PerformanceTest.testCreateOrganizationPerformance(PerformanceTest.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at 
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Server side:

Dec 29, 2010 2:09:02 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-12-2914:09:02127.0.0.1   sa  -   80  
GET /casp/cmgi/security/user-password/Admin -   200 -   0   
2640http://localhostRestlet-Framework/2.0.4 -
Dec 29, 2010 2:09:02 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-12-2914:09:02127.0.0.1   Admin   -   80  
GET /casp/cmgi/security/user-session-   200 -   0   
3063http://localhostRestlet-Framework/2.0.4 -
2010-12-29 14:09:02.390 INFO net.spy.memcached.MemcachedConnection:  Added {QA 
sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, 
topWop=null, toWrite=0, interested=0} to connect queue
2010-12-29 14:09:02.421 INFO net.spy.memcached.MemcachedConnection:  Connection 
state changed for sun.nio.ch.selectionkeyi...@11b86c7
Dec 29, 2010 2:09:02 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-12-2914:09:02127.0.0.1   
994c5d66-d47c-47b1-9b5d-2f5509e653c7-   80  PUT 
/casp/cmgi/tenant/organization  -   200 -   -   125 
http://localhostRestlet-Framework/2.0.4 -
2010-12-29 14:09:02.703 INFO net.spy.memcached.MemcachedConnection:  Added {QA 
sa=localhost/127.0.0.1:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, 
topWop=null, toWrite=0, interested=0} to connect queue
2010-12-29 14:09:02.750 INFO net.spy.memcached.MemcachedConnection:  Connection 
state changed for sun.nio.ch.selectionkeyi...@11a0d35
Dec 29, 2010 2:09:02 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-12-2914:09:02127.0.0.1   
994c5d66-d47c-47b1-9b5d-2f5509e653c7 

DomRepresentation.getNode(someXpath) returns null

2010-12-29 Thread webpost
Hi all, 

this is the first time I post on the mailing list so please apologies if some 
informations are missing: just ask for them and I'll give you them with 
pleasure :)

I wrote this simple sample of code that should work fine:

import org.restlet.ext.xml.DomRepresentation;
DomRepresentation domRep = new DomRepresentation(MediaType.APPLICATION_XML, 
doc.getDom());
refNode = domRep.getNode(refnode);

Here, doc.getDom() is a valid XML Document (org.w3c.dom.Document) : I print the 
content of the document as a String (in the console) and the content is ok.
I also use the org.restlet.data.MediaType.

I try to search for the following xpath : 
/section/section/section/para/text() but it fails : the method getNode() 
returns null. 
I checked the content of the XML and the path exists.

I tried with simpler xpath, like /section but it returns null too. 
When I print the result of getNode(/*), it shows [section: null].
When I print the result of getNode(/), it shows [#document: null].

Does any one know what is the reason of this problem ? or what could I do to 
solve it ? 
Do you need more informations ?

Thanks in advance for helping.

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


Using ClientResource inside ChallengeAuthenticator

2010-12-28 Thread webpost
Hi,

We are using ChallengeAuthenticator infront of a router in our application. We 
have set a Verifier into this ChallengeAuthenticator which implements a 
getLocalSecret method. Inside this method we are trying to do some checks based 
on the given identifier and get its secret. In this process, we are using 
ClientResource call to a resource hosted by security module of the same 
application. This is also a secure resource and hence we are using an 
administrator credential to make this call. After we make this call, it seems 
to hit the server, but server fails saying 404 - Resource not found. It is not 
clear why we are seeing this behavior. Is this happening because in the same 
server thread we are calling back into the server? Is this a correct approach 
we are following for implementing this authenticator? This authenticator is 
inside the application, but in the client part of a Security module, which uses 
caching to authenticate users where possible and calls into security server 
module when needed.

Any pointers would be appreciated.

Regards,
RK.

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


ClientResource Performance

2010-12-27 Thread webpost
Are there any benchmarks in terms of performance when communicating between 
client and server running on different machines in Restlet Framework?

Every ClientResource call seems to open a HttpConnector and then close it based 
on my release() call on the ClientResource. I find the overall performance of 
communication between my client and server seems to be somewhat slow. Not sure 
if I am missing something in terms of optimal way of using Restlet framework or 
I have someother issue outside HTTP connecting slowing things down. I am 
exchanging ObjectRepresentations between my client and server. My server does 
database access through hibernate.

Can someone share any tidbits interms of performance of Restlet framework?

Regards,
RK.

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


Free book chapter review request

2010-12-27 Thread webpost
Hi all,

I'm writing a free mini-book on GWTGAE, at 
http://code.google.com/p/gwt-gae-book/

I've just completed a draft version of working with REST services, using 
restlet. It's at
http://code.google.com/p/gwt-gae-book/wiki/ManagingLocations

Would you please have a look and let me know your feedback, before including 
the final version in the book?
Please cc marius.andreianaATgmail.com to your replies.

Code patches for TODOs in code are welcome ;) (e.g. on using Guard or how to 
return 401 status)

Thanks both for your review and restlet!

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


Is there a way to setup hierarchy of routers?

2010-12-26 Thread webpost
Hi,

We have been trying to use Restlet framework and having difficulty in 
implementing a hierarchy of routers.

We want to have our server running listening with a route to our main 
application gateway. For example anything that matches /myapp/mygateway/ is 
received by my router. This router would have had additional routes routing the 
incoming requests to corresponding components like /myapp/mygateway/xyz/ to 
XyzRouter, /myapp/mygateway/abc/ to AbcRouter. XyzRouter and AbcRouter then 
have complete URLs and the Resources that handles these URLs.

We tried to set this up with a hierarchy of routers, but our server is not able 
to resolve the incoming requests unless the routes are added to the first 
router in the server.

Any pointers on how to make this work? Is this possible or it cannot be done 
this way with Restlet framework?

-RK.

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


Doubt in assigning a text value to a java variable

2010-12-23 Thread webpost
Hi,
   Am working in a restlet 2.1. I created a html program, in that am having a 
textbox. I can able to access the Restlet 8182 port via html program using get 
method. How i should want to assign the value of the textbox created in html to 
a java variable. Can anyone please help me?

Thanks all,
Kurshith.

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


RE: Re: how to reuse ServerResource to store multiple resource and retrieve it?

2010-12-21 Thread webpost
I see. Let me confirm the concept.

if I need more than two levels? say contacts/{category}/{id}

Would it be correct conceptually:  

router.attach(/contact/{category}/{id}, ContactServerResource.class);

and in ContactServerResource, 

String categoryName= (String)getRequestAt​tributes().get(category)​;

So I create a nested if else within ContactServerResource to simulate the 
multiple levels? Is this the best practice or the way you guys do it?

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


how to reuse ServerResource to store multiple resource and retrieve it?

2010-12-20 Thread webpost
How do i reuse the ServerResource to store many resource?

for instance, i have already do: 

router.attach(/contact/123, ContactServerResource.class);


How do i type in a different url like /shops/1234 to get to the 
ContactServerResource's other resource. it seems that one URL is attached to 
one class only. 

is there any example around? how do I do it? 

Thank you !

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


Question about redirect on example/book/rest/ch7

2010-12-14 Thread webpost
Hi I am trying out the Bookmark example listed for chapter 7 of the restful web 
service book.

Everything works except when I try to get a list of bookmarks for a particular 
user, it always says not found. If I comment out the handle function in the 
BookmarksResource, then the request to users/mememe/bookmarks can return all 
bookmarks for that user, but the request to users/mememme/bookmarks/ returns 
not found error.

Anybody can help? Thanks. /Gary

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


java.io.OutputStream in Restlet? - Connection to JENA

2010-12-14 Thread webpost
Dear Developer;

How are you?
I am using RESTLET for implementing Linked Open data.
My problem is that I can not connect Jena output into Restlet representation. 
Because Jena only writes its output to java.io.OutputStream directly. So, I 
can not create any representation associated with RESTLET. 

I can not find any java.io.OutputStream in RESTLET. In addition, is there any 
way to create a representation (like String or XML) with the 
java.io.OutputStream connected to JENA.

Do you have any idea?

Thanks for your any comments in advance. : )

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


RE: BufferOverflowException v2.1

2010-12-09 Thread webpost
Hi,

I think this is the same issue as discussed here:
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2682395

It's been fixed in the latest 2.1 snapshot.

 Sure.
 
 Not sure how you normally do this, but here is a JUnit test class which 
 exercises a slightly modified MailServerApplication example from the samples. 
 The test class has 2 tests :-
 
 - GETwithBelow8KResponse (this works)
 - GETwithAbove8KResponse (this fails with the buffer overflow exception)
 
 I set the org.restlet.engine.io.bufferSize property in the test class (to 
 100K) and show in the ServerResource class doInit() method that it *does* 
 retain that value (the same behaviour if I set in as a VM arg).
 
 Hope this helps
 
 Regards
 
 Fraser

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


RE: gae edition deploy error

2010-12-08 Thread webpost
thanks for the reply. sorry i posted at the google app engine forum and forgot 
to do it here. 

yes, i compiled it again but i get this. 


compiling module org.restlet.example.gae.serialization.Serialization 
   Validating newly compiled units 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/logging/impl/ 
DevModeLoggingFixes.java' 
 [ERROR] Line 58: The method getName() is undefined for the 
type Logger 
 [ERROR] Line 59: The method getName() is undefined for the 
type Logger 
 [ERROR] Line 76: The method setUseParentHandlers(boolean) is 
undefined for the type Logger 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/logging/impl/ 
LoggerImplRegular.java' 
 [ERROR] Line 73: The method getLevel() is undefined for the 
type Logger 
 [ERROR] Line 109: The method intValue() is undefined for the 
type Level 
 [ERROR] Line 109: The method intValue() is undefined for the 
type Level 
 [ERROR] Line 131: The method log(Level, String) in the type 
Logger is not applicable for the arguments (LogRecord) 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/user/client/rpc/core/ 
java/util/logging/Level_CustomFieldSerializer.java' 
 [ERROR] Line 38: The method parse(String) is undefined for 
the type Level 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/user/client/rpc/core/ 
java/util/logging/LogRecord_CustomFieldSerializer.java' 
 [ERROR] Line 50: The method parse(String) is undefined for 
the type Level 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/emul/java/util/logging/ 
Handler.java' 
 [ERROR] Line 43: The method intValue() is undefined for the 
type Level 
 [ERROR] Line 43: The method intValue() is undefined for the 
type Level 
  [ERROR] Errors in 'jar:file:/Users/ytbryan/Documents/workspace/ 
google/gwt-2.1.0/gwt-user.jar!/com/google/gwt/emul/java/util/logging/ 
LogManager.java' 
 [ERROR] Line 34: The method setLevel(Level) is undefined for 
the type LogManager.RootLogger 
 [ERROR] Line 57: The method getName() is undefined for the 
type Logger 
 [ERROR] Line 77: The method getName() is undefined for the 
type Logger 
 [ERROR] Line 80: The method getName() is undefined for the 
type Logger 
 [ERROR] Line 81: The method setParent(Logger) is undefined 
for the type Logger 
  [ERROR] Errors in 'file:/Users/ytbryan/Documents/workspace/ 
evogaws/src/org/restlet/example/common/ContactResource.java' 
 [ERROR] Line 3: The import org.restlet.resource cannot be 
resolved 
 [ERROR] Line 4: The import org.restlet.resource cannot be 
resolved 
 [ERROR] Line 5: The import org.restlet.resource cannot be 
resolved 
 [ERROR] Line 12: Get cannot be resolved to a type 
 [ERROR] Line 15: Put cannot be resolved to a type 
 [ERROR] Line 18: Delete cannot be resolved to a type 
   [ERROR] Errors in 'file:/Users/ytbryan/Documents/workspace/evogaws/ 
src/org/restlet/example/gae/serialization/client/Serialization.java' 
  [ERROR]  Internal compiler error 
java.lang.NoSuchMethodError: 
com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder.setLogOutputSt 
ream(Ljava/ 
io/OutputStream;)V 
at 
org.restlet.rebind.ClientProxyGenerator.generateSerializers(ClientProxyGene 
rator.java: 
563) 
at 
org.restlet.rebind.ClientProxyGenerator.generateProxy(ClientProxyGenerator. 
java: 
429) 
at 
org.restlet.rebind.ClientProxyGenerator.generate(ClientProxyGenerator.java: 
208) 
at 
com.google.gwt.dev.javac.StandardGeneratorContext.runGenerator(StandardGene 
ratorContext.java: 
427) 
at 
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java: 
39) 
at com.google.gwt.dev.shell.StandardRebindOracle 
$Rebinder.tryRebind(StandardRebindOracle.java:115) 
at com.google.gwt.dev.shell.StandardRebindOracle 
$Rebinder.rebind(StandardRebindOracle.java:58) 
at 
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.j 
ava: 
161) 
at 
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.j 
ava: 
150) 
at com.google.gwt.dev.Precompile 
$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(Precompile.ja va: 
345) 
at 
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRe 
binds(WebModeCompilerFrontEnd.java: 
106) 
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox 
$CompilerImpl.process(AbstractCompiler.java:254) 
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java: 
444) 
at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox 

RE: Serialization example: NoSuchMethodError on Router.attach

2010-12-08 Thread webpost
Guido,

thanks for the advice. However ...

Even when I set the property as a VM argument using :-

-Dorg.restlet.engine.io.bufferSize=102400

BEFORE the Restlet Application is launched, BEFORE it's constructor is called, 
and BEFORE the Restlet engine is started, for my ServerResource, the buffer 
size appears to be unaltered.

I used a separate test class to call the initialse method of my Restlet 
Application (see code below). This test class is launched with the -D argument 
shown above.

From the code below, the initialise method outputs this (note: the property is 
set but IoUtils STILL reports 8192 for the buffer size) :-

org.restlet.engine.io.bufferSize = 102400
IoUtils.getBufferSize() = 8192

... and the java.nio.BufferOverflowException still occurs :-( How frustrating 
is this !

Any ideas ?

Kind Regards

Fraser.

Example code :-

public class MbHttpMockAFComBufApplication  extends Application  {

  public MbHttpMockAFComBufApplication() {

  logger.debug(Hi from MbHttpMockAFComBufApplication constructor);

  setAuthor(Fraser Goffin);
}

  public static void initialise(int Port) throws Exception {

  logger.debug(Hi from initialise()); 
  System.out.println(org.restlet.engine.io.bufferSize =  + 
System.getProperty(org.restlet.engine.io.bufferSize));
  System.out.println(IoUtils.getBufferSize() =  + IoUtils.getBufferSize());
...
 // create Server etc ...
}

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


BufferOverflowException v2.1

2010-12-07 Thread webpost
(separated from previous topic)

Guido thanks for the advice. However ...

I have tried again to resolve this problem by using the latest 2.1 snapshot but 
still to no avail. I set the property as early as I can(actually as a launch 
argument using -D{property-name}, that is, long before the Restlet Application 
class has been initialized, but, although the property resorts the value set, 
the BufferOverfloeException remains ??


Previous message ;-

05-Dec-2010 23:57:06 org.restlet.engine.connector.OutboundWay onSelected 
WARNING: Error while writing an HTTP message java.nio.BufferOverflowException 
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:180) at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:173) at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:146) at 
org.restlet.engine.io.ReadableChunkingChannel.read(ReadableChunkingChannel.java:120)
 at 
org.restlet.engine.connector.OutboundWay.fillByteBuffer(OutboundWay.java:207) 
at org.restlet.engine.connector.OutboundWay.onSelected(OutboundWay.java:359) at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
 at org.restlet.engine.connector.Connection.onSelected(Connection.java:519) at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
 at 
org.restlet.engine.connector.ConnectionController.onSelected(ConnectionController.java:183)
 at 
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerConnectionController.java:107)
 at 
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:236)
 at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:142)
 at org.restlet.engine.connector.Controller.run(Controller.java:274) at 
org.restlet.engine.connector.ServerConnectionController.run(ServerConnectionController.java:176)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284) at 
java.util.concurrent.FutureTask.run(FutureTask.java:138) at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
 at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690) 
at java.lang.Thread.run(Thread.java:810) 05-Dec-2010 23:57:06 
org.restlet.engine.connector.OutboundWay onSelected INFO: Error while writing 
an HTTP message java.nio.BufferOverflowException at 
java.nio.HeapByteBuffer.put(HeapByteBuffer.java:180) at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:173) at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:146) at 
org.restlet.engine.io.ReadableChunkingChannel.read(ReadableChunkingChannel.java:120)
 at 
org.restlet.engine.connector.OutboundWay.fillByteBuffer(OutboundWay.java:207) 
at org.restlet.engine.connector.OutboundWay.onSelected(OutboundWay.java:359) at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
 at org.restlet.engine.connector.Connection.onSelected(Connection.java:519) at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
 at 
org.restlet.engine.connector.ConnectionController.onSelected(ConnectionController.java:183)
 at 
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerConnectionController.java:107)
 at 
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:236)
 at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:142)
 at org.restlet.engine.connector.Controller.run(Controller.java:274) at 
org.restlet.engine.connector.ServerConnectionController.run(ServerConnectionController.java:176)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432) at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284) at 
java.util.concurrent.FutureTask.run(FutureTask.java:138) at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
 at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690) 
at java.lang.Thread.run(Thread.java:810) 



Fraser

 Hi,
 the current implementation in IOUtils is
 
 public static final int BUFFER_SIZE = getProperty(
 org.restlet.engine.io.bufferSize, 8192);
 
 This is executed only once, afaik at module loading time. A call to
 setProperty should therefore be done before anything of the RESTlet engine
 is loaded, or even on the commandline with a -D parameter to the java
 runtime.
 
 BTW, I tested this setting with a value of -1. Throws a nice exception
 without any test coding.
 
 Guido Schmidt.
 -- 
 View this message in context: 
 http://restlet-discuss.1400322.n2.nabble.com/Serialization-example-NoSuchMethodError-on-Router-attach-tp5782099p5807795.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

--

Restlet DigestAuthenticator hashed local secret

2010-12-06 Thread webpost
Hey folks,

I am trying to secure some parts of a Restlet 2.0 API using HTTP Digest through 
the DigestAuthenticator class.

In all of the examples I have seen, the DigestAuthenticator expects to receive 
a wrapped LocalVerifier through setWrappedVerifier(LocalVerifier 
localVerifier). Also in all of the examples I have seen, the LocalVerifier will 
return the local secret for an identifier in plain text.

I have written a LocalVerifier class that queries a database using the 
identifier String and I have set up a DigestAuthenticator object that wraps 
this and secures some Restlets in my API.

The problem is that my LocalVerifier class will return passwords from the 
database that have been hashed as I do not want my users' passwords to exist in 
the db in plain text. How can I set up the DigestAuthenticator to hash the 
secret provided by the client request before it digests and compares? (Or am I 
going about all of this in the wrong way?)

Thanks,
Finbarr

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


RE: Serialization example: NoSuchMethodError on Router.attach

2010-12-05 Thread webpost
I have an update to this post. Jerome pointed out the cause of the 
NoSuchMethodError problem was likely to be a CLASSPATH issue, i.e. something 
was still picking up the 2.0.3 version rather than 2.1. He was correct and once 
that was sorted out that particular problem hsa gone away. However 

If I switch between using the 2.0.3 and 2.1 JARs (with absolutely no code 
changes), 2.0.3 will work correctly whereas 2.1 returns the 
java.nio.BufferOverflowException shown below. 

I have tried this :-

public static void initialise(int Port) throws Exception {

logger.debug(Hi from initialise());

System.setProperty(org.restlet.engine.io.bufferSize, 
10);

but this still returns 8192 (the default value) :-
System.out.println(IoUtils.getBufferSize());

What am I doing wrong ?

Thanks

Fraser.

05-Dec-2010 23:57:06 org.restlet.engine.connector.OutboundWay onSelected
WARNING: Error while writing an HTTP message
java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:180)
at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:173)
at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:146)
at 
org.restlet.engine.io.ReadableChunkingChannel.read(ReadableChunkingChannel.java:120)
at 
org.restlet.engine.connector.OutboundWay.fillByteBuffer(OutboundWay.java:207)
at 
org.restlet.engine.connector.OutboundWay.onSelected(OutboundWay.java:359)
at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
at 
org.restlet.engine.connector.Connection.onSelected(Connection.java:519)
at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
at 
org.restlet.engine.connector.ConnectionController.onSelected(ConnectionController.java:183)
at 
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerConnectionController.java:107)
at 
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:236)
at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:142)
at org.restlet.engine.connector.Controller.run(Controller.java:274)
at 
org.restlet.engine.connector.ServerConnectionController.run(ServerConnectionController.java:176)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:810)
05-Dec-2010 23:57:06 org.restlet.engine.connector.OutboundWay onSelected
INFO: Error while writing an HTTP message
java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:180)
at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:173)
at 
org.restlet.engine.io.InputStreamChannel.read(InputStreamChannel.java:146)
at 
org.restlet.engine.io.ReadableChunkingChannel.read(ReadableChunkingChannel.java:120)
at 
org.restlet.engine.connector.OutboundWay.fillByteBuffer(OutboundWay.java:207)
at 
org.restlet.engine.connector.OutboundWay.onSelected(OutboundWay.java:359)
at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
at 
org.restlet.engine.connector.Connection.onSelected(Connection.java:519)
at 
org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:241)
at 
org.restlet.engine.connector.ConnectionController.onSelected(ConnectionController.java:183)
at 
org.restlet.engine.connector.ServerConnectionController.onSelected(ServerConnectionController.java:107)
at 
org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:236)
at 
org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:142)
at org.restlet.engine.connector.Controller.run(Controller.java:274)
at 
org.restlet.engine.connector.ServerConnectionController.run(ServerConnectionController.java:176)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:810)

--

RE: How do I get DOMRepresentation from Response in restlet 2.0

2010-12-03 Thread webpost
As long as the response is valid xml, you can just use
DomRepresentaion dom = new DomRepresentation(response.getEntity())

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


RE: Post method not work when deployed to GAE

2010-12-01 Thread webpost
I have the same problem.  I am using 2.1 milestone 1.  I can Get but not Put or 
Post a Serializable object
Mike

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


How do I get DOMRepresentation from Response in restlet 2.0

2010-11-30 Thread webpost
Hi,

Currently I am migrating from Restlet 1.1 to 2.0.3 and I wonder how to get a 
DOM Representation from a Response object.

In the old version this was achieved by calling getEntityAsDom on the 
response. But this method is not available anymore.

Please provide help on the best practice to achieve this now!

Thanks and regards

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


RE: Re: Unexpected status codes when using restlet with jackson

2010-11-29 Thread webpost
Hi.

I did actually put malformed json on pourpose.

My point goa; to show if I send the right mime type (json) and malformed 
content, the return code should be 400 while in fact it is 415.

Thanks for your reply.
-teo

 You're using invalid JSON in the entity. Try something like -d
 '{garbage:1}' (single-quotes are delimiters for shell, double-quotes are
 part of the content. Or maybe just -d '1' -- that should be a valid JSON
 value, too.
 
 It does seem a shame that JSON requires double-quotes around the keys, but
 that's how it is.
 
 --tim
 
 On Mon, Nov 29, 2010 at 5:56 AM, webpost at tigris dot org wrote:
 
  Hi.
 
  I'm receiving an unexpected 415 when using restelt 2.1 with jackson. I've
  started using restlet only recently, so I may well be the cause of the
  problem.
 
  Case:
  When posting valid content type but malformed body, I expect 400 Bad
  Request. Instead I'm receiving 415 Unsupported Media Type. Quoting from
  RESTful web services:
   [400 Bad Request] It’s commonly used when the client submits a
  representation along with a PUT or POST request, and the representation is
  in the right format, but it doesn’t make any sense. [415 Unsupported Media
  Type] If the client sends a document that’s got the right media type but the
  wrong format (such as an XML document written in the wrong vocabulary), a
  better response is the more generic 400 (“Bad Request”)
 
  Java code:
  @Post(json)
  public Project create(Project project) {
 
  Test:
  $ curl -i -XPOST -H 'content-type: application/json' -d '{garbage}'
  http://localhost:8080/projects
  HTTP/1.1 415 Unsupported Media Type
 
  Java stack trace:
  WARNING: Unable to parse the object with Jackson.
  org.codehaus.jackson.JsonParseException: Unexpected character ('g' (code
  103)): was expecting double-quote to start field name
 
  Is there a way to change fix behaviour and keep using jackson?
 
  Any help is greately appreciated,
  thanks!
 
  Matteo Caprari
  matteo.caprari on google mail
 
  --
 
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2686427
 

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


RE: Re: JAX RS + Tomcat (Servlet Container)

2010-11-26 Thread webpost
Hi Stephan,

for now we are trying the following solution:

We created an HttpServletRequestWrapper which overrides the method 
#getInputStream. In this method we read the parameters from 
request#getParameterMap and return it into an ByteArrayInputStream.

We will let you know if it works.

Best regards,
Torsten

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


RE: Re: router.attach advice please...

2010-11-24 Thread webpost
Hi Thierry

Many thanks for your help.

I'm not using Ajax, and I don't think this is a 'same origin policy' mechanism 
issue, becuase if I substitute: 

router.attach(/trace, MyClass.class) 

with: 

router.attachDefault(myClass.class) 

then it all works fine, when my browser points to:
http://myHost:8096/trace

It's really such a simple test case (10 lines and a remote browser) so I assume 
it's something obviously wrong with my restlet configuration, but I can't see 
what.

(note: MyClass simply returns 'OK WORKING' text representation in response to 
the GET request)

Many thanks.
Bob

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


Restlet and SIP

2010-11-18 Thread webpost
All,

I am engaged in a VOIP project for which I would very much like to have a GWT 
SIP client.  Today, I noticed that the Restlet road map has identitified a SIP 
client to be ready Q2 2011.  I need this. My questions are simple.  Can I be of 
any help? and if so how?

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


RE: Using GWT extension takes over the content negotiation!

2010-11-15 Thread webpost
Thanks Thierry for your prompt reply.

The issue still persists in release 2.0.3; without the @Get(xml|gwt) 
annotation, the target Variant is always null resulting in the GwtConverter and 
XStreamConverter score() methods both returning 0.5. Because GwtConverter comes 
first in my build, it is always selected over the XStreamConverter.

Now it seems that it is *after* the converter is selected that the Accept 
header is processed (for the preferredVariant?). So in this case, the 
GwtConverter is asked to provide either application/xml or 
application/x-java-serialized-object+gwt, for which it will always provide 
the latter representation.

I'm not highly experienced with Restlet so please forgive me if my 
understanding isn't entirely correct.

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


Can not access wiki..

2010-11-15 Thread webpost
Is there a IP Block on the wiki? I can't access it from my home machine, but 
can from a server at work.

My address is in the range 69.50.48.X

Trying to look up some documentation or info about the project, but can't seem 
to get anything! Very frustrating!!!

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


Wiki access restricted...

2010-11-15 Thread webpost
(sorry if this is dupped, not sure if it posted before)
Is there a IP Block on the wiki? I can't access it from my home machine, but 
can from a server at work.

My address is in the range 69.50.48.X

Trying to look up some documentation or info about the project, but can't seem 
to get anything! Very frustrating!!!

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


Client proxy problem

2010-11-14 Thread webpost
Hello, I keep getting Error: Can't parse the enclosed entity in my GWT 
client. It started to appear after I upgraded Restlet to 2.1M4 and tried to 
replace GWTShellServlet Wrapper with ServerServlet.

I will be thankful for any guide.

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


GWT Serialization problem

2010-11-12 Thread webpost
Hi,

I'm having problems following the First application  example in 
http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet/version/live.
 

There seems to be something going wrong with the GWT serialization of the 
Contact object on the server. I can see the GET request to 
http://localhost:8080/contacts/123 firing off just fine on the client side. The 
ServerResource retrieve -method returns the object just fine and the GET 
request is logged:

INFO: 2010-11-1209:42:19127.0.0.1   -   -   8080
GET /contacts/123   -   200 -   0   89  
http://127.0.0.1:8080   Restlet-Framework/2.1m1 
http://127.0.0.1:8080/TestGwt.html?gwt.codesvr=127.0.0.1:9997

However on the client side it seems to take around 30 seconds before anything 
happens. Eventually an empty response is received. The same happens when using 
Poster or an equivalent REST testing tool to send the request.

Requesting the data in JSON format works fine.

Any tips on where I could dig deeper into the problem?
The server is running Restlet 2.1M1 JSE edition, standalone. Maybe that has 
something to do with it? The client is Restlet 2.1M1 GWT edition. GWT is 
version 2.1.0.

Many thanks,
Tom

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


RE: Using GWT extension takes over the content negotiation!

2010-11-12 Thread webpost
Ok, I don't know if this is idiomatic Restlet, but I solved the issue by doing 
this:

@Override
public Restlet createInboundRoot() {
getMetadataService().addExtension(x-java-serialized-object+gwt,
MediaType.APPLICATION_JAVA_OBJECT_GWT);
...

And annotating the ServerResource method with:

@Get(xml|x-java-serialized-object+gwt)
...

Tracing org.restlet shows the right converter is selected, XStreamConverter or 
GwtConverter respectively.

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


RE: Re: setStatus() 500 error with newline in description

2010-11-12 Thread webpost
Thank you for your help Stephan!

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


RE: GWT Serialization problem

2010-11-12 Thread webpost
Sorry, duplicate of 
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2681028

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


POST method not working (Error 405)

2010-11-12 Thread webpost
I'm trying to submit a post request and have the current @Post annotation set 
in my handler class on the server.

I'm getting an error 405 returned though stating that this method isn't 
allowed.  Is the annotation the only thing I have to set or am I missing 
something?  I'm using the post method in the ClientResource class to send the 
message and I'm running on version 2.0.3.

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


HTTP POST - error 405 Method not allowed

2010-11-12 Thread webpost
I'm trying to submit a post request and have the current @Post annotation set 
in my handler class on the server.

I'm getting an error 405 returned though stating that this method isn't 
allowed.  Is the annotation the only thing I have to set or am I missing 
something?  I'm using the post method in the ClientResource class to send the 
message and I'm running on version 2.0.3.

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


RE: POST method not working (Error 405)

2010-11-12 Thread webpost
Here is a snippet of the client code:

...
final Representation rep = form.getWebRepresentation();
ClientResource householdResource = new 
ClientResource(http://localhost:8080/REST/household;);
final Representation representation = householdResource.post(rep);
...

The code on the server looks like:

@Post
public Representation postHousehold(final Representation entity) throws 
ResourceException 
{
   
}

I'm not using any extensions.  I'm simply trying to send a few String fields in 
a POST request to the server.

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


Error when posting to webapp running on 2.1MS1

2010-11-12 Thread webpost
I get this exception when trying to send a message:


SEVERE: Allocate exception for servlet RestletServlet
java.lang.ClassNotFoundException: org.restlet.engine.http.ServerCall
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
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 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

The ServerCall class is actually located in the /org/restlet/engine/adapter 
directory.  Can you have a look at this?

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


RE: POST method not working (Error 405)

2010-11-12 Thread webpost
FIXED the error by doing this:

It seems my annotations aren't being picked for some reason so in the 
constructor for my resource handler I have added this code.

// Declare the kind of representations supported by this resource.  
final SetMethod allowedMethods = new HashSetMethod();
allowedMethods.add(Method.POST);
getVariants().add(new Variant(MediaType.TEXT_XML)); 
setAnnotated(true);
setNegotiated(false);
setAllowedMethods(allowedMethods);

I have then overriden the post method and redirected to the annotated one as 
follows:

@Override
public Representation post(final Representation entity)
{
return annotatedPost(entity);
}

@Post
public Representation annotatedPost(final Representation entity) throws 
ResourceException 
{
// do posty stuff
}

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


Using GWT extension takes over the content negotiation!

2010-11-11 Thread webpost
Hi Restlet team,

I'm using Restlet 2.0.1 JEE edition, with both the GWT and XStream extensions. 
The idea is to have a web service that ordinarily returns XML representations 
of POJOs except when called from Restlet GWT.

However despite setting the Accept header of the request, e.g. Accept: 
application/xml, Restlet will always negotiate to return the GWT serialized 
object.

What could I be doing wrong? Is there a way to see how Restlet comes to choose 
the GwtConverter, or perhaps lower its priority?

Regards
Lukito
(ltruong at itree dot com dot au)

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


RE: How to Force URL Encoding Before URI Matching?

2010-11-11 Thread webpost
Did you resolve this?
I'm having the same problem...

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


Exception in ClientResource.get()

2010-11-11 Thread webpost
Hi, im trying to consume a restlet get method i've implemented, but i get this 
exception. 


11-11 11:08:58.224: ERROR/AndroidRuntime(446): FATAL EXCEPTION: main
11-11 11:08:58.224: ERROR/AndroidRuntime(446): java.lang.NullPointerException
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.data.ClientInfo.getAgentAttributes(ClientInfo.java:465)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.Request.init(Request.java:244)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.resource.ClientResource.handle(ClientResource.java:845)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.resource.ClientResource.handle(ClientResource.java:819)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.resource.ClientResource.handle(ClientResource.java:777)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.restlet.resource.ClientResource.get(ClientResource.java:514)
11-11 11:08:58.224: ERROR/AndroidRuntime(446): at 
org.me.rest.RestApi2.getFolk(RestApi2.java:44)

it seems agentattributes is null...

The Client code

ClientResource itemResource = new 
ClientResource(http://10.0.2.2:8084/firstStepsServlet/hello;);

Representation rep = itemResource.get();
///

Im working with a tomcat server, and a Android client.
I've tried using the request way of the Restlet Framework 1.0 and it works :
//
 Request request = new Request(Method.GET, 
http://10.0.2.2:8084/firstStepsServlet/hello;);
 Client client = new Client(Protocol.HTTP);
Response response = client.handle(request);
 Representation st= response.getEntity();
///
...but i would like to know why the client resorce way is not working.


Thanks¡

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


GWT Serialization problem

2010-11-11 Thread webpost
I'm trying to follow the instructions on the First Application example 
(http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html)
 to integrate Restlet and GWT. I'm running Restlet JSE edition (2.1M1) on the 
server, running standalone. On the client I'm using version 2.1M1 of the GWT 
edition. My GWT version is 2.1.

I'm having problems requesting the contact information from the server. The 
request seems to kick off fine from the GWT side and using firebug I can see a 
GET request going to to http://localhost:8080/contacts/123. I can see the 
ServerResource returning the Contact object everything seems to be OK:

INFO: 2010-11-1115:25:30127.0.0.1   -   -   8080
GET /contacts/123   -   200 -   0   43  
http://127.0.0.1:8080   Restlet-Framework/2.1m1 
http://127.0.0.1:8080/TestGwt.html?gwt.codesvr=127.0.0.1:9997

However the request takes around 30 seconds after which a null response is 
received on the client side.

I also tried requesting the data in JSON format, in which case the client 
received the response just fine.

Any tips on how I could dig deeper into the problem?

Thanks  Best Regards,
Tom

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


setStatus() 500 error with newline in description

2010-11-10 Thread webpost
Hi All,

I am trying to use setStatus with a newline in the description. This is a 
snipper of the server code with the error:

public String acceptGet(String in) throws Exception {  
Status SERVER_ERROR_INTERNAL = new Status(530); 
getResponse().setStatus(SERVER_ERROR_INTERNAL, This is Get\nis\n\nBroken);

return Get\nIs\nBroken\n;
}


This is the if statement in my client code example that is catching the 500 
error:

if (conn.getResponseCode() != 200) {
System.out.println(conn.getResponseCode());
System.out.println(conn.getResponseMessage());
System.exit(0);
}

When I point my client to the url this is the message I get:
530
This is Get

Everything after first newline gets chopped off.  Is it possible to have a 
newline inside of the status description or was it designed purposely to only 
allow 1 line?

Thanks,
Frank

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


RE: Hang when calling setStatus with CLIENT_ERROR_BAD_REQUEST

2010-11-09 Thread webpost
version: 2.0.3 (stable)

I am seeing this too, although not only on CLIENT_ERROR_BAD_REQUEST.

Did you get anywhere discovering what it might be ?

Regards

Fraser

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


XStream extention and NO_REFERENCES

2010-11-09 Thread webpost
I am using the XStream extension with ServerResource, and the generated XML 
contains references.  Is there a way to disable this?  It seems 
Xstream.setMode(XStream.NO_REFERENCES) should do it, but how do i get the 
XStream instance from within the @Get(xml) retrieve() method?

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


RE: Re: newbie question

2010-11-08 Thread webpost
That is promising news.  Is there anybody who has done that who might have a 
few lines of sample code (with import jars) that hooks into Amazon SDB to get 
me started?

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


Nested routers and keeping remaining part

2010-11-03 Thread webpost
Hi ! Is there a way to tell a router to not update the remaining part of the 
request so that you can have nested routers acting on the same remaining part.
To be clear, my original need is, I have anonymous and authenticated resources 
but flat URLs. Kind of :
/aaa : anon - resource
/bbb : auth - authenticator - resource
/ccc : auth - authenticator - resource
The problem is, after the authenticator, the remaining part is empty and so the 
final resource is not found.
Thanks !

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


RE: Socket Exception using Redirector

2010-11-03 Thread webpost
I was able to suppress persistent connections by overriding createComponent and 
setting the http client's context parameters. I am not sure that is the best 
way of doing that but it is working now.

It is still unsatisfying to suppress persistent connections as using persistent 
connections is generally a good thing.  However, it seems that the client does 
not seem to handle a broken connection gracefully; it does not even close the 
connection if it detects an error during writing to the socket.  Only when it 
tries to read from a closed socket, the connection then closes. I will continue 
to work on the problem to determine a way of using persistent connections with 
the Redirector.

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


Changing content-type on ClientResource

2010-11-03 Thread webpost
I have a ServerResource that uses the @Put(xml) annotation like this:

public interface TestResourceInterface {
@Put(xml)
public TestClass store(TestClass tc);
...
}

public class TestResource extends ServerResource implements 
TestResourceInterface {
@Override
public TestClass store(TestClass tc) {

}
}

I have a ClientResource that then attempts to use the above ServerResource like 
this:

ClientResource cr = new ClientResource(url);
TestResourceInterface tri = cr.wrap(TestResourcEInterface.class);

tc1 = tri.store(tc2);

The ClientResource is sending a Content-Type of application/json instead of 
application/xml, so the ServerResource is returning a 405.  If I use @Put 
instead of @Put(xml), then things work as expected.

How can I change the Content-Type of the ClientResource to application/xml?   A 
cr.getMetadataService().setDefaultMediaType(MediaType.APPLICATION_XML) doesn't 
seem to work.

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


RE: Restlet client code does not work in Restlet Server (ServerResource) service.

2010-11-01 Thread webpost
Hi

I tried some more by using standard URLConnection inside the same block like...

-
URL yahoo = new URL(http://www.yahoo.com;);
URLConnection yc = yahoo.openConnection();

BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
logger.log(Level.INFO ,  + inputLine);
in.close(); 
--

And it work perfectly. Now, that sound like the problem somewhere in 
ClientResource class.

On the other note, I wrote some test program using cross origin technique from 
semantic though at http://kodemaniak.de/?p=62 

It work perfectly in 2.0rc4, but when I upgraded to 2.0.1, it just stop 
working. Look like 2.0.1 add some security restriction that won't allow cross 
origin by setting response option any more?

--Patrick

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


GWT/Restlet/GXT

2010-11-01 Thread webpost
My team is evaluating technologies for out new GUI.
However, I am struggling at how to connect Restlets with GXT. I saw this 
posting by jlouvel and would love to know if the code or the tutorial/article 
existed. 

http://restlet.tigris.org/issues/show_bug.cgi?id=1094

Consider providing REST bridges for GXT models such as implementation of the 
DataProxyC, D, the DataReader, etc.

http://www.extjs.com/deploy/gxtdocs/
 
Consider whether a GXT extension would be useful or simply some 
tutorial/article.

I am used to using things like JAXB or Castor to convert between XML and Java 
objects. I see nothing in GXT or Restlets that helps with creating XML. There 
is a bit of support for Reading, but not Writing. Am I missing something?

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


A few questions about restlet.

2010-10-29 Thread webpost
Hi, i was reading the tutorials, and i'm a little confused.

Let's say that i want to have this uris:

1) http://localhost:/code/isvalid/{codeNumber} in this uri i would like to 
check in my back if {codenumber} is a valid code
2) http://localhost:/code/create in this uri, the back will create a new 
code

To do something like this, i need to create a Resource for each uri? 

Can't i create, for example a CodeResource that handles both uris?

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


Restlet client code does not work in Restlet Server (ServerResource) service.

2010-10-29 Thread webpost
I hope I'm not spamming the list. I tried post once, but the message doesn't 
seem to show up.

  I'm using restlet 2.0rc4 on BSD, and run into some interesting problem. I'm 
trying to make http request using restlet client from inside restlet server 
code (inside ServerResource @post method).

Code snippet is as following:


InetAddress yahoohost = InetAddress.getByName(www.yahoo.com);

logger.log(Level.INFO, --- Yahoo address:  + yahoohost.toString());
logger.log(Level.INFO, --- Reachability:  + yahoohost.isReachable(3000));

ClientResource client = new ClientResource(http://www.yahoo.com;);
logger.log(Level.INFO, HTTP GET Resp:  + client.get().getText());
---   

And I got the following error:
-
Oct 28, 2010 12:13:53 AM Crossweb.CWManagerCouchDB validateSession
INFO: --- Yahoo address: www.yahoo.com/98.137.149.56
Oct 28, 2010 12:13:53 AM Crossweb.CWManagerCouchDB validateSession
INFO: --- Reachability: true
Oct 28, 2010 12:13:53 AM org.restlet.engine.component.ClientRouter getNext
WARNING: The protocol used by this request is not declared in the list of 
client connectors. (HTTP/1.1)
Not Found (404) - The server has not found anything matching the request URI
at org.restlet.resource.ClientResource.handle(ClientResource.java:748)
at org.restlet.resource.ClientResource.handle(ClientResource.java:660)
--

You can see that my system solved dns correctly and www.yahoo.com was reachable 
from within ServerResource class. But somehow it said no matching the request 
URI

I tried the exact same code as standalone class, and it worked perfectly as 
client and I got a bunch of yahoo frontpage back. Is there anything I miss?

--Patrick

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


Trying to use restlet client from inside restlet server code

2010-10-29 Thread webpost
Hi,

  I'm using restlet 2.0rc4 on BSD, and run into some interesting problem. I'm 
trying to make http request using restlet client from inside restlet server 
code (inside ServerResource @post method).

Code snippet is as following:


InetAddress yahoohost = InetAddress.getByName(www.yahoo.com);

logger.log(Level.INFO, --- Yahoo address:  + yahoohost.toString());
logger.log(Level.INFO, --- Reachability:  + yahoohost.isReachable(3000));

ClientResource client = new ClientResource(http://www.yahoo.com;);
logger.log(Level.INFO, HTTP GET Resp:  + client.get().getText());
---   

And I got the following error:
-
Oct 28, 2010 12:13:53 AM Crossweb.CWManagerCouchDB validateSession
INFO: --- Yahoo address: www.yahoo.com/98.137.149.56
Oct 28, 2010 12:13:53 AM Crossweb.CWManagerCouchDB validateSession
INFO: --- Reachability: true
Oct 28, 2010 12:13:53 AM org.restlet.engine.component.ClientRouter getNext
WARNING: The protocol used by this request is not declared in the list of 
client connectors. (HTTP/1.1)
Not Found (404) - The server has not found anything matching the request URI
at org.restlet.resource.ClientResource.handle(ClientResource.java:748)
at org.restlet.resource.ClientResource.handle(ClientResource.java:660)
--

You can see that my system solved dns correctly and www.yahoo.com was reachable 
from within ServerResource class. But somehow it said no matching the request 
URI

I tried the exact same code as standalone class, and it worked perfectly as 
client and I got a bunch of yahoo frontpage back. Is there anything I miss?

--Patrick

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


ClientResource.wrap() proxy will not POST json

2010-10-29 Thread webpost
I am using the Android-2.0.1 and have interface:

public interface FarmerResource 
{
@Get
public Farmer[] retrieve();

@Put(json)
public Farmer store(Farmer farmer);

@Post(json)
public void update(Farmer farmer);

@Delete
public void remove();
}

Then:

ClientResource cr = new ClientResource(http://host/some/path;);
FarmerResource fr = cr.wrap(farmerResource.class);
Farmer f = new Farmer();
fr.update(f);

Then JacksonConverter.score(Object source, Variant target, UniformResource 
resource) is called with target==null.

Then the request is sent with Content-Type=application/x-java-serialized-object 
and with size==0.

How do I get the automatic conversion of Farmer-json POSTed with the right 
Content-Type?

More generally, does the client proxy mechanism I am using work correctly in 
Android?  

How do I debug a problem like this as I don't have access to readable proxy 
code (it seems to be generated by ClientResource.wrap())?

Is there a way to get the automatic conversion calling post() directly on 
ClientResource?

What is the right way to do this?

Thanks, scott

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


RE: Restlet client code does not work in Restlet Server (ServerResource) service.

2010-10-29 Thread webpost
Hi Jerome,

I didn't see any response, only your name as author of response post. :-) 

Anyway, should I add any issue to your bug tracking in this case?

--Patrick

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


RE: Cannot request resources from GWT client when using Collection as a parmeter?

2010-10-28 Thread webpost
Thank you for the fix! I am looking forward to the new release!

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


how to get String with space inside

2010-10-28 Thread webpost
I am trying to transfer a String with space character inside to server, but 
server side can not retrieve it properly. for example, if I send the string of 
London City, then server will display as London+City. 

How can I retrieve the String properly from server side?

my client code is:

String roleURL = https://myserver/CITY/city=London City;
Client c = new Client(Protocol.HTTPS);
Request request = new Request(Method.GET, new Reference(roleURL));
Response response = c.handle(request);

my server code is:

Router router = new Router(getContext());
router.setDefaultMatchingMode(org.restlet.util.Template.MODE_EQUALS);
router.attach(/{cityParameters}, ResourcesSearchResource.class);


the code of ResourceSearchResource.java is

String cityParameters = (String) 
getRequest().getAttributes().get(cityParameters);


but when I try to display cityParameters, it displayed as city=London+City. How 
can I retrieve it properly as city=London City.

Thanks in advance,

Nicho

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


RE: ClientResource and HttpClientHelper in 2.0.1

2010-10-28 Thread webpost
Thanks Thierry, I missed the context.setClientDispatcher call when looking at 
the api.  btw, very much enjoying Restlet!

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


RE: Re: Setting cookies

2010-10-20 Thread webpost
Yes, this worked, it looks like I was missing the 'getResponse()' in 
'this.getResponse().getCookieSettings().add(new CookieSetting(0, cookieName, 
cookieValue));'

Thanks so much for your help, I spent so long trying to figure this out.

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


Setting cookies

2010-10-18 Thread webpost
I'm having a heck of a time trying to set a cookie.  This is the code I have so 
far:

In the first part attempts to read any cookies that I put there before, this 
always comes up blank.

The second part tries to add a new cookie to the response.  Theres a few places 
that I could have gone wrong:
1) I didn't know how to instantiate a new SeriesCookieSetting, so I grabbed 
the existing one and modified it by by calling 'this.getCookieSettings()'.  
2) I added the cookie by calling 'this.setCookieSettings()'
3) I'm doing this through 'POST'

When I check the response headers 'Set-Cookie' doesn't appear to be there at 
all.

public class TestCookieResource extends ServerResource {

@Post
public Representation post(Representation representation){

// READ COOKIES FROM CLIENT
SeriesCookie cookies = this.getRequest().getCookies();
int cookieNum = cookies.size();
String values = ;
for( Cookie cookie : cookies){
values += cookie.getValue() + \n;
}

// SET NEW COOKIE
CookieSetting cS = new CookieSetting(0, cookieName, 
cookieValue);
SeriesCookieSetting cookieSettings = this.getCookieSettings();
cookieSettings.clear();
cookieSettings.add(cS);
this.setCookieSettings(cookieSettings);

// SEND RESPONSE
this.setStatus(Status.SUCCESS_OK);
//StringRepresentation sR = new 
StringRepresentation(HELP.getJSON(HELP.getMessageMap(Test 
response)).toString());
StringRepresentation sR = new StringRepresentation(test 
response);
return sR;
}
}

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


RE: Re: POST Requests return with a 405 with @Post annotated method

2010-10-18 Thread webpost
I get this problem with 2.0.1 and 2.1 fetched today (18 Oct 2010) (Java SE 
versions) using the internal server.

The example FirstResource application fails.
Problem also occurs with PUT.

2.0.RC4 works (well, that bit did)

Peter Furniss

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


Jackson 1.4 in gae-2.0.1 won't AutoDetect Field

2010-10-15 Thread webpost
gae-2.0.1 has Jackson 1.4 which will not AutoDetect Fields of any kind.  This 
makes it difficult to serialize classes like Objectify's Key which does not 
have public setters.  The current Jackson is 1.6 which is subsequent to 1.5 
when they introduced much more control over AutoDetection.  I tried just 
including the 1.6 jars but had the same result.  Jackson annotations are of no 
help here because I am trying to serialize classes that are not my own.

What do I need to do to get JSON Field AutoDetection to work?

But my larger question is, how is one supposed to configure extensions like 
Jackson from within the Application?  For instance getting ahold of the 
ObjectMapper instance which is how Jackson is configured.  Write your own 
extension?

Thanks, scott

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


How to PUT a JSON payload and have Jackson automagically create an object?

2010-10-14 Thread webpost
I am trying to PUT ( and POST ) to a ServerResource and have it convert my JSON 
payload to the corresponding Java POJO, but all I get is 415 Unsupported Media 
Type errors.

My POJO implements Serializable, @Get(json) seems to work as it is supposed 
to.

@Put(json) gives me the 415 Unsupported Media Type. As well as does 
@Post(json)

I have searched the net, Google, forums, for 4 hours now, and nothing.

I have the three Jackson dependencies, ext, core and mapper in the right places.

Attached are what I can't get to work.

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


change the default URL Restlet uses from http:// to https://

2010-10-14 Thread webpost
Hi I've got a web application created by my supervisor which uses Spring 
Security and Restlet. I've got two lots of proxying happening and SSL is 
performed at an earlier stage. 

All my resources of this web application have the
URL http://something. It appears this is Restlet's default. how do i configure 
Restlet in my application
so that the default URLS are https://something?

I'm assuming there must be a simple configuration
change for this. Like I said earlier, the SSL is all done at an earlier stage 
before the request reaches the Virtual Machine on which this web application is 
stored, so the solution is not generating SSL certificates etc.

Thanks,

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


help, I need my URLS defaulted to https:// not http://

2010-10-14 Thread webpost
Hi I've got a web application from my supervisor using
restlet and Spring security. 

I've got SSL happening at an earlier stage before
the a request reach my web application on a virtual machine. Restlet has 
defaulted all my URLS to
http://something. How do I change this so that the 
default is https://something?

As I said the SSL stage is done earlier, I just want my URLS to be set to https 
not http.

The application has a router class which extends
import org.restlet.ext.spring.SpringRouter;

Is there any simply way to configure this?

Cheers,

P.S. sorry if this message was already posted, i posted
earlier and it didn't turn up on the posted list.

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


RE: Re: get from browsers

2010-10-14 Thread webpost
This worked:

this.getTunnelService().setUserAgentTunnel(true);

Can you explain a little more why it works so I understand what is going on?

Shawn

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


RE: Re: Re: About XTC (Facelets port)

2010-10-13 Thread webpost
Good news. I managed to overcome all the difficulties. I've got it all working 
like a charm. I even wrapped up an example maven project containing a working 
configuration along with some simple classes that I wrote.

You can merge it into your project if you like. 

I really think that if you advertised it a little, it could get some pretty 
good traffic. I think there isn't really a viable alternative to what you 
wrote, and I spent nearly a week looking for something decent. Spring is fairly 
well known.

Thanks again, Julek

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

xtc-spring-example.tar.gz
Description: GNU Zip compressed data


get from browsers

2010-10-13 Thread webpost
Restlet 2.0.1

I have two Get annotations defined:

@Get(htm|html)
and
@Get

The get @Get returns a serializable object which jackson serializes to json.

However when I put the url in a browser I would expect the @Get(htm|html) to 
be called.

I put in some print statement and it seems internet explorer 8 it always 
requests application/json.

In firefox it does like I expect and requests text/html.

Is there any way to set it up so IE 8 will prefer text/html so the 
@Get(htm|html) gets called and not my @Get which serves json?

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-10-08 Thread webpost
Thanks a lot for you help,

I guess I found a solution that works at least for me now. I took your jax-rs 
extension sample that was provided with the Restlet download to see the figure 
it out - thanks for the hint.

The @Context UriInfo does not work for parameter that are send within the HTTP 
body. So UriInfo can only be uses with a parameter list within a url (GET 
requests). For the other methods that use the HTTP body you have to use the 
MulitvalueMap in the method definition. Within this mulitvaluemap you can find 
all the parameter. Using uriInfo.getQueryParameter works only for Get requests. 

But using the MultivalueMap requires to set the content-type of the client 
request to application/x-www-form-urlencoded (at least for the ruby client I 
used, a HTTP form worked without this) Using other content types like 
application/json, text/plain... doesn't work for me. I got a 415 always, 
don't know why. Any idea?

Another thing is, when the MultivalueMap is defined in the method definition 
the request must contain any parameter data otherwise it will cash because of 
no http form data. 


So a small example how I made it running:

...
@Context UriInfo uriInfo;
@HeaderParam(Accept)  String requestedMimeType;

@javax.ws.rs.GET
@Path({blogId})
public Response getBlog(@PathParam(blogId) java.lang.Integer blogId) {
  return getResourceHandler().getBlog(new 
BlogGetParameter(uriInfo.getQueryParameters(false), blogId), requestedMimeType, 
uriInfo);
}

@javax.ws.rs.DELETE
@Path({blogId})
public Response deleteBlog(@PathParam(blogId) java.lang.Integer blogId) {
  return getResourceHandler().deleteBlog(new BlogDeleteParameter(blogId), 
requestedMimeType, uriInfo);
}

@javax.ws.rs.POST
public Response createBlog(MultivaluedMapString, String params) {
  return getResourceHandler().createBlog(new BlogCreateParameter(params), 
requestedMimeType, uriInfo);
}
...

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


RE: Re: PUT requests return 405 code with @Put annotated method using 2.0.1 release

2010-10-08 Thread webpost
Hi Dustin,

I've reproduced the error with a minimal test:


public class ApiApplication extends Application{

public static final String TEST_URL = test;

public ApiApplication(Context context){
super(context);
}

@Override
public Restlet createInboundRoot(){

Router router = new Router(this.getContext());
router.attach(/ + TEST_URL, TestResource.class);

return router;
}
}



public class TestResource extends ServerResource {

@Get
public String doGet() {
return hello, world;
}

@Put
public void store(Representation representation) {
System.out.println(PUT);
}


The GET method works properly, but the PUT method does not.

I don't know if it is important but I've just tested with development server.

Best regards,

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


Content-Disposition

2010-10-08 Thread webpost
Hello All !

I have a web service which sends back PDF/CSV files to the browser. 
But these get downloaded through the browser with a default name and no 
extension! 

How do I get the browser to display a 'save as' dialog box and also specify the 
type of file am sending through (pdf/csv) ?

Cheers!
Nirav

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-10-05 Thread webpost
Hi Stephan,

I guess you meant with parameter a @QueryParam annotated variable? I tried so 
and added something like this:

public String createBlog(@DefaultValue(me) @QueryParam(alias) String alias) 
{...}

But I still get the same error 405. Funnily enough the first post request is 
successful but the parameters I send with are just ignored and the alias 
variable is set to the default value. Sending the POST request a second time or 
more often I get the 405. 

The reason might be that the parameters are not parsed correctly. I followed 
you hint and debugged everything. And I guess there is something wrong within 
the Restlet/Jax-R. The parameter I send with my request are just put in front 
of HTTP method. So the resource cannot be found. With the following link you 
can see a screenshot from the debugger window. The highlighted line might be a 
bug in the framework?! http://matthias.wilkau-hasslau.net/restlet_post.png So 
you can see that the parameter m with its value blogId is set in front of 
the POST. Is this supposed to be like that?

Can you reproduce it or do you have a running version of a Restlet application 
with Jax-Rs resources that you could send me? So, if the mistake is on my side 
I could figure it out by my own?

Thanks a lot for the support.

Matthias

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


RE: tutorial not working

2010-10-05 Thread webpost
i did forget the first line of the log

GET /contacts/123 HTTP/1.1 404 472

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-10-01 Thread webpost
Hi Stephan,

sorry for bothering you that often but I just do not get it running. I just 
will exlain my problem a bit more in detail. While sending GET request 
everything concerning a simple GET request works. But sending a request with 
any other method I always get the 405 status code, even I do just  a normal 
POST request with a normal POST parameter. Let me explain it with a small 
example.

My Jax-Rs resource looks like:
...
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.UriInfo;

@Path(blogs)
public class BlogResource extends {
  ...
  @POST
  public String createBlog(@Context UriInfo info) {

return {\result\:\ok\}
  }
  ...
}


My HTML file looks like:

htmlheadtitleREST Web test client/title/head
body
form name=restrequest action=http://localhost:8182/blogs/blogs; 
target=right method=POST
input type=text value=me name=tags
input type=submit value=Submit /
/form
/body
/html

So it should call the POST method with a POST parameter tags=me. But the server 
just returns a 405. And when I enable the method tunneling the server logs just 
that POST is called with a POST parameter method=DELETE but that the POST 
request is not allowed and returns a 405.

To sum it up, I am not able to process a POST request either with nor without a 
parameter. Do I have to allow POST somehow?

 Hi Matthias,
  as I read parts of your master thesis I found the extension issue and that 
  it was done on purpose. So I could have found it by my own. Sorry for 
  bothering you with this.
  But I got another issue, sending parameter with a POST request. When I send 
  parameter with a POST request I just get an 405 - Method not allowed. I 
  searched the internet and found that you have to enable the different 
  methods woth allowPost(). But to do so you have to use Restlet resources 
  from the Restlet version 1.1. But I don't use Restlet 1.1 (did not found 
  such a method for 2.1) and I don't have use Restlet resources at all.
 
  Do I have to enable the POST methods somehow? (sending a POST request 
  without POST parameter works)
 In the JAX-RS extension not.
 allowPost() is for pure Restlet 1.x.
 
 Do you have the problems with post, if you add parameters for the tunnel 
 filter? Maybe the tunnel filter only works on GET requests.
 
 best regards
 Stephan

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


GuardedExample without using deprecated API

2010-09-30 Thread webpost
Hy everybody

I was using CXF and change to Restlet because security looks to be easier to 
implement.

I am using JAX-RS and I hopefully found an example with security in the source 
code: org.restlet.example.ext.jaxrs.GuardedExample 

I had some difficulties to make it work : 
We need to call ChallengeAuthenticator after creating the Verifier.

// set valid users and their passwords.
MemoryRealm realm = new MemoryRealm();
application.getContext().setDefaultEnroler(realm.getEnroler());
application.getContext().setDefaultVerifier(realm.getVerifier());

realm.getUsers().add(new User(admin, adminPW.toCharArray()));
realm.getUsers().add(new User(alice, alicesSecret.toCharArray()));
realm.getUsers().add(new User(bob, bobsSecret.toCharArray()));

// create a Guard
final ChallengeAuthenticator guard = new ChallengeAuthenticator(
application.getContext(), ChallengeScheme.HTTP_BASIC,
JAX-RS example);



Because the ChallengeAuthenticator constructor use the vertifier in the context 
: 
public ChallengeAuthenticator(Context context, boolean optional,
ChallengeScheme challengeScheme, String realm) {
this(context, optional, challengeScheme, realm,
(context != null) ? context.getDefaultVerifier() : null);
}


Now it is working but I am wondering about the RoleChecker. My RoleChecker is 
like this : 

/**
 * Class needed for BASIC AUTH.
 */
@SuppressWarnings(deprecation)
private static final class RestletRoleChecker implements RoleChecker {

public boolean isInRole(Principal principal, String role) {
throw new RuntimeException([isInRole] was called. We don't know 
why this class is needed.);
}
}

And it is working with HTTP Basic Auth very well.

Because security is important, I am wondering why I need to call : 

application.setAuthentication(guard, roleChecker); //with an unused 
RestletRoleChecker

and why : 

application.setGuard(guard); //not deprecated

doesn't work instead.

Because application.setAuthentication is deprecated, how can I use 
ClientInfo.getRoles() instead ?

The only way I found to access ClientInfo is in Resource, and I would like to 
set the BasicAuth for every Resources.

Thank you

Romain

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


Runtime issue with Restlet 2.0-SNAPSHOT

2010-09-29 Thread webpost
Hi,
I am using Restlet 2.0-SNAPSHOT version with jaxrs extension.

But at runtime, I am getting error:
java.lang.NoClassDefFoundError: org.restlet.util.Helper

I see that this class is in restlet 1.1.10 verion.

Am I missing anything in my dependency list?

I also tried to search same class in all the jars I got when downloading 2.0 
version, but didn't find this class in any of those jars.

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-09-27 Thread webpost
Hi Stephan,

as I read parts of your master thesis I found the extension issue and that it 
was done on purpose. So I could have found it by my own. Sorry for bothering 
you with this.
But I got another issue, sending parameter with a POST request. When I send 
parameter with a POST request I just get an 405 - Method not allowed. I 
searched the internet and found that you have to enable the different methods 
woth allowPost(). But to do so you have to use Restlet resources from the 
Restlet version 1.1. But I don't use Restlet 1.1 (did not found such a method 
for 2.1) and I don't have use Restlet resources at all. 

Do I have to enable the POST methods somehow? (sending a POST request without 
POST parameter works) 


Kind regards, Matthias

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


RE: Re: About XTC (Facelets port)

2010-09-26 Thread webpost
I'm happy to hear that XTC has actually been used in production. That's enough 
for me to try to use it myself.

I suppose the whole integration shouldn't be so difficult altogether. All that 
there really is to do, is to override AbstractUrlBasedView which amounts to 
implementing a single method:

void renderMergedOutputModel(MapString, Object model, HttpServletRequest 
request, HttpServletResponse response) throws Exception;

after which the whole layout should be outputed to the response stream object. 
Inside the method, the path to rendered page template is available. The model 
parameter associates names of variables with their interpretations. If those 
interpretations are some compound types, their components should be available 
through var.somePropertyName or var[123], etc.

Are there some important incompatibilities? From the projects' trac it seems 
the implementation is pretty complete when it comes to features that are 
applicable in a RESTful approach. If I see correctly, you don't mention 
ui:fragment / tag on your wiki. Is it available?

Well, in the end I would really like to say: thank you, thank you, thank you. I 
really spent a gazillion hours looking for some decent templating solution that 
is previewable and isn't using some home-brew domain specific language or isn't 
tightly coupled with some crappy stateful web framework.

Julek

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


Put method not working on deployed GAE app

2010-09-25 Thread webpost
I have downloaded the serialization example available on the site. 
Everything works fine using the GWT client.

With the JSE client Get operations work fine both with JavaBean and JSON 
serialization, but I couldn't manage to get the Put (store) operation working 
on the deployed app, while I have no problem on the development server.

From logs I only could see that the Contact bean  is null, but I do not get 
any error message.

I tried to review libraries but with no success.

I did not find any discussion on this topic. 
I will really appreciate suggestions.
Thank you.
Giovanni

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-09-24 Thread webpost
Hi Stephan, (guess I should get a name here)

The thing with the Spring is not that problem. The integration actually works 
fine. You just have to create a config file in which you specify the 
JaxRsApplication to call and you hand over the SpringComponent. It's quite easy.
The problem is that the application where I integrate the REST application just 
redirects any request that doesn't has an extionsion. (for security and other 
reasons) So even it is not usefull have a DELETE request with an extension I 
would need it because of the integration.

I will see how I can work around this (also see the tunneling you mentioned) 
and will post a possible solution (if I find a good on)

Thanks for you reply and your help.

Matthias ;)

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


Determinism in content negotiation

2010-09-23 Thread webpost
With an HTTP request containing Accept: application/json, the Resource @Get 
method that is being called depends on the order of the functions as below:

Resource1 {
@Get
public Blah retrieve1() {//this gets called}
@Get(json)
public Blah retrieve2() {}
}


Resource2 {
@Get(json)
public Blah retrieve2() {//this gets called}
@Get
public Blah retrieve1() {}
}

Wouldn't it be nice if it preferred the @Get(json) method whenever I ask for 
application/json? 


The reason this is happening is, Variant's properties are used for content 
negotiation, whereas the annotation information is in VariantInfo, which is 
ignored in org.restlet.engine.util.Conneg.scoreVariant(Variant).

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


RE: Re: Restlet Framework 2.0.1released

2010-09-23 Thread webpost
Same problem here. Is there an issue for it ?

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


Accept Header not working

2010-09-23 Thread webpost
Hi All,
I am using Restlet 1.1, in represent method I am not getting proper MediaType 
which I am passing in Accept in request header.

I tried to print getRequest().getClientInfo().getAcceptedMediaTypes()
It always gives [*/*:1.0] no matter what I pass in Accept.
I tried passing application/json

I have also added following line in constructor 
getVariants().add(new Variant(MediaType.APPLICATION_XML));
getVariants().add(new Variant(MediaType.APPLICATION_JSON));

Any Clue?

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


RE: SAML 2.0 with Restlet

2010-09-21 Thread webpost
Do I need to be more elaborate about my problem :)

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-09-21 Thread webpost
A note to the post before. I went on with trying a bit more and I figured out 
that it sends data back to the client but only in the case when I don't use any 
extensions.
As soon as I use an extension on the POST call it prints me an 404 because it 
tries to request /blogs.json instead of filtering the extension and call /blogs

Might this be a bug or did I miss a setting? 

I do the POST call with a HTML form and I use Restlet 2.1 (tried 2.0 before)
Using GET this way it is working.

Thanks for you help.

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


RE: Re: Resource paths with Restlet and Jax Rs

2010-09-20 Thread webpost
Thanks a lot for your help. It took me a while to figure it out how I can use 
the tunneling and the extension this way I want to. It is working for the GET 
requests as expected. But I got some other questions/ issues.

I just enabled the tunnel for my JaxRsApplication class and added the mime 
types to the resource methodes within the @Produces annotation. But now I 
discovered that it is not possible to do a POST request using the mime type 
extension (json, xml...) I guess this is because POST is not intentend to send 
data back to the client only http status codes. So I commented out the 
@Produces for the POST and it was working. 

The problem is that the jax-rs application will be included in a spring project 
that only allows requests with certain extensions like json, xml... So is there 
a way to get around this? 

The other thing is that I would like to send response data back to the client 
with the POST (DELETE, PUT) request to save resources on the (mobile) client 
side. Is there a way to do this?


Thanks in advance for the help.

Is also searched this mailing list but did not found anything hope I did not 
missed it somehow.

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


RE: Embedded Jetty

2010-09-17 Thread webpost
 Hi Roy and Bruno,
 
 Note that Restlet 2.0.2 will ship with the latest Jetty 7 version. If a 
 Servlet deployment isn't desired, it might be wise to migrate to Restlet 2.0.
 
 Best regards,
 Jerome
 --
 Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
 Noelios Technologies ~ http://www.noelios.com
 
 
 -Message d'origine-
 De : Bruno Harbulot [mailto:bruno.harbu...@manchester.ac.uk] 
 Envoyé : mercredi 15 septembre 2010 15:10
 À : discuss@restlet.tigris.org
 Objet : Re: Embedded Jetty
 
 Hi,
 
 On 13/09/10 02:22, webp...@tigris.org wrote:
  I'm attempting to use Jetty 7.1.5 with Restlet 1.1.10 however there's no 
  connector jar included for this version of Jetty - only Jetty 6.1.  So, I'm 
  wondering is it possible to use Jetty 7?
 
  Also, I'm not sure where put jetty.xml so I can configure the server 
  settings.
 
 It's not really clear how you're trying to use Jetty in this context:
 
 - If you're using Jetty as a Servlet container, you can use Jetty 7 (even 
 with Restlet 1.x) and configure it with jetty.xml. You Restlet will then use 
 the servlet connector.
 
 - If you want to use a standalone Restlet server, using Jetty as the 
 connector library, then I think you'll have to stick with the one based on 
 Jetty 6, as there API differences (in particualr a complete rename of the 
 packages as far as I know). I'm not sure what the motivation for using Jetty 
 7 would be here (bugs?) nor what you'd want to configure via jetty.xml (as 
 what's used is effectively just the HTTP server library of Jetty, not Jetty 
 as a container).
 
 
 Best wishes,
 
 Bruno.
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2660271

Jerome,

The Restlet download page indicates that 1.1 is the preferred release for 
production use.  Has that changed yet?

Bruno,

I have a standalone Restlet server and I need to support HTTPS, so I'm using 
jetty.xml to configure the SSLSocketConnector.  I thought Jetty 7 was the 
current version but I don't know any reason why Jetty 6 won't work, so I'll 
probably just switch to that version for now.

Thanks,

Roy

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


RE: OPTIONS instead of GET with GWT

2010-09-16 Thread webpost
I solve the problem calling the external address of the servlet from the client 
side (i was using the internal address)

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


RE: Embedded Jetty

2010-09-14 Thread webpost
Please ignore.  Sorry for the duplicate post (and html tags).

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


RE: Embedded Jetty

2010-09-14 Thread webpost
Any help on this would be appreciated.

Roy

 I'm attempting to use Jetty 7.1.5 with Restlet 1.1.10 however there's no 
 connector jar included for this version of Jetty - only Jetty 6.1.  So, I'm 
 wondering is it possible to use Jetty 7?
 
 Also, I'm not sure where put jetty.xml so I can configure the server settings.
 
 Thanks,
 
 Roy

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


Getting Error 1002 for everything after a while

2010-09-13 Thread webpost
Hello,

I've created a few restlet apps now, and for some reason the last one gets 
garbled on a simple put of a simple class: 
---Client.java
@Entity
public class Client implements Serializable 
{
private static final long serialVersionUID = 1L;
@Id Long id;
String name = ;

public Client()
{
}

public Client(String name)
{
this.name = name;
}
}
--

I can do a couple of puts, but when I hit 6-7 puts it returns the 1002 Error 
and then that instance gets garbled in the database, because I get the same 
result when trying to get all the clients using this: 
-
@Get
public VectorClient getAllClients()
{
}
---

I am using the maven version of GAE and GWT restlet of 2.0.0. 

As a sidenote, if I delete the instance that gets garbled the get works fine. 

Is this a known issue?

Temporary test for this is also avaliable online here: 
http://customerdb.frojd.se, first press the new button a couple of times, use 
getall to fetch the data. 

I like Restlet a lot, but this really stumps me :/

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


Restlet Oauth

2010-09-13 Thread webpost
Hi,

I have put together a basic rest api with restlet and want to secure it with 
OAuth authentication.

Is there any example code out there ?

Do we use the restlet oauth ? Or some other tool

Many thanks

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


Embedded Jetty

2010-09-13 Thread webpost
I'm attempting to use Jetty 7.1.5 with Restlet 1.1.10 however there's no 
connector jar included for this version of Jetty - only Jetty 6.1.  So, I'm 
wondering is it possible to use Jetty 7?

Also, I'm not sure where put jetty.xml so I can configure the server settings.

Thanks,

Roy

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


RE: URLEncoded querystring params

2010-09-09 Thread webpost
 Hello Fraser,
 
 what kind of client are you using?
 Why don't you send /mbunittest/myflow?f​oo=foobar=bar​baz=baz?
 
 Best regards,
 Thierry Boileau

Hi Thierry,

Obviously my example is contrived to demonstrate the problem. In reality there 
may be occasions when I will need to send characters in the URL which would 
contravene RFC 1738.

Are you saying that Restlet cannot provide access to URL encoded params 
individually ??

Kind regards

Fraser

P.S. the client is enterprise middleware (think IBM ;-)

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


RE: Wiki down

2010-09-07 Thread webpost
Thanks Jerome!

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


JMS

2010-09-06 Thread webpost
Are there any plans to support JMS transport any time in the near future. Those 
of us using Restlet in Enterprise environments often require the use of 
asynchronous and highly reliable protocols ??

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


Error while parsing simple plain text fields in multipart form at Restlet 1.1

2010-09-06 Thread webpost
Hi everybody!
I have some troubles with parsing simple plain-text form fields in Restlet v1.1

The form looks like
form action=/restletServlet method=post enctype=multipart/form-data
  textarea name=simpleField rows=10 cols=100Simple text 
content/textarea
  input type=submit value=post
/form

I've tried to parse multipart request from my resource as in the example at 
http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/64-restlet.html page 
(with some simplification):


// 1/ Create a factory for disk-based file items
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(1000240);

// 2/ Create a new file upload handler
RestletFileUpload upload = new RestletFileUpload(factory);
try {
   upload.parseRequest(request);   // LINE X
} catch (FileUploadException e) {
   e.printStackTrace();
}

The following error occurs:

java.lang.NullPointerException
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976)
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
at java.io.InputStream.read(Unknown Source)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
at 
org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:592)
at 
org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:618)
at 
org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:637)
at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:984)
at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.init(FileUploadBase.java:965)
at 
org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
at 
org.restlet.ext.fileupload.RestletFileUpload.parseRequest(RestletFileUpload.java:104)
at myPackage.MyResource.myPostRepresentation(MyResource.java:LINE X)

Also, when I've tried pure Apache code instead of code above:


// Create a factory for disk-based file items
FileItemFactory factory1 = new DiskFileItemFactory();

// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory1);

try {
upload.parseRequest(ServletCall.getRequest(request));   // LINE X
} catch (FileUploadException e) {
e.printStackTrace();
}


, I have following error:

org.apache.commons.fileupload.FileUploadException: Stream closed
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:385)
at 
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at myPackage.MyResource.myPostRepresentation(MyResource.java:LINE X)
...
Caused by: java.io.IOException: Stream closed
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:325)
at 
org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:193)
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976)
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
at java.io.InputStream.read(Unknown Source)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
at 
org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:592)
at 
org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:618)
at 
org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:637)
at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:984)
at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.init(FileUploadBase.java:965)
at 
org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
... 54 more
Caused by:
java.io.IOException: Stream closed
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:325)
at 
org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:193)
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976)
at 
org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
at java.io.InputStream.read(Unknown Source)
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
 

  1   2   3   4   5   6   >