Hi Allan,
Thanks for the report. We had other persons reported similar issues with
HTTPS:
https://github.com/restlet/restlet-framework-java/issues/702
We'll investigate and try to fix this issue week, before releasing 2.1.2
and 2.2 M2.
Thanks,
Jerome
--
http://restlet.com
http://twitter.com/#!/jlouvel
2013/1/31 Allan Taschini satto...@gmail.com
I'm trying to create a client-server application in Java using HTTPS and
XML posts with Restlet.
I've followed various tutorials, and managed to run the server side
without problems (it responds correctly if I connect to it with a browser),
but as soon I start the client they both freeze: the client doesn't
complete its request and the server doesn't respond to browser requests
anymore.
Right now I'm using version 2.2 Milestone 1, but I also tried with version
2.1.1 with no success. I'm using Eclipse Juno on MacOSX 10.7.5. The two
stores have been created using the keytool command (I've created
serverKey.jks, exported a self-signed certificate and added it to
clientTrust.jks).
The jars that I originally included were:
org.restlet
org.jssl.utils
org.restlet.ext.ssl
But I also tried to add the specific connecters (separately, with the
dependencies listed in the libs readme.txt):
org.restlet.ext.httpclient.jar
org.restlet.ext.jetty.jar
org.restlet.ext.net.jar
org.restlet.ext.simple.jar
TestHTTPS class
--
public class TestHTTPS extends Application{
public static void main(String[] args) throws Exception{
TestHTTPS t = new TestHTTPS();
t.testhttps();
}
public void testhttps() throws Exception{
Component comp = new Component();
Server server = comp.getServers().add(Protocol.HTTPS, 8183);
SeriesParameter servParameters =
server.getContext().getParameters();
servParameters.add(keystorePath, serverKey.jks);
servParameters.add(keystorePassword, password);
servParameters.add(keystoreType, JKS);
servParameters.add(keyPassword, password);
servParameters.add(tracing, true);
comp.getDefaultHost().attach(new TestHTTPS());
server.start();
Context con = new Context();
SeriesParameter clParameters = con.getParameters();
clParameters.add(truststorePath, clientTrust.jks);
clParameters.add(truststoreType, JKS);
clParameters.add(truststorePassword, password);
Client restletClient = new Client(con, Protocol.HTTPS);
Reference resourceRef = new Reference(
https://localhost:8183/user/myself;);
Request request = new Request(Method.POST, resourceRef);
request.getClientInfo().getAcceptedMediaTypes().add(new
PreferenceMediaType(MediaType.TEXT_XML));
Response response = restletClient.handle(request);
System.out.println(response.getEntityAsText());
restletClient.stop();
server.stop();
}
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach(/user/{id}, UserResource.class);
return router;
}
}
UserResource class
public class UserResource extends ServerResource {
@Post(xml)
public Representation sendPostResponse(){
return new StringRepresentation(Documentcontent/Document,
MediaType.APPLICATION_XML);
}
@Get(xml)
public Representation sendGetResponse(){
return new StringRepresentation(Documentcontent/Document,
MediaType.APPLICATION_XML);
}
}
The only output from the console is:
Starting the internal [HTTPS/1.1] server on port 8183
Starting the internal [HTTPS/1.1] client
Am I doing something wrong?
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3046970
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3048294