SeaSide REST

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SeaSide REST

Rubens Gomes
I am learning Smalltalk, and I am developing a REST service on top of Pharo 3 with Latest update #30859.  I have installed the latest SeaSide   I have done a Manual Installation of the most recent Configuration of SeaSide.  And I have installed the latest SeaSide30Addons.  I would like to ask a few questions:

 
1) Why do I see this error in SeaSide, and how do I fix it?  I have the latest SeaSide running on latest Pharo 3 with Seaside-REST


Error: you are forbidden to access "/"   

2) I have a Seaside REST object  that is not responding to the URL request below.


I have the following class/instance configuration.  Am I missing something else?

WARestfulHandler subclass: #WeightRestHandler
its class initialize method contains:
WAAdmin register: self at: self 'weight'.

And it has an instance method "weight" with following annotation:

<get>
<produces: 'text/json'>
<path: '/{toUnit}?{fromUnit}={aNumber}'>

Rubens

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: SeaSide REST

JupiterJones
1) Why do I see this error in SeaSide, and how do I fix it?  I have the latest SeaSide running on latest Pharo 3 with Seaside-REST


Error: you are forbidden to access “/"

There may be no default handler, or your REST service is the default and is not matching “/“

Try:


or


which will allow you to set the default.

2) I have a Seaside REST object  that is not responding to the URL request below.


I have the following class/instance configuration.  Am I missing something else?

WARestfulHandler subclass: #WeightRestHandler
its class initialize method contains:
WAAdmin register: self at: self 'weight'.

And it has an instance method "weight" with following annotation:

<get>
<produces: 'text/json'>
<path: '/{toUnit}?{fromUnit}={aNumber}’>

you may need a method selector that defines the keywords toUnit, fromUnit and aNumber.

ie.
weight: toUnit from: fromUnit value: aNumber
<get>
<produces: ‘text/json’>
<path: '/{toUnit}?{fromUnit}={aNumber}’>

I’ve just started working with REST so let me know if it doesn’t work :)

Cheers,

Jupiter

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: SeaSide REST

Johan Brichau-2
In reply to this post by Rubens Gomes
Hi Rubens,

On 31 Oct 2014, at 02:36, Rubens Gomes <[hidden email]> wrote:

I am learning Smalltalk, and I am developing a REST service on top of Pharo 3 with Latest update #30859.  I have installed the latest SeaSide   I have done a Manual Installation of the most recent Configuration of SeaSide.  And I have installed the latest SeaSide30Addons.  I would like to ask a few questions:

When you say “latest”, which is that? Just to be sure that you did not load incompatible things:
Note that the Seaside-REST package is included in Seaside 3.1 and should not be loaded from the separate ConfigurationOfSeasideRest (which is for Seaside 3.0 only).

You should load the ‘REST’ group from the ConfigurationOfSeaside3, and probably also the ‘JSON’ group:

(ConfigurationOfSeaside3 project version: #’release3.1’) load: #(‘Core’ ‘REST’ ‘JSON’)

1) Why do I see this error in SeaSide, and how do I fix it?  I have the latest SeaSide running on latest Pharo 3 with Seaside-REST


Error: you are forbidden to access “/"

Which adaptor are you using? Does the Seaside tool show that it has started? Did you ever see the ‘Welcome to Seaside’ webpage?
I have the impression that Seaside was not started yet or that something else has been wrongly configured.

2) I have a Seaside REST object  that is not responding to the URL request below.


I have the following class/instance configuration.  Am I missing something else?

WARestfulHandler subclass: #WeightRestHandler
its class initialize method contains:
WAAdmin register: self at: self 'weight’.

That does not seem to be correct. There is a ’self’ too much, it should be: WAAdmin register: self at: ‘weight’
Did you execute this? Mind that a class initialize method is only executed when the class is loaded.

And it has an instance method "weight" with following annotation:

<get>
<produces: 'text/json'>
<path: '/{toUnit}?{fromUnit}={aNumber}’>

Looks reasonable, but probably you did not add the arguments to the method itself. 
But before we focus on this, let’s get the other issues out of the way and make sure Seaside works.

Johan

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside