RE: HTML Email

2009-07-09 Thread webpost
Hi Jerome...

I've actually traced this down to a bug in the JavaMail extension.   

com.noelios.restlet.ext.javamail.RepresentationMessage constructs a MimeMessage 
out of the XML doc.   When doing so, it calls setText(text) in order to set the 
body.   If you look at MimeMessage.setText(String text);, it states:

Convenience method that sets the given String as this part's content, with a 
MIME type of text/plain.

So...as a result, email is always going out as plaintext.   I've patched my 
local version of 1.1.5 to use setContent, and pull the mime type from the 
representation:

setContent(text, xmlMessage.getMediaType().toString());


Seems to work.   

thanks

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


RE: Need help with S3App.java example, from RESTful Web Services (O'Reilly)

2009-07-09 Thread webpost
Jerome Louvel,

Thank you very much for the help! As suggested, I signed up for the S3 account. 
After executing code again, this time I received a response code of 200 (OK). 
I was initially hesitant to sign-up for S3 account; because, it required credit 
card info. Was not going to do so until I was able to confirm it was absolutely 
necessary.

Cheers  thanks again,
woodHack

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


Jetty integration help

2009-07-09 Thread Tony Bigbee
I'm trying to use Jetty with a 2.0m3 stand alone application but am struggling 
despite having read a lot of documentation and web searching.  I extend a 
ServerResource and have the Jetty jars in my runtime path, but Restlet's 
internal http server is always started with whatever server/component I 
specify.  I want to use a ServerResource instead of the Restlet class and 
therefore can't seem to use any of the Server constructors (that require a 
Restlet instance) and thus the Jetty helper.

I would appreciate guidance and/or concrete example given the context below. 
Thank you.  

Jul 7, 2009 12:44:01 PM org.restlet.engine.http.StreamServerHelper start
INFO: Starting the internal HTTP server

public class TestComponent extends ServerResource() {

public static void main(String[] args) throws Exception {
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getDefaultHost().attach(/testing, TestComponent.class);
component.start();

@Get
public String represent() {
return testing successful.
}
}

Tony

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


Jetty integration

2009-07-09 Thread webpost
Hi,

I'm struggling to understand how to use Jetty as my http server with Restlets 
2.0m3 (not as a servlet).  I've read through as much documentation as I can 
find and also searched for examples, but I can't seem to find a simple concrete 
example for having a ServerResource class receive requests via Jetty.   The log 
output always indicates that I am starting Restlet's internal http server:  
Jul 7, 2009 12:44:01 PM org.restlet.engine.http.StreamServerHelper start
INFO: Starting the internal HTTP server


In the app's, main(), I do:
Component component = new Component(); 
component.getServers().add(Protocol.HTTP, 8182);   
component.getDefaultHost().attach(/testing, TestComponent.class);
component.start();

TestComponent is a class that extends ServerResource and has one method with 
@Get annotated.

The Jetty jars are in my runtime classpath.

Any pointers appreciated. Thanks.

Tony

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


GAE + GWT + Restlet 2.0 M3 + challenge response is null on server side

2009-07-09 Thread webpost
Hi,

I'm simply trying to implement really simple authentication mechanism using 
HTTP_BASIC.

In GWT client I do the following:

final Request request = new Request(getMethod(), GWT.getModuleBaseURL() + _url);
ChallengeResponse challengeResponse = new 
ChallengeResponse(ChallengeScheme.HTTP_BASIC, _email, _password);
request.setChallengeResponse(challengeResponse);
final Client client = new Client(PROTOCOL);
client.handle(request, _callback);

However, in my ServerResource class the getRequest().getChallengeResponse() 
always returns null.

So, am I missing something here or should this work like that?

Thanks,
Lauri

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


Re: HTML Email

2009-07-09 Thread Rémi Dewitte
Hello,

One of my colleague has done a patch to the actual Javamail extension to be
able to send multipart and thus html message.
I should be able to provide the patch if you want...

Cheers,
Rémi

On Wed, Jul 8, 2009 at 23:31, webp...@tigris.org wrote:

 Hi Jerome...

 I've actually traced this down to a bug in the JavaMail extension.

 com.noelios.restlet.ext.javamail.RepresentationMessage constructs a
 MimeMessage out of the XML doc.   When doing so, it calls setText(text) in
 order to set the body.   If you look at MimeMessage.setText(String text);,
 it states:

 Convenience method that sets the given String as this part's content, with
 a MIME type of text/plain.

 So...as a result, email is always going out as plaintext.   I've patched my
 local version of 1.1.5 to use setContent, and pull the mime type from the
 representation:

setContent(text, xmlMessage.getMediaType().toString());


 Seems to work.

 thanks

 --

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


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

FileClientHelper

2009-07-09 Thread Rémi Dewitte
Hello,

With last trunk code, I would like the FILE client helper NOT to find
test.xml.001.bak when I ask for test.xml, how can I achieve this ?

Thanks,
Rémi

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

Re: FileClientHelper

2009-07-09 Thread Rémi Dewitte
Hello,

Actually found a solution/hack, at application startup :
getMetadataService().addExtension(bak,
MediaType.valueOf(application/backup));

I am not sure it is the normal behavior...

Rémi

2009/7/9 Rémi Dewitte r...@gide.net

 Hello,

 With last trunk code, I would like the FILE client helper NOT to find
 test.xml.001.bak when I ask for test.xml, how can I achieve this ?

 Thanks,
 Rémi


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