Mail sent on the 08/28 and apparently lost.
---

Hello Bora,

you ask a good question. There is a misunderstanding here and a lack of documentation.
A WADL file used as a mean of configuration is only able, at this time, to configure resources inside an application. The WadlComponent is able to configure applications using WADL files...
I think there is a confusion with the constructors of the parent class (i.e. Component) that allows to configure a Component (not only an application) from a specific XML-based format (described here http://www.restlet.org/schemas/1.1/Component). This XML file allows you to specify server hosts, ports, etc.
This confusion must be solved at least in the javadocs.

Having said that, your case is not lost since you can include references to WADL files into the "component" XML file. You can find an example of such integration in the javadocs of the "Component" class:
http://www.restlet.org/documentation/1.1/api/org/restlet/Component.html.
Here is a base XML file that may help you:
 <?xml version="1.0"?>
 <component xmlns="http://www.restlet.org/schemas/1.1/Component"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.restlet.org/schemas/1.1/Component">
    <client protocol="FILE"/>
    <server protocols="HTTP" port="8185" />
 
    <defaultHost>
       <attach targetDescriptor="file:///C:/Eclipse/workspace/Quiks/src/main/resources/Quiks.wadl.xml" />
    </defaultHost>
 </component>

You can also have a look at this following test case: org.restlet.test.ComponentXmlTestCase.java

I hope this will help you.

Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


I was wondering if there is a way to update host and port address of a WadlComponent
I mean to use something else that on the Wadl file.

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://research.sun.com/wadl/2006/10 wadl.xsd"
xmlns="http://research.sun.com/wadl/2006/10">

   <grammars>
        <include href=""/>
    </grammars>

    <resources base="http://localhost:8185">
        <resource id="com.services.QuiksResource"  path="/docId/{docId}">
              <param name="docId" style="template" type="xsi:string" required="true" />
             <method name="POST">
                <response>
                    <representation status="200" mediaType="text/plain" />
               </response>
            </method>
       </resource>
    </resources>

</application>
 
Currently the only way to access to this resource is through http://localhost:8185/docId/12
So, I want to use a different port that 8185.and lets say preferably the actual hostname
http://bora:8182/docId/12 how is this possible? I can see this not being a problem on a servlet container but when
running  standalone it causes problems.
 
So far I've tried the following. Since the Wadl can not match the base url it can not find the resource and I get 404 error

  

public static void main(String[] args) {

try

{

    WadlComponent component = new WadlComponent(file:///C:/Eclipse/workspace/Quiks/src/main/resources/Quiks.wadl.xml");

    component.getServers().add(Protocol.HTTP,"localhost", 8182);

    component.start();

    Client client = new Client(Protocol.HTTP);

    Response res = client.post("http://localhost:8182/quikbiblist/docId/1",

    new StringRepresentation(""));

    System.out.println("res="+res.getStatus().getCode());

    component.stop();

}

catch (Exception e)

{

// Something is wrong.

e.printStackTrace();

}

}

 

 

Any help is appreciated

Thanks

Bora



Reply via email to