(hopefully) silly question about HTTPS

2007-06-20 Thread Bjørn Remseth

Hi.

I wish to set up a server handling incoming requests over HTTPS.
I assume I have to put a (self-signed) certificate somewhere to get started,
but I can't find any obvious reference to how I should do this in the
documentation or elsewhere on the web.

Can you help me?

I sincerely hope I have missed something obvious :-)


--
(Rmz)


Re: Conditional GETs?

2007-06-20 Thread Peter Lacey

Jerome,

Here's another variant of the same issue.  If the server wants to return 
a 204 (No Content), then #getRepresentation() is still called.  Does it 
make sense to optimize this out of the way so that the status can be set 
in the constructor and Restlet takes care of doing the right thing, or 
should the status be set by the developer in #getRepresentation() and 
null returned?


Pete

Jerome Louvel wrote:

Hi all,

This RFE is now fixed in SVN trunk and will be testable in the upcoming 1.1
snapshot. Great optimization, thanks Stian for the idea.

Best regards,
Jerome  


-Message d'origine-
De : Jerome Louvel [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 12 juin 2007 08:55

À : discuss@restlet.tigris.org
Objet : Re: Conditional GETs?

Hi Adam,

There is already a "tag" property on the Variant class that you can 
already use. In 1.1, we will simply use this property earlier in the 
algorithm to not call getRepresentation(Variant) when not necessary.


Best regards,
Jerome


Adam Taft a écrit :

By the way, I love the suggestion.

Can't you add getTag() (or some method) sooner rather than 
later?  The 
default implementation would simply return NULL which would 
then force 
the algorithm to call getRepresentation() just like it 

currently does.

There should be no consequence of this in 1.0.x code?

Just curious.

Adam


Jerome Louvel wrote:

Hi Stian,

We haven't forgotten about your suggestion, just dealing 
with a long 

email
backlog :)
It is perfectly possible to optimize the internal algorithm so that
getRepresentation(Variant) is never called when the variant's tag 
matches

the one provided by the client.

I've entered a RFE to keep track of it:
http://restlet.tigris.org/issues/show_bug.cgi?id=319

As it changes the observed behavior a bit, it should only go in 
Restlet 1.1,

IMHO.

Best regards,
Jerome 

-Message d'origine-
De : Stian Soiland [mailto:[EMAIL PROTECTED] Envoyé 
: mercredi 

6 juin 2007 11:23
À : discuss@restlet.tigris.org
Objet : Re: Conditional GETs?


On 4 Jun 2007, at 15:53, Peter Lacey wrote:


public Representation getRepresentation(Variant variant) {
Representation result = null;

if 

(variant.getMediaType().equals(MediaType.APPLICATION_XML)) {

// create DOM

result = new 
DomRepresentation(MediaType.APPLICATION_XML,  

doc);
result.setTag(new Tag([your etag], false));
}
return result;
}
It's really clever, except you still have to create that XML  
representation that never needs to be sent out.


If there was some getTag() method or something you could 
override  
this to check directly with the database on whatever you need to  
calculate the tag, and hence getRepresentation() wouldn't 
even need  

to be called.

To support this I think some kind of getLastModified() would also 
be  cool. (I've made such a thing in my subclass of Resource)


--
Stian Soiland, myGrid team
School of Computer Science
The University of Manchester
http://www.cs.man.ac.uk/~ssoiland/





Usage ox JaxbRepresentation in restlet 1.1 beta

2007-06-20 Thread Evgeny Shepelyuk
Hello
Please can someone give the examples of usign the JaxbRepresentation.
I'm using following code.
 
new Server(Protocol.HTTP, 8182, new Restlet() {
  @Override
  public void handle(Request request, Response response) {
response.setEntity(new JaxbRepresentation(MediaType.TEXT_PLAIN, 
"mypackage", new MyObject()));
  }
}).start();
 
and got exception when getting JAXBContext from map of contexts.
Seems i shoud initize that map in some way.
But only place where smth is pun into contexts map is getSource() method in 
JaxbRepresentation
 
@Override
public Source getSource() throws IOException {
try {
return new JAXBSource(getContext(), getObject());
} catch (JAXBException e) {
throw new IOException(
"JAXBException while creating the JAXBSource: "
+ e.getMessage());
}
}
 
So should i call this manually ?
Or most probably i'm missing some point in this.
 
Another issue is that JaxbRepresentaion is always procucing formatted output.
But frequently it's not needed because XML is produced only for automatic 
parsing
and formatted output increases its size.
Can this be made in some configurable way ?
 
--
Best Regards
Evgeny K. Shepelyuk


Re: (hopefully) silly question about HTTPS

2007-06-20 Thread Thierry Boileau

Hello Bjørn,

this is not a silly question, it seems that this point is not well 
documented.

Only 2 server connectors provides HTTPS support: Jetty and Simple [0].
The available parameters are described here [1] for Jetty and here [2] 
for Simple.


Please have a look to this link [3] in order to set up your keystore and 
here is a sample code showing how to configure some parameters of your 
component:



component.getContext().getParameters().add("keystorePath",keystoreFile.toURI().toASCIIString());
component.getContext().getParameters().add("keystorePassword", 
"your-password");
component.getContext().getParameters().add("keyPassword", 
"your-password");
component.getServers().add(Protocol.HTTPS, 8182);



I hope this will help you.

Best regards,
Thierry Boileau
[0] http://www.restlet.org/documentation/1.0/connectors
[1] 
http://www.restlet.org/documentation/1.0/ext/com/noelios/restlet/ext/jetty/HttpsServerHelper.html
[2] 
http://www.restlet.org/documentation/1.0/ext/com/noelios/restlet/ext/simple/HttpsServerHelper.html

[3] http://docs.codehaus.org/display/JETTY/How+to+configure+SSL

Hi.

I wish to set up a server handling incoming requests over HTTPS.
I assume I have to put a (self-signed) certificate somewhere to get 
started,

but I can't find any obvious reference to how I should do this in the
documentation or elsewhere on the web.

Can you help me?

I sincerely hope I have missed something obvious :-)


--
(Rmz)



Re: (hopefully) silly question about HTTPS

2007-06-20 Thread Thierry Boileau

Bjørn,

if you plan to use the Jetty connector, as it seems that this connector 
is still a beta release, the Restlet Jetty connector will use the Basic 
IO in SSL mode by default (see

http://restlet.tigris.org/issues/show_bug.cgi?id=250) and not the NIO.

Best regards,
Thierry Boileau




Hello Bjørn,

this is not a silly question, it seems that this point is not well 
documented.

Only 2 server connectors provides HTTPS support: Jetty and Simple [0].
The available parameters are described here [1] for Jetty and here [2] 
for Simple.


Please have a look to this link [3] in order to set up your keystore 
and here is a sample code showing how to configure some parameters of 
your component:


component.getContext().getParameters().add("keystorePath",keystoreFile.toURI().toASCIIString()); 

component.getContext().getParameters().add("keystorePassword", 
"your-password");
component.getContext().getParameters().add("keyPassword", 
"your-password");

component.getServers().add(Protocol.HTTPS, 8182);



I hope this will help you.

Best regards,
Thierry Boileau
[0] http://www.restlet.org/documentation/1.0/connectors
[1] 
http://www.restlet.org/documentation/1.0/ext/com/noelios/restlet/ext/jetty/HttpsServerHelper.html 

[2] 
http://www.restlet.org/documentation/1.0/ext/com/noelios/restlet/ext/simple/HttpsServerHelper.html 


[3] http://docs.codehaus.org/display/JETTY/How+to+configure+SSL

Hi.

I wish to set up a server handling incoming requests over HTTPS.
I assume I have to put a (self-signed) certificate somewhere to get 
started,

but I can't find any obvious reference to how I should do this in the
documentation or elsewhere on the web.

Can you help me?

I sincerely hope I have missed something obvious :-)


--
(Rmz)