Vincent Ricard | 20 Aug 10:42

[RFE] LogFilter.afterHandle

Hi,

I read LogFilter.afterHanfle() and wondered if these 2 modifications would
be better (from a performance point of view):
- put the whole block into a "if (this.logLogger.isLoggable(Level.INFO))
{...}"
- compute the duration only if needed.

Regards,
--

-- 
Vincent Ricard

Jerome Louvel | 19 Aug 18:51

Restlet 1.2 roadmap

Hi all,
 
Now that version 1.1 RC1 is out, we are entering a phase of bug fixing before the final release. This gives us time to look above and beyond, to our next endeavors!
 
We want to release a 1.2 version that will be an evolution, still based on Java SE 5.0. It will be compatible with Restlet 1.1 but not directly with 1.0 as we will remove all previously deprecated code. We are expecting a development cycle of about a year with the following main features:
 
1) Enhanced Eclipse support
 
We want to lower the barrier of entry to the Restlet world for new users and facilitate the upgrade to newer versions. As Eclipse is probably the most widely used IDE and as we already have a somewhat hidden but nice OSGi bundle support,  we want to go to the next step and add the following features:
  • Full OSGi distribution (compatible with Eclipse Equinox and Apache Felix)
  • Update site to allow installation and upgrade from Eclipse
  • Code wizards for Component, Application and Resource subclass creation
2) Embracing the Semantic Web
 
Here at Noelios Technologies, we strongly believe in the capacities of the Semantic Web and think that REST is a perfect spring bed for it to reach a wider developer audience. Like REST, the Semantic Web leverages the resource-oriented paradigm to express meaningful relations:
  • New org.restlet.relation core package
  • Support collections of resources
  • RDF serialization and parsing
  • URN dispatching support
  • SPARQL extension
3) Enhanced HTTP support
 
As HTTP is really at the core of REST, we want to continue increasing our coverage of its semantics in the Restlet API:
  • Full caching support
  • Multi-part representations
  • Proxies configuration support
  • WebDAV extension
4) Security refactoring
 
The Guard class has received many requests for enhancements. In Restlet 1.1, we introduced a level of authentication pluggability at the Engine level and added support for HTTP Digest, but the current single Guard approach started to show some limitations.
  • New org.restlet.security package
  • New Authenticator and Authorizer classes to separate those concerns from Guard
  • HtpasswdAuthenticator to support Apache htpasswd files
  • JAAS integration
  • OpenID support
5) Better and faster connectors
 
With the addition of the Grizzly connector in 1.1, we were first able to leverage the power of NIO from the Restlet API. We want to continue on this NIO path in 1.2:
  • Client Grizzly connector
  • Asynchronous request processing
  • Upgrade Simple connector to new NIO-based 4.0 version
  • Reintroduce AsyncWeb connector via support for MINA NIO framework 2.0
  • Persistent connections in internal HTTP connectors
6) Miscellaneous
 
Beyond the main priorities above, there are many other important features that we want to add as well:
  • Documentation (final release of Restlet book, wiki published as user manual)
  • Move com.noelios.restlet engine classes into hidden org.restlet.engine package (single JAR)
  • Client-side resources (same Resource class)
  • JAX-RS client side support
  • JCR client connector (Java Content Repository)
  • JDBC client connector (Database resources)
  • Google Android support
  • Google Guice support
  • Google Web Toolkit port enhancements (HTTP Basic authentication)
  • Red5 server connector to serve Flash video (RTMPT, MINA-based)
  • Oracle XDB enhancements
After 1.2, we will then upgrade to a 2.0 version where we will have more freedom to innovate at the API level. We are still hoping to retain most API compatibility with 1.x, but we might more aggressively deprecate code if we need to. The 2.x branch will be based on Java SE 6.0.
 
For a more detailed roadmap, you can always check the official page at http://www.restlet.org/about/roadmap and browse the listed issues that were updated to reflect the plan above.
 
If you see a feature you would love to help us with, please jump in and contribute your time and energy to make it happen sooner. If you don't have enough time to share, your company can also help us by funding the development of some features. See our co-development offer at:
 
Finally, nothing is written in stone, so please express yourself, we are looking forward to your feed-back!
 
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 
Jerome Louvel | 19 Aug 18:51

Restlet 1.1 RC1 released

Hi all,

It's been about two weeks since 1.1 M5 was released and we have already made tremendous progress. We are happy to release 1.1 RC1. Most serious bugs were fixed (more than 10) and all pending features where completed.

Here is a summary of main changes:

  • Chunked encoding issues in Grizzly and internal connectors were all fixed. Extensive tests with large entities done (size of 30 Mb).
  • Grizzly was updated to version 1.8.4 and has reached a much more stable state. It gives unparalleled performance for serving static files thanks to direct NIO transfer from file to socket!
  • Performance of internal HTTP connectors was vastly improved, coming close to other connectors in term of throughput for large entities (scalability not tested). It is the easiest choice for development purpose.
  • Significant improvements and stabilization made for the WADL extension.
  • Major refactoring of logging to have more consistency and a better organization for logger names. Updated the logging documentation on the wiki to facilitate usage. Added a TraceHandler to display the logger names of all log records in the console to simplify configuration, especially for third party libraries.
  • Completed support for partial GETs and partial PUTs in the FILE client connector.
  • Completed support for representation digests (MD5 and more).
Direct contributors:
  • Avi Flax
  • Benoit Maujean
  • Brad Peabody
  • Bruno Dumon
  • Bruno Harbulot
  • Chris Winters
  • François Renard
  • Guillaume Chatelet
  • Kevin Conaway
  • Mike Brzozowski
  • Niptin Gupta
  • Rhett Sutphin
  • Rob Heittman
  • Ralf Bommersbach
  • Vincent Ricard
  • Zsolt Czinkos
Changes log:
http://www.restlet.org/documentation/1.1/changes

Download links:
http://www.restlet.org/downloads/1.1/restlet-1.1rc1.zip
http://www.restlet.org/downloads/1.1/restlet-1.1rc1.exe

Maven repositories:
http://maven.restlet.org is updated on the 1st and 15th of each month
http://maven.noelios.com is updated daily with new artifacts (access reserved to subscribers)

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
Zsolt Czinkos | 19 Aug 17:51

PUT problem with restlet client

Hello

I'd like to send HTTP 412 (precondition faild) status to client. It
works when I test it from curl (even if repeated a hundred times).
When I test is from a junit test using the restlet client, the test fails:

-------
java.lang.AssertionError: expected:<Precondition Failed (412) - The
precondition given in one or more of the request header fields
evaluated to false when it was tested on the server> but
was:<Communication Error (1001) - Software caused connection abort:
socket write error>
	at org.junit.Assert.fail(Assert.java:74)
	at org.junit.Assert.failNotEquals(Assert.java:448)
	at org.junit.Assert.assertEquals(Assert.java:102)
	at org.junit.Assert.assertEquals(Assert.java:117)
	at hu.zakk.atom.server.TestResourceTest.testPut(TestResourceTest.java:30)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
	at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
	at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
	at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
	at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
	at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
	at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
-----

According to the server log, everything is ok, 412 status sent:

2008.08.19. 17:43:44 com.noelios.restlet.LogFilter afterHandle
INFO: 2008-08-19	17:43:44	127.0.0.1	-	127.0.0.1	8182	PUT	/test/	-	412	391	-	0	http://localhost:8182	Noelios-Restlet-Engine/1.1.snapshot	-

When I use smaller file to test, it seems to work, but occasionally it
fails. If I increase the of the file above 64k, it seems to fail every
time.

See the java classes below. I use the restlet snapshot from maven repo
with jetty.

Probably a client issue?

Thanks

Zsolt

--------------------------------
The resource class:

package hu.zakk.test;

import java.util.List;
import java.util.logging.Logger;

import org.restlet.Context;
import org.restlet.data.MediaType;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.data.Status;
import org.restlet.data.Tag;
import org.restlet.resource.Representation;
import org.restlet.resource.Resource;
import org.restlet.resource.ResourceException;
import org.restlet.resource.Variant;

public class TestResource extends Resource {

  private Logger log;

  public TestResource(Context context, Request request, Response response) {
    super(context, request, response);
    getVariants().add(new Variant(MediaType.ALL));
    log = getLogger();
  }

  @Override
  public void storeRepresentation(Representation entity)
      throws ResourceException {

      String tag = "fake";
      List<Tag> match = getRequest().getConditions().getMatch();
      Tag etag = match.isEmpty() ? null : match.get(0);
      if (etag == null || !etag.toString().equals(tag)) {
        log.info("precondition failed");
        getResponse().setStatus(Status.CLIENT_ERROR_PRECONDITION_FAILED);
        return;
      }
      log.info("NEVER HIT THIS");
  }

  @Override
  public boolean allowPut() {
    return true;
  }
}

-----------------------

The test:

package hu.zakk.test;

import static org.junit.Assert.assertEquals;

import java.io.ByteArrayInputStream;

import org.junit.Test;
import org.restlet.Client;
import org.restlet.data.MediaType;
import org.restlet.data.Protocol;
import org.restlet.data.Response;
import org.restlet.data.Status;
import org.restlet.resource.InputRepresentation;

public class TestResourceTest {

  @Test
  public void testPut() {
    // play with size
    int size = (int) Math.pow(2, 15) + 1;
    byte[] buf = new byte[size];
    for (int i = 0; i < size; i++) {
      buf[i] = 1;
    }

    ByteArrayInputStream bain = new ByteArrayInputStream(buf);

    Client client = new Client(Protocol.HTTP);
    Response putResponse = client.put("http://localhost:8182/test/",
        new InputRepresentation(bain, MediaType.TEXT_PLAIN));
    assertEquals(Status.CLIENT_ERROR_PRECONDITION_FAILED,
putResponse.getStatus());
  }

}

Roman Geus | 19 Aug 17:38

Routing in Restlet JAX-RS applications

Hallo all

I'm using restlet 1.1-m5 and I have a problem with routing http requests 
to JAX-RS  resource methods:

My resource class looks as follows:

@Path("admin")
public class RestAdminServiceResource {

    /**
     * Provides both static and dynamic, per-request information, about the
     * components of a request URI.
     */
    @Context
    UriInfo uriInfo;

    @GET
    @Produces("text/html")
    public Response root() {
        ...
    }

    @GET
    @Path("{project}")
    @Produces("text/html")
    public Response project(@PathParam("project") String project) {
        ...
    }

    @GET
    @Path("{project}/{repository}")
    @Produces("text/html")
    public Response repository(@PathParam("project") String project,
            @PathParam("repository") String repository) {
        ...
    }

    @GET
    @Path("{project}/{repository}/schema")
    @Produces("text/html")
    public Response schemaDir(@PathParam("project") String project,
            @PathParam("repository") String repository) {
        ...
    }

    @GET
    @Path("{project}/{repository}/schema/{schema}")
    @Produces("text/html")
    public Response schema(@PathParam("project") String project,
            @PathParam("repository") String repository,
            @PathParam("schema") String schema) {
        ...
    }

}

The following requests are routed as expected:

http://host/admin
http://host/admin/PRJ
http://host/admin/PRJ/REPO

However requests containing the "schema" path segment are all routed to 
the repository method, instead of the schemaDir and schema method:

http://host/admin/PRJ/REPO/schema
http://host/admin/PRJ/REPO/schema/SCM

Is this working as intended? If yes, how can I implement resources for 
{project}/{repository}/schema and {project}/{repository}/schema/{schema}.

Thanks,
Roman

Story Henry | 19 Aug 12:57

openid?

Anyone here know of good openid libraries? Perhaps one using RESTlets.

	Henry

Home page: http://bblfish.net/

Attachment (smime.p7s): application/pkcs7-signature, 2429 bytes
Christy Ring | 19 Aug 09:45

Virtual hosts - no domain only ip address

Hi all,

I am running a VM on a host, currently I have a work example that is  
routing requests to a resource at https://localhost:8183/jbox/v1/

The virtual machine can see the host through the following ip address  
192.168.0.2

 From the VM when I send a request to the resource https://192.168.0.2:8183/jbox/v1/ 
  I get the following:

com.vennetics.jbox.fs.api.v1.WidgetApplication1047055737)[WARNING| 
Thread-2|8:35:58.0959]: A resource should normally have at least one  
variant added by calling getVariants().add() in the constructor. Check  
your resource "https://192.168.0.2:8183/jbox/v1/".

org.restlet.Component (1524987604)[INFO|Thread-2|8:35:58.0968]:  
2008-08-19	08:35:58	127.0.0.1	-	-	8183	GET	/jbox/v1/	-	404	3310	https://192.168.0.2:8183 
	Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2)	-

I expect this to work by defining a VirtualHost, even though I have no  
domain defined.  I have defined my VirtualHost as follows:

I have also tried setting the server address directly.

	    VirtualHost host = new VirtualHost(component.getContext());
	    host.setHostDomain("192.168.0.2|localhost");
	    host.setServerAddress("192.168.0.2");
	    host.setHostPort("8183");
	    host.attach("/jbox/v1", new  
com.vennetics.jbox.fs.api.v1.WidgetApplication());
	    component.getHosts().add(host)

Any ideas much appreciated,
Thanks in advance.

Christy Ring
christy.ring <at> vennetics.com

Asim | 19 Aug 09:19

Multipart Restlet Request

Hi all,

In the development of a feature, there was a requirement to pass multipart 
restlet request, consisting of two things –

XML data providing the details of event
Upload Audio file which has to be attached with the event 

But when I am trying to do this simultaneously i.e. pass XML data and upload 
file in a single request, I am getting following error – 

Exception java.lang.IllegalStateException: The Web form cannot be parsed as no 
fresh content is available. If this entity has been already read once, caching 
of the entity is required

This signifies that both XML data and upload file can’t be processed in a 
single request. When tested independently, both are working fine. What can be 
a solution to this problem?

Thanks in advance 

Regards,
Asim

Patrick Logan | 19 Aug 02:21

1.1m5 automatic static file redirects

I have a static Directory routed to "http://someurl"

In 1.1m4 a client could do a GET to either this URL or the URL with a
"/" appended, and the static index.html file would be returned.

I moved up to 1.1m5 over the weekend and my tests indicate a redirect
to the client now occurs for "http://someurl" to the URL with a "/"
appended.

This does not seem like a really big deal, but if most requests are to
the shorter URL, then each will incur a redirect.

Is there a reason for this new behavior?

Thanks
-Patrick

Stephan Koops | 18 Aug 15:28

Re: JSON Set with JAXRS

Hi Sanjay,

(see 
http://restlet.tigris.org/servlets/BrowseList?list=discuss&by=thread&from=671405)

you are right, the support for JSON is not realy ready in this 
implementation. For now I put the returned object into an 
org.json.JSONObject and its serialization is used. But the results are 
not good IMO: It calls every getter including Object.getClass(), which 
is not very useful. I've planned to use another JSON deserialization, 
but don't know in this moment, which one. - Jersey does it realy good 
and contains a JAXB provider, which creates JSON instead of XML. Perhaps 
we could adopt this way.

If someone wants to contribute, I'm open for help ... Sanjay, would you 
share your message body writer? See also 
http://www.restlet.org/community/contribute

best regards
   Stephan

Martin Pike | 18 Aug 14:50

Support for FTP in Restlet

I am looking to use Restlet Client to connect to different sets of 
resources, including FTP repositories, but I could not see FTP supported 
in any of the available connectors. Has anyone used Restlet with FTP?

Regards,

Martin Pike


Gmane