Hello Fabian,

can you tell us what kind of client generates the request?
On my side, I've tested with Firefox and created a file having the same 
name as yours.
I've tried to access it via a Directory and a Restlet instance that 
decodes the "langOrFile" attribute (according to the defined route). It 
just works.

I may add that you can ask the router to put the decoded value inside 
the request's attributes :
TemplateRoute route = 
component.getDefaultHost().attach("/test/{langOrFile}", restlet);
Variable var = new Variable();
var.setDecodingOnParse(true);
route.getTemplate().getVariables().put("langOrFile", var);

Best regards,
Thierry Boileau


> Hello there,
>
> I'm having some problems (Restlet 2.0snapshot from mid-February 2010)
> with resource references encoding. Concretely, my app supports DAV
> access to some resources, I'm currently testing with XXE (an XML
> editor with a dav plugin) and with Microsoft XP's 'web folders'
> (dav-enabled folders, surprisingly not available in Windows Vista and
> Windows 7... but that's another story).
>
> The resource is named "/workspaces/W1/content/Sin título.xml". Notice
> the space and the i acute, FYI "Sin título" is Spanish for Untitled,
> and it's the default name XXE gives to untitled files (I'm sure other
> editing tools do the same, I'm not blaming the IMVHO excellent XXE
> here at all). Now, here's what the URI looks like in a GET request (to
> open the file):
>
> Mar 10, 2010 11:33:07 AM
> com.calenco.resource.workspace.AbstractContentResource init
> INFO: langOrFile (before): Sin%20t%C3%83%C2%ADtulo.xml
> Mar 10, 2010 11:33:07 AM
> com.calenco.resource.workspace.AbstractContentResource init
> INFO: langOrFile (after) : Sin título.xml
> Mar 10, 2010 11:33:07 AM org.restlet.engine.log.LogFilter afterHandle
> INFO: 2010-03-10      11:33:07        127.0.0.1       admi...@calenco.com     
> -       9000    GET     /workspaces/W1/content/Sin%20t%C3%83%C2%ADtulo.xml    
>   -       404     353     0       29      http://localhost:9000   
> Java/1.6.0_15   -
>
> The langOrFile 'variable' is the one the router matched for the URI in
> question and correctly dispatched to the resource handler, I've
> printed it for debugging this annoying behaviour (HTTP 404 because the
> file name is not properly decoded). The resource's code excerpt is:
>
> langOrFile = 
> Reference.decode((String)getRequestAttributes().get("langOrFile"));
> // NOI18N
>
> The (before) line in the log above is of course before this call, the
> 'raw' request stuff; and (after) is just after running the
> Reference.decode().
>
> Now, MS DAV client gives this trying to access the same file:
>
> Mar 10, 2010 11:37:52 AM
> com.calenco.resource.workspace.AbstractContentResource init
> INFO: langOrFile (before): Sin%20t%EDtulo.xml
> Mar 10, 2010 11:37:52 AM
> com.calenco.resource.workspace.AbstractContentResource init
> INFO: langOrFile (after) : Sin t�tulo.xml
> Mar 10, 2010 11:37:52 AM org.restlet.engine.log.LogFilter afterHandle
> INFO: 2010-03-10      11:37:52        192.168.1.10    admi...@calenco.com     
> -       9000    GET     /workspaces/W1/content/Sin%20t%EDtulo.xml
> -       404   352     0       9       http://192.168.1.10:9000        
> Microsoft Data Access
> Internet Publishing Provider DAV 1.1  -
>
> You can clearly see that both clients are encoding the resource
> reference in a different way, though they both pretend to access the
> same resource.
> Is there a reliable way to pass parameters to Reference.decode() so
> both requests URI get the same 'Sin título.xml' decoded string? I've
> tried passing CharSet.DEFAULT and CharSet.UTF-8, but both throw null
> pointer exceptions.
>
> Thanks in advance for your help.
>
>

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

Reply via email to