* functional programming and web services
@ 2016-10-20 9:55 Damien MATTEI
2016-10-20 10:20 ` Damien MATTEI
2016-10-21 23:00 ` Per Bothner
0 siblings, 2 replies; 4+ messages in thread
From: Damien MATTEI @ 2016-10-20 9:55 UTC (permalink / raw)
To: kawa, Bigloo Mailingliste, Per Bothner, Manuel.Serrano,
Michel.BUFFA, Jean-Paul.ROY
Cc: Bonneau Daniel, Mattei Damien, jean-Claude Thorel, Stee Philippe,
lyu.abe, thierry.lanz
Hi Schemers, web programmers and all
i'm writing in the mailing lists to share some knowledge about how to write web applications
with our favorites Scheme languages because there is little documentation else where on the net.
Using the experience of developping a web application for astronomy ( https://sidonie2.oca.eu/Sidonie/ ) i decided to share my experience by
writing a tutorial about creating web services applications that integrate our Schemes languages (Bigloo and Kawa)
with the Java VM used in web application servers (such as Tomcat) .
The tutorial is available here:
https://sidonie2.oca.eu/Sidonie/technical-doc.html
This explains the techniques used for the development of the web application
and i hope it will help programmers integrating and melting Java and Scheme code in the same application.
I also want to thanks the users of the maing lists that have answered my questions , and
especially Per Bothner for his help answering my lot of questions about his Kawa system.
Regards,
Damien
--
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: functional programming and web services
2016-10-20 9:55 functional programming and web services Damien MATTEI
@ 2016-10-20 10:20 ` Damien MATTEI
2016-10-21 23:00 ` Per Bothner
1 sibling, 0 replies; 4+ messages in thread
From: Damien MATTEI @ 2016-10-20 10:20 UTC (permalink / raw)
To: kawa, Bigloo Mailingliste, Per Bothner, Michel.BUFFA, Jean-Paul.ROY
i apologize the web site sidonie2.oca.eu is still authentification protected , and the tutorial is not accessible (only people having an account at oca.eu can access it), i hope it will be in a few times
waiting i have uploaded the tuto on my account at sourceforge, here it is :
http://damien_mattei.users.sourceforge.net/sidonie2/technical-doc.html
Damien
> Hi Schemers, web programmers and all
>
> i'm writing in the mailing lists to share some knowledge about how to write web applications
> with our favorites Scheme languages because there is little documentation else where on the net.
>
> Using the experience of developping a web application for astronomy ( https://sidonie2.oca.eu/Sidonie/ ) i decided to share my experience by
> writing a tutorial about creating web services applications that integrate our Schemes languages (Bigloo and Kawa)
> with the Java VM used in web application servers (such as Tomcat) .
>
> The tutorial is available here:
>
> https://sidonie2.oca.eu/Sidonie/technical-doc.html
>
> This explains the techniques used for the development of the web application
> and i hope it will help programmers integrating and melting Java and Scheme code in the same application.
>
> I also want to thanks the users of the maing lists that have answered my questions , and
> especially Per Bothner for his help answering my lot of questions about his Kawa system.
>
> Regards,
>
> Damien
>
--
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: functional programming and web services
2016-10-20 9:55 functional programming and web services Damien MATTEI
2016-10-20 10:20 ` Damien MATTEI
@ 2016-10-21 23:00 ` Per Bothner
[not found] ` <201610261423.51297.Damien.Mattei@unice.fr>
1 sibling, 1 reply; 4+ messages in thread
From: Per Bothner @ 2016-10-21 23:00 UTC (permalink / raw)
To: Damien MATTEI, kawa, Bigloo Mailingliste, Manuel.Serrano,
Michel.BUFFA, Jean-Paul.ROY
Cc: Bonneau Daniel, Mattei Damien, jean-Claude Thorel, Stee Philippe,
lyu.abe, thierry.lanz
Thanks! And great that you're using Kawa for this.
I only skimmed the document, but here are some reactions:
* As a tutorial it's rather on the heavy side, with very
big examples. The code seems to include a lot of debugging
code making it even bigger.
* It's not obvious from the examples why one would use
Kawa rather than just Java. (We know ...)
* Using "format" might make the Counter.scm example more compact.
Or maybe using string templates more. I see some examples
of them already.
* Could SidonieWelcomeR and ResultatGeneralF be written in Scheme
rather than Java? Note that Kawa does have decent annotation support.
Yes, you need to magically make sure that Scheme.registerEnvironment()
gets called early, but that shouldn't be difficult.
* ResultatGeneralFKawa.scm builds HTML by concatenating strings.
That seems verbose - and dangerous (consider injection attacks).
Have you considered using XML literals?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: functional programming and web services
[not found] ` <201610261423.51297.Damien.Mattei@unice.fr>
@ 2016-10-27 6:18 ` Per Bothner
0 siblings, 0 replies; 4+ messages in thread
From: Per Bothner @ 2016-10-27 6:18 UTC (permalink / raw)
To: Damien MATTEI; +Cc: kawa
On 10/26/2016 05:23 AM, Damien MATTEI wrote:
>> * ResultatGeneralFKawa.scm builds HTML by concatenating strings.
>> That seems verbose - and dangerous (consider injection attacks).
> gloups! this is my first database accessed by web (!) i didn't know that sort of attacks,
> i searched about SQL injection attack over internet and yes, and made a test by "injecting" an OR-ed
> tautology at the good place via the form: result in accessing the whole list of stars observation,
> it's so huge that the database is unavailable for many minutes before recovering.
> Well that's not really a security issue because accessing data of observations is the goal of the web application,
> there is no passwords or secret things in the database but i will fix that! thanks!
>> Have you considered using XML literals?
> yes months ago, i read and test your documentation
> https://www.gnu.org/software/kawa/XML-tools.html
> and i should have ask help about because i know how to create HTML nodes in the kawa interpreter like this : (html:p "Don't use the " (html:code "<blink>") " tag.")
> but cannot figure out what was the result type of the object and how to cast it in strings to return it to java and tomcat...
> it would be nice if you can give me an example.
The Scheme API for working with XML is rather incomplete.
Since Kawa includes XPath and XQuery, the functionality is
there - it's just not easy to access. (It might be reasonable
as a minimum to define a function where people can use XPath
expressions.)
However, there is enough to conveniently construct nodes, and convert
them to strings:
(define name "Tom")
(define hello-span #<span>Hello &[name]!</>)
(define action "<login>")
(define div1 #<p>&[hello-span]<span> Please &[action]</span></p>)
(display div1) (newline)
Note when div1 is printed, the angle-brackets from action are escaped.
The escaping does *not* happen when div1 is constructed - that just creates a
text node. The escaping is when when the text node (child of div1)
is "serialized" to a string, by calling display. You can also do:
(div1:toString)
to directly yield an XML-formatted string.
Note the following are equivalent:
(html:span "Hello!")
#<html:span>Hello</>
Leaving out the html: in the latter is almost the same,
but in the default empty namespace:
#<span>Hello</>
A browser should display #<html:span>Hello</> and
#<span>Hello</> the same.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-27 6:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 9:55 functional programming and web services Damien MATTEI
2016-10-20 10:20 ` Damien MATTEI
2016-10-21 23:00 ` Per Bothner
[not found] ` <201610261423.51297.Damien.Mattei@unice.fr>
2016-10-27 6:18 ` Per Bothner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).