Sure. In the meantime is it possible to use the file protocol with a path 
relative to the context path or something along those lines?

Paul Morris

On Jan 7, 2013, at 2:54 PM, "Jerome Louvel" 
<jlou...@restlet.com<mailto:jlou...@restlet.com>> wrote:

FW: I'm resending this email from 01/04 due to an email gateway error
--

Hi Paul,

You have reached a limitation of the CLAP pseudo-protocol which isn't suitable 
to list the content of a directory and therefore do any sort of content 
negotiation.

We could automatically append the indexName to a directory URI to try to 
prevent the 404 or need to hardcode the URI as you have to do though.

Would you mind entering an issue in GitHub?

Thanks,
Jerome
--
http://restlet.com<http://restlet.com/>
http://twitter.com/#!/jlouvel


2013/1/4 Paul Morris <pmor...@nmh.org<mailto:pmor...@nmh.org>>
Hi there-

Here's what I'm trying to do:

Redirect GET calls to root to a static directory with an index.html file in it. 
I thought I could redirect to the folder containing the index.html and then use 
the setIndexName of Directory to serve up the index.html file once the user 
gets redirected to the parent folder but it's not working that way. Here's what 
I have right now:

    <bean id="componentChildContext" class="org.restlet.Context">
        <lookup-method name="createChildContext" bean="component.context" />
        <property name="clientDispatcher">
            <bean class="org.restlet.Client">
                <constructor-arg name="protocolName" value="clap" />
            </bean>
        </property>
    </bean>

    <bean id="docsRedirector" class="org.restlet.routing.Redirector">
        <constructor-arg name="context" ref="componentChildContext" />
        <constructor-arg name="targetPattern" value="{rbi}docs/index.html" />
        <constructor-arg name="mode">
            <bean id="org.restlet.routing.Redirector.MODE_CLIENT_SEE_OTHER"
                
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
        </constructor-arg>
    </bean>

    <bean id="docsDir" class="org.restlet.resource.Directory">
        <constructor-arg name="context" ref="componentChildContext" />
        <constructor-arg name="rootUri" value="clap:///docs/" />
        <property name="indexName" value="index" />
    </bean>

    <bean id="router" class="org.restlet.ext.spring.SpringRouter">
        <!-- Remember there is a "/<root>" portion of the URI appended by the 
web container as context. -->
        <property name="attachments">
            <map>
                <entry key="/" value-ref="docsRedirector" />
                <entry key="/docs/" value-ref="docsDir" />
            </map>
        </property>
    </bean>

This actually works because I am redirecting to the actually index.html but it 
seems awfully brittle to be redirecting to {rbi}docs/index.html rather than 
just {rbi}docs/ which I could live with but the problem is my WADL description 
shows that you can call a GET on docs/ but when you try that you get a plain 
ol' non-hypermediafied listing of the files within docs. I tried messing with 
the setNegotiatingContent flag to no avail. Have I missed the purpose of 
setIndexName?

Thanks.

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

This message and any included attachments are intended only for the addressee. 
The information contained in this message is confidential and may constitute 
proprietary or non-public information under international, federal, or state 
laws. Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail.

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

Reply via email to