Hmm, I might be able to help with the docs if needed. I'm not native but I'm decent at English. Overall seems pretty cool although the name is pretty weird. I think there is a character in Bersker manga called Slan.
go4Sat 9 Oct 2010
Thank you.'follow' in bitBucket if you like.
go4Sat 30 Oct 2010
I wrote a little document for this,and update this topic.
go4Sun 23 Jan 2011
rename to Slan web framework
features:
HTTP-to-code url mapping
Bind an HTTP parameter to a code method parameter
Hot reload(fix the bug and hit reload)
Show error source code directly
Simple stateless MVC
Familiar templating engine(the language just is fantom)
Standalone architecture(all pod is standalone)
Javascript FWT suppert
Zero configuration
Build-in localization
Fanlet compatible(to deploy on servlet container)
Full-stack(ORM/Validate/Patchca...)
Thanks
tonskySun 23 Jan 2011
Hi, chunquedong!
Some problems with testing slan:
mercurial doesn’t store empty directories, so I have to create them before I get it running (slanExample/test, public/stylesheet, public/javascript/, public/image);
in RootMod, you have /log/ as a default log dir, but it’s usually not a good idea to store logs in root of FS. It failed with no write permissions;
files are uploaded to file:/D:/Temp/, so path does not exist error is what I got there.
in REST example, both put and delete output get;
in Tools/validate:
ERROR: /Tool/validate
sys::NullErr: Coerce to non-null
fan.sys.NullErr.makeCoerce (NullErr.java:38)
Tool349090613157000000::Tool.validate (.../slan/slanSample/fan/action/Tool.fan:40)
Anyway, thanks for a great work! You took your inspiration from Ruby on Rails, am I guess right?
DanielFathSun 23 Jan 2011
I just downloaded and tried to compile slan but ran into problems. SlanSample.fan in buildall.fan caused some problems:
D:\dev\tools\slan>fan build.fan
D:\dev\tools\slan\slanSample\build.fan(11,1): Pod not found 'slanWeb'
BUILD FAILED [44ms]!
My solution was straightforward (comment slanSample). Best solution is to emulate Fantom and have two scripts buildsamples.fan and buildslan.fan which script build.fan will run.
EDIT: It won't work. You'll need to get rid of using slanWeb in buildSamples.fan in order for that to work.
EDIT 2: On your wiki
using slanweb //using slanWeb otherwise it will cause an error
using web
const class Hello : SlanWeblet
{
...
}
EDIT 3: As tonsky noted mercurial ignores folders without files. My suggestion - add some kind of readme.txt to (all or missing) folders, which explains what goes in that folder. That way you'll explain what the folders are for and spare users from constructing them manually.
Other than these small complaints good job go4 :D
go4Sun 23 Jan 2011
Thank you, tonsky.
I fixed the 1,3,5. But where to store the logs? Is there some the best practices?
In fact, the feature of REST is not complete. I don't know how to send put and delete request.
You took your inspiration from Ruby on Rails, am I guess right?
Yes, all things come from Ruby on Rails and Play framework. It's just play! like.
go4Sun 23 Jan 2011
Thanks DanielFath. I will see the build script.
DanielFathSun 23 Jan 2011
put and delete aren't supported by HTML. There are several ways around it. One is to generate a XMLHttpRequest using javascript the other (IMHO) much better is to user jquery (either embedding it or calling it remotely). Jquery is better simply because IIRC it is cross browser compatible.
EDIT examples: This is what it would look like if you made it yourself:
function delFunc($url) {
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.open('DELETE',$url,false);
xmlhttp.send(null);
window.location.reload();
}
This is the same thing in ajax.
$.ajax({
url: '/script.cgi',
type: 'DELETE',
success: function(result) {
// Do something with the result
}
});
rfeldmanSun 23 Jan 2011
Sadly ie7 doesn't support delete even in an xhr...I don't remember if ie8 does, but we have always had to hack around it since we have to support that browser
ahhatemSun 23 Jan 2011
Rails uses a query string param to pass the put and delete actions..
tonskySun 23 Jan 2011
go4,
I think you should set up logger to dump to stdout by default and let deployers configure this behavior. For fantom, I guess, best practice would be to use Log class.
DanielFathSun 23 Jan 2011
@rfeldman: Does ie7 work with jquery?
rfeldmanSun 23 Jan 2011
Yes, jQuery in general works as far back as ie6, but ie6 and ie7 (and possibly ie8, don't remember) do not support the delete method.
So you use $.ajax() as normal, and it will do the ajax call, but if you specify delete or put as the method you will find on the receiving end that the browser sent a get instead. (Or maybe a post? Don't remember that either, but definitely not the delete or put you asked for.)
DanielFathSun 23 Jan 2011
I haven't worked with jQuery. My team just used plain javascript. Will jQuery send a delete method on Firefox and WebKit (Chrome, Safari) browsers? Does it have a method parameter which you can look at for which method was used or something?
ahhatemSun 23 Jan 2011
May I ask why is everyone so concerned about Javascript, I thought all the talk would be about using Fantom on both the client and the server...
Why isn't that the center point of all frameworks? That would be the Super Vito card against all other frameworks... that alone in a good framework would probably get A LOT of attention to Fantom....
DanielFathSun 23 Jan 2011
We want to help go4 solve a problem in a most cross-browser manner possible. Speaking of. If you decide to make a custom implementation of put/delete method IMO take best of both worlds. Try to send an put/delete request that has a redundant Rails-like parameter.
Having Fantom on client and server side is an awesome feature (especially fwt); though it may clash against core principles of the framework (like keep representation and model separated or something). That being said I think Slan just needs some fixes a nice site and a screencast or two and it will be awesome. I'm actually willing to help out with documentation should the need arise.
As brian once said there are many different ways to implement a web framework (all with their pros and cons). Some might use Fantom a lot other might not but as long as they are powered by Fantom it will spread its use either way.
rfeldmanMon 24 Jan 2011
Yes, jQuery does send an actual delete in browsers that support it.
Like Rails, Spring MVC also supports sending a query parameter that is interpreted on the receiving end as put/'delete'
DanielFathMon 24 Jan 2011
Does jQuery send a get/post request where real method type is encoded in parameter when the browser doesn't support it?
yachrisTue 25 Jan 2011
Two things to be careful of:
Users can turn off javascript. And they do, sometimes! You can't depend on it.
If you implement your DELETE operator as a special argument to a GET, then spiders (and other automatic web browsers, sometimes implemented by browsers) will follow all GETs (even if marked nofollow) and delete your user's data out from under them. BAD BAD BAD and ugly.
So, I'd recommend doing what Rails does: set up the delete as a POST, not a GET. Then add a special, hidden parameter to say what the intent is. This is safe from spiders, and works without javascript.
rfeldmanTue 25 Jan 2011
As far as I know, jQuery does not have a built-in way to do a parameter-encoded workaround for this, but there may be a plugin.
Agree on overriding POST rather than GET. And note that if you're concerned about JS being turned off, you can do the same trick for forms - you just include a hidden input that tells you the intended type of the request and then translate on the receiving side.
victor_bilykTue 25 Jan 2011
Using GET to DELETE is a bad idea. RFC2616: “In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered ‘safe’.”
Also GET, HEAD, PUT and DELETE are idempotent methods, while POST is not. So using POST to emulate delete IS ugly in some way, but it seems there is nothing you can do about it.
go4 Thu 7 Oct 2010
It includes ORM/queryCache/uriRoute/htmlTemplate.
I had a very simple blog app to demonstrate how to use it.
Get start
florin Thu 7 Oct 2010
Can you write an introduction on it? It would save hours of looking into your code to figure it out. It'll get more attention this way.
go4 Fri 8 Oct 2010
I'am apologetic for wasting everyone's time. I'am not good at English,therefore did not too much words.
for your reference:
DanielFath Fri 8 Oct 2010
Hmm, I might be able to help with the docs if needed. I'm not native but I'm decent at English. Overall seems pretty cool although the name is pretty weird. I think there is a character in Bersker manga called Slan.
go4 Sat 9 Oct 2010
Thank you.'follow' in bitBucket if you like.
go4 Sat 30 Oct 2010
I wrote a little document for this,and update this topic.
go4 Sun 23 Jan 2011
rename to
Slan web framework
features:
Thanks
tonsky Sun 23 Jan 2011
Hi, chunquedong!
Some problems with testing slan:
no write permissions
;path does not exist
error is what I got there.put
anddelete
outputget
;Anyway, thanks for a great work! You took your inspiration from Ruby on Rails, am I guess right?
DanielFath Sun 23 Jan 2011
I just downloaded and tried to compile slan but ran into problems.
SlanSample.fan
in buildall.fan caused some problems:My solution was straightforward (comment slanSample). Best solution is to emulate Fantom and have two scripts buildsamples.fan and buildslan.fan which script build.fan will run.
EDIT: It won't work. You'll need to get rid of
using slanWeb
in buildSamples.fan in order for that to work.EDIT 2: On your wiki
EDIT 3: As tonsky noted mercurial ignores folders without files. My suggestion - add some kind of readme.txt to (all or missing) folders, which explains what goes in that folder. That way you'll explain what the folders are for and spare users from constructing them manually.
Other than these small complaints good job go4 :D
go4 Sun 23 Jan 2011
Thank you, tonsky.
I fixed the 1,3,5. But where to store the logs? Is there some the best practices?
In fact, the feature of REST is not complete. I don't know how to send
put
anddelete
request.Yes, all things come from Ruby on Rails and Play framework. It's just
play!
like.go4 Sun 23 Jan 2011
Thanks DanielFath. I will see the build script.
DanielFath Sun 23 Jan 2011
put
anddelete
aren't supported by HTML. There are several ways around it. One is to generate a XMLHttpRequest using javascript the other (IMHO) much better is to userjquery
(either embedding it or calling it remotely). Jquery is better simply because IIRC it is cross browser compatible.See: http://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers and http://stackoverflow.com/questions/2153917/how-to-send-a-put-delete-request-in-jquery
EDIT examples: This is what it would look like if you made it yourself:
This is the same thing in ajax.
rfeldman Sun 23 Jan 2011
Sadly ie7 doesn't support
delete
even in an xhr...I don't remember if ie8 does, but we have always had to hack around it since we have to support that browserahhatem Sun 23 Jan 2011
Rails uses a query string param to pass the
put
anddelete
actions..tonsky Sun 23 Jan 2011
go4,
I think you should set up logger to dump to stdout by default and let deployers configure this behavior. For fantom, I guess, best practice would be to use
Log
class.DanielFath Sun 23 Jan 2011
@rfeldman: Does ie7 work with jquery?
rfeldman Sun 23 Jan 2011
Yes, jQuery in general works as far back as ie6, but ie6 and ie7 (and possibly ie8, don't remember) do not support the
delete
method.So you use $.ajax() as normal, and it will do the ajax call, but if you specify
delete
orput
as the method you will find on the receiving end that the browser sent aget
instead. (Or maybe apost
? Don't remember that either, but definitely not thedelete
orput
you asked for.)DanielFath Sun 23 Jan 2011
I haven't worked with jQuery. My team just used plain javascript. Will jQuery send a
delete
method on Firefox and WebKit (Chrome, Safari) browsers? Does it have a method parameter which you can look at for which method was used or something?ahhatem Sun 23 Jan 2011
May I ask why is everyone so concerned about Javascript, I thought all the talk would be about using Fantom on both the client and the server...
Why isn't that the center point of all frameworks? That would be the Super Vito card against all other frameworks... that alone in a good framework would probably get A LOT of attention to Fantom....
DanielFath Sun 23 Jan 2011
We want to help go4 solve a problem in a most cross-browser manner possible. Speaking of. If you decide to make a custom implementation of put/delete method IMO take best of both worlds. Try to send an put/delete request that has a redundant Rails-like parameter.
Having Fantom on client and server side is an awesome feature (especially
fwt
); though it may clash against core principles of the framework (like keep representation and model separated or something). That being said I think Slan just needs some fixes a nice site and a screencast or two and it will be awesome. I'm actually willing to help out with documentation should the need arise.As brian once said there are many different ways to implement a web framework (all with their pros and cons). Some might use Fantom a lot other might not but as long as they are powered by Fantom it will spread its use either way.
rfeldman Mon 24 Jan 2011
Yes, jQuery does send an actual
delete
in browsers that support it.Like Rails, Spring MVC also supports sending a query parameter that is interpreted on the receiving end as
put
/'delete'DanielFath Mon 24 Jan 2011
Does jQuery send a get/post request where real method type is encoded in parameter when the browser doesn't support it?
yachris Tue 25 Jan 2011
Two things to be careful of:
nofollow
) and delete your user's data out from under them. BAD BAD BAD and ugly.So, I'd recommend doing what Rails does: set up the
delete
as a POST, not a GET. Then add a special, hidden parameter to say what the intent is. This is safe from spiders, and works without javascript.rfeldman Tue 25 Jan 2011
As far as I know, jQuery does not have a built-in way to do a parameter-encoded workaround for this, but there may be a plugin.
Agree on overriding POST rather than GET. And note that if you're concerned about JS being turned off, you can do the same trick for forms - you just include a hidden input that tells you the intended type of the request and then translate on the receiving side.
victor_bilyk Tue 25 Jan 2011
Using GET to DELETE is a bad idea. RFC2616: “In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered ‘safe’.”
Also GET, HEAD, PUT and DELETE are idempotent methods, while POST is not. So using POST to emulate delete IS ugly in some way, but it seems there is nothing you can do about it.