Restlet cannot process query parameter on ROOT path

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Restlet cannot process query parameter on ROOT path

Xybrek
I have this code:

@Override
public Restlet createInboundRoot() {

     Router router = new Router(getContext());

     Redirector forward = new Redirector(getContext(), SOME_URL,
             Redirector.MODE_CLIENT_FOUND);

     router.attach("/" + "{id}", forward);
     router.attach("/rest/", RootServerResource.class);

     MyFilter myFilter = new MyFilter(getContext());
     myFilter.setNext(router);

     return myFilter;
}

The problem with this code is that Restlet cannot seem to process query
parameter on ROOT path:

http://localhost:8080/?test=test

Filter does not trigger.

However, when through the /rest/ part

http://localhost:8080/rest/?test=test

Filter gets triggered.

What could be the problem with this code?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097557
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Restlet cannot process query parameter on ROOT path

Thierry Boileau-4
Hello,

I've tried your code and the filter is triggered and has access to the query parameter in every cases.
Having said that, I notice that the call to http://localhost:8080/?test=test returns a 404 status because there is no url template that matches the "/" url.
When defining this template "/{id}" the {id} variable cannot be empty.

Best regards,
Thierry Boileau

2015-02-08 7:49 GMT+01:00 Xybrek <[hidden email]>:
I have this code:

@Override
public Restlet createInboundRoot() {

     Router router = new Router(getContext());

     Redirector forward = new Redirector(getContext(), SOME_URL,
             Redirector.MODE_CLIENT_FOUND);

     router.attach("/" + "{id}", forward);
     router.attach("/rest/", RootServerResource.class);

     MyFilter myFilter = new MyFilter(getContext());
     myFilter.setNext(router);

     return myFilter;
}

The problem with this code is that Restlet cannot seem to process query
parameter on ROOT path:

http://localhost:8080/?test=test

Filter does not trigger.

However, when through the /rest/ part

http://localhost:8080/rest/?test=test

Filter gets triggered.

What could be the problem with this code?

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



--
Thierry Boileau, Mr B


6 Rue Rose Dieng-Kuntz • Nantes, 44300  France
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Restlet cannot process query parameter on ROOT path

Xybrek
On Sunday, 08 February, 2015 04:41 PM, Thierry Boileau wrote:

> Hello,
>
> I've tried your code and the filter is triggered and has access to the
> query parameter in every cases.
> Having said that, I notice that the call to
> http://localhost:8080/?test=test returns a 404 status because there is
> no url template that matches the "/" url.
> When defining this template "/{id}" the {id} variable cannot be empty.
>
> Best regards,
> Thierry Boileau
>
> 2015-02-08 7:49 GMT+01:00 Xybrek <[hidden email]
> <mailto:[hidden email]>>:
>
>     I have this code:
>
>     @Override
>     public Restlet createInboundRoot() {
>
>           Router router = new Router(getContext());
>
>           Redirector forward = new Redirector(getContext(), SOME_URL,
>                   Redirector.MODE_CLIENT_FOUND);
>
>           router.attach("/" + "{id}", forward);
>           router.attach("/rest/", RootServerResource.class);
>
>           MyFilter myFilter = new MyFilter(getContext());
>           myFilter.setNext(router);
>
>           return myFilter;
>     }
>
>     The problem with this code is that Restlet cannot seem to process query
>     parameter on ROOT path:
>
>     http://localhost:8080/?test=test
>
>     Filter does not trigger.
>
>     However, when through the /rest/ part
>
>     http://localhost:8080/rest/?test=test
>
>     Filter gets triggered.
>
>     What could be the problem with this code?
>
>     ------------------------------------------------------
>     http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097557
>
>
>
>
> --
> *Thierry Boileau, Mr B**
> *
> +1 (408) 387-3184•[hidden email] <mailto:[hidden email]>
>
> <http://restlet.com/>
> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France



Hi Theirry,

I see. The path "/" is reserved as the path to return the index.html
that is why there is not routing for that. My app has its Restlet
application mixed with the UI (index.html) and rest path, that is why.
If I put a ServerResource in the root path "/" that might not show the
index.html

I just have a web.xml with a welcome-file set to index.html for this

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097572
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Restlet cannot process query parameter on ROOT path

Xybrek
In reply to this post by Thierry Boileau-4
On Sunday, 08 February, 2015 04:41 PM, Thierry Boileau wrote:

> Hello,
>
> I've tried your code and the filter is triggered and has access to the
> query parameter in every cases.
> Having said that, I notice that the call to
> http://localhost:8080/?test=test returns a 404 status because there is
> no url template that matches the "/" url.
> When defining this template "/{id}" the {id} variable cannot be empty.
>
> Best regards,
> Thierry Boileau
>
> 2015-02-08 7:49 GMT+01:00 Xybrek <[hidden email]
> <mailto:[hidden email]>>:
>
>     I have this code:
>
>     @Override
>     public Restlet createInboundRoot() {
>
>           Router router = new Router(getContext());
>
>           Redirector forward = new Redirector(getContext(), SOME_URL,
>                   Redirector.MODE_CLIENT_FOUND);
>
>           router.attach("/" + "{id}", forward);
>           router.attach("/rest/", RootServerResource.class);
>
>           MyFilter myFilter = new MyFilter(getContext());
>           myFilter.setNext(router);
>
>           return myFilter;
>     }
>
>     The problem with this code is that Restlet cannot seem to process query
>     parameter on ROOT path:
>
>     http://localhost:8080/?test=test
>
>     Filter does not trigger.
>
>     However, when through the /rest/ part
>
>     http://localhost:8080/rest/?test=test
>
>     Filter gets triggered.
>
>     What could be the problem with this code?
>
>     ------------------------------------------------------
>     http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097557
>
>
>
>
> --
> *Thierry Boileau, Mr B**
> *
> +1 (408) 387-3184•[hidden email] <mailto:[hidden email]>
>
> <http://restlet.com/>
> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France



Hi Thierry,

I see. The path "/" is reserved as the path to return the index.html
that is why there is not routing for that. My app has its Restlet
application mixed with the UI (index.html) and rest path, that is why.
If I put a ServerResource in the root path "/" that might not show the
index.html

I just have a web.xml with a welcome-file set to index.html for this

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097574
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Restlet cannot process query parameter on ROOT path

Xybrek
In reply to this post by Thierry Boileau-4
On Sunday, 08 February, 2015 04:41 PM, Thierry Boileau wrote:

> Hello,
>
> I've tried your code and the filter is triggered and has access to the
> query parameter in every cases.
> Having said that, I notice that the call to
> http://localhost:8080/?test=test returns a 404 status because there is
> no url template that matches the "/" url.
> When defining this template "/{id}" the {id} variable cannot be empty.
>
> Best regards,
> Thierry Boileau
>
> 2015-02-08 7:49 GMT+01:00 Xybrek <[hidden email]
> <mailto:[hidden email]>>:
>
>     I have this code:
>
>     @Override
>     public Restlet createInboundRoot() {
>
>           Router router = new Router(getContext());
>
>           Redirector forward = new Redirector(getContext(), SOME_URL,
>                   Redirector.MODE_CLIENT_FOUND);
>
>           router.attach("/" + "{id}", forward);
>           router.attach("/rest/", RootServerResource.class);
>
>           MyFilter myFilter = new MyFilter(getContext());
>           myFilter.setNext(router);
>
>           return myFilter;
>     }
>
>     The problem with this code is that Restlet cannot seem to process query
>     parameter on ROOT path:
>
>     http://localhost:8080/?test=test
>
>     Filter does not trigger.
>
>     However, when through the /rest/ part
>
>     http://localhost:8080/rest/?test=test
>
>     Filter gets triggered.
>
>     What could be the problem with this code?
>
>     ------------------------------------------------------
>     http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3097557
>
>
>
>
> --
> *Thierry Boileau, Mr B**
> *
> +1 (408) 387-3184•[hidden email] <mailto:[hidden email]>
>
> <http://restlet.com/>
> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France



Hi Thierry,

I see. The path "/" is reserved as the path to return the index.html
that is why there is not routing for that. My app has its Restlet
application mixed with the UI (index.html) and rest path, that is why.
If I put a ServerResource in the root path "/" that might not show the
index.html

I just have a web.xml with a welcome-file set to index.html for this.

Anyway, I have tried this, and the thing is, nothing happens even if I
mount a route in the ROOT path "/", it just shows the index.html

Could this be because of the welcome-file in the web.xml?

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