Added html encoding facility to WSF_STRING
Added WSF_STRING.is_empty Improved HTML_ENCODER to be able to decode a STRING_8 or STRING_32 using general_decoded_string (s) Improved tutorial example Added precompilation for WSF library Cosmetic (removed unused locals)
This commit is contained in:
@@ -1,24 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="hello" uuid="25B014D9-CC71-484D-93D9-5E93B51C6B36">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="hello" uuid="25B014D9-CC71-484D-93D9-5E93B51C6B36">
|
||||||
|
|
||||||
<target name="hello">
|
<target name="hello">
|
||||||
|
<root class="HELLO_APPLICATION" feature="make_and_launch"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/CVS$</exclude>
|
<exclude>/CVS$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<root class="HELLO_APPLICATION" feature="make_and_launch"/>
|
|
||||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
|
<precompile name="precomp_wsf" location="..\..\..\..\precomp\wsf-safe.ecf"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
|
||||||
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||||
<cluster name="src" location=".\src" recursive="true"/>
|
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||||
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
<target name="hello_mt">
|
||||||
|
<root class="HELLO_APPLICATION" feature="make_and_launch"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/CVS$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
|
</option>
|
||||||
|
<setting name="concurrency" value="thread"/>
|
||||||
|
<precompile name="precomp_wsf-mt" location="..\..\..\..\precomp\wsf-mt-safe.ecf"/>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||||
|
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||||
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="hello_custom" extends="hello">
|
<target name="hello_custom" extends="hello">
|
||||||
<root class="CUSTOM_HELLO_APPLICATION" feature="make_and_launch"/>
|
<root class="CUSTOM_HELLO_APPLICATION" feature="make_and_launch"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
@@ -10,8 +10,11 @@
|
|||||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
|
<setting name="concurrency" value="thread"/>
|
||||||
|
<precompile name="precomp_wsf-mt" location="..\..\..\..\precomp\wsf-mt-safe.ecf"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||||
|
<library name="encoder" location="..\..\..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="..\..\..\..\library\protocol\http\http-safe.ecf" readonly="false"/>
|
<library name="http" location="..\..\..\..\library\protocol\http\http-safe.ecf" readonly="false"/>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
note
|
note
|
||||||
description: "[
|
description: "[
|
||||||
This class implements the `Hello World' service.
|
This class implements the `Hello World' service.
|
||||||
|
|
||||||
@@ -29,7 +29,12 @@ feature {NONE} -- Initialization
|
|||||||
setup_router
|
setup_router
|
||||||
do
|
do
|
||||||
router.map_agent ("/hello", agent execute_hello)
|
router.map_agent ("/hello", agent execute_hello)
|
||||||
router.map_agent_response_with_request_methods ("/{user}/bye", agent response_bye, <<"GET">>)
|
|
||||||
|
|
||||||
|
router.map_with_request_methods ("/users/{user}/message/{mesgid}", create {USER_MESSAGE_HANDLER}, <<"GET", "POST">>)
|
||||||
|
router.map_with_request_methods ("/users/{user}/message/", create {USER_MESSAGE_HANDLER}, <<"GET", "POST">>)
|
||||||
|
|
||||||
|
router.map_agent_response_with_request_methods ("/users/{user}/{?op}", agent response_user, <<"GET">>)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
@@ -44,6 +49,7 @@ feature -- Execution
|
|||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
local
|
local
|
||||||
mesg: WSF_HTML_PAGE_RESPONSE
|
mesg: WSF_HTML_PAGE_RESPONSE
|
||||||
|
s: STRING_8
|
||||||
do
|
do
|
||||||
--| It is now returning a WSF_HTML_PAGE_RESPONSE
|
--| It is now returning a WSF_HTML_PAGE_RESPONSE
|
||||||
--| Since it is easier for building html page
|
--| Since it is easier for building html page
|
||||||
@@ -51,21 +57,26 @@ feature -- Execution
|
|||||||
mesg.set_title ("EWF tutorial / Hello World!")
|
mesg.set_title ("EWF tutorial / Hello World!")
|
||||||
--| Check if the request contains a parameter named "user"
|
--| Check if the request contains a parameter named "user"
|
||||||
--| this could be a query, or a form parameter
|
--| this could be a query, or a form parameter
|
||||||
if attached req.string_item ("user") as u then
|
if attached {WSF_STRING} req.item ("user") as u then
|
||||||
--| If yes, say hello world #name
|
--| If yes, say hello world #name
|
||||||
mesg.set_body ("Hello " + u + "!<br/>Click <a href=%"/" + u + "/bye%">here</a> to quit.")
|
s := "<p>Hello " + u.html_encoded_string + "!</p>"
|
||||||
|
s.append ("Display a <a href=%"/users/" + u.url_encoded_string + "/message/%">message</a></p>")
|
||||||
|
s.append ("<p>Click <a href=%"/users/" + u.url_encoded_string + "/?op=quit%">here</a> to quit.</p>")
|
||||||
|
mesg.set_body (s)
|
||||||
--| We should html encode this name
|
--| We should html encode this name
|
||||||
--| but to keep the example simple, we don't do that for now.
|
--| but to keep the example simple, we don't do that for now.
|
||||||
else
|
else
|
||||||
--| Otherwise, ask for name
|
--| Otherwise, ask for name
|
||||||
mesg.set_body ("[
|
s := (create {HTML_ENCODER}).encoded_string ({STRING_32} "Hello / ahoj / नमस्ते / Ciào / مرحبا / Hola / 你好 / Hallo / Selam / Bonjour ")
|
||||||
|
s.append ("[
|
||||||
<form action="/hello" method="POST">
|
<form action="/hello" method="POST">
|
||||||
<p>Hello, what is your name?</p>
|
What is your name?</p>
|
||||||
<input type="text" name="user"/>
|
<input type="text" name="user"/>
|
||||||
<input type="submit" value="Validate"/>
|
<input type="submit" value="Validate"/>
|
||||||
</form>
|
</form>
|
||||||
]"
|
]"
|
||||||
)
|
)
|
||||||
|
mesg.set_body (s)
|
||||||
end
|
end
|
||||||
|
|
||||||
--| note:
|
--| note:
|
||||||
@@ -79,17 +90,39 @@ feature -- Execution
|
|||||||
res.send (mesg)
|
res.send (mesg)
|
||||||
end
|
end
|
||||||
|
|
||||||
response_bye (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
response_user (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
local
|
local
|
||||||
html: WSF_HTML_PAGE_RESPONSE
|
html: WSF_HTML_PAGE_RESPONSE
|
||||||
redir: WSF_HTML_DELAYED_REDIRECTION_RESPONSE
|
redir: WSF_HTML_DELAYED_REDIRECTION_RESPONSE
|
||||||
|
s: STRING_8
|
||||||
do
|
do
|
||||||
if attached ctx.string_path_parameter ("user") as u then
|
if attached {WSF_STRING} ctx.path_parameter ("user") as u then
|
||||||
create redir.make (req.script_url ("/hello"), 5)
|
if
|
||||||
redir.set_title ("Bye " + u)
|
attached {WSF_STRING} req.query_parameter ("op") as l_op
|
||||||
redir.set_body ("Bye " + u + ",<br/> see you soon.<p>You will be redirected to " + redir.url_location + " in " + redir.delay.out + " second(s) ...</p>")
|
then
|
||||||
Result := redir
|
if l_op.is_case_insensitive_equal ("quit") then
|
||||||
|
create redir.make (req.script_url ("/hello"), 5)
|
||||||
|
redir.set_title ("Bye " + u.url_encoded_string)
|
||||||
|
redir.set_body ("Bye " + u.url_encoded_string + ",<br/> see you soon.<p>You will be redirected to " +
|
||||||
|
redir.url_location + " in " + redir.delay.out + " second(s) ...</p>"
|
||||||
|
)
|
||||||
|
Result := redir
|
||||||
|
else
|
||||||
|
create html.make
|
||||||
|
html.set_title ("Bad request")
|
||||||
|
html.set_body ("Bad request: unknown operation '" + l_op.url_encoded_string + "'.")
|
||||||
|
Result := html
|
||||||
|
end
|
||||||
|
else
|
||||||
|
s := "<p>User <em>'" + u.url_encoded_string + "'</em>!</p>"
|
||||||
|
s.append ("Display a <a href=%"/users/" + u.url_encoded_string + "/message/%">message</a></p>")
|
||||||
|
s.append ("<p>Click <a href=%"/users/" + u.url_encoded_string + "/?op=quit%">here</a> to quit.</p>")
|
||||||
|
create html.make
|
||||||
|
html.set_title ("User '" + u.url_encoded_string + "'")
|
||||||
|
html.set_body (s)
|
||||||
|
Result := html
|
||||||
|
end
|
||||||
else
|
else
|
||||||
create html.make
|
create html.make
|
||||||
html.set_title ("Bad request")
|
html.set_title ("Bad request")
|
||||||
|
|||||||
73
examples/tutorial/step_4/hello/src/user_message_handler.e
Normal file
73
examples/tutorial/step_4/hello/src/user_message_handler.e
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Handler to process /user/{user}/message/ requests
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
USER_MESSAGE_HANDLER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_RESPONSE_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT]
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
response (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||||
|
do
|
||||||
|
if attached {WSF_STRING} ctx.path_parameter ("user") as u then
|
||||||
|
if req.is_request_method ("GET") then
|
||||||
|
Result := user_message_get (u, ctx, req)
|
||||||
|
elseif req.is_request_method ("POST") then
|
||||||
|
Result := user_message_response_post (u, ctx, req)
|
||||||
|
else
|
||||||
|
Result := unsupported_method_response (req)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := missing_argument_response ("Missing parameter 'user'.", req)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
missing_argument_response (m: READABLE_STRING_8; req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
Result.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
||||||
|
Result.put_string (req.request_uri + ": " + m)
|
||||||
|
end
|
||||||
|
|
||||||
|
unsupported_method_response (req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
Result.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
||||||
|
Result.put_string (req.request_uri + " only support: GET and POST; " + req.request_method + " is not supported.")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
user_message_get (u: WSF_STRING; ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
s := "<p>No message from user '" + u.html_encoded_string + "'.</p>"
|
||||||
|
s.append ("<form action=%""+ req.request_uri +"%" method=%"POST%">")
|
||||||
|
s.append ("<textarea name=%"message%" rows=%"10%" cols=%"70%" ></textarea>")
|
||||||
|
s.append ("<input type=%"submit%" value=%"Ok%" />")
|
||||||
|
s.append ("</form>")
|
||||||
|
Result.set_body (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
user_message_response_post (u: WSF_STRING; ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
create Result.make
|
||||||
|
s := "<p>Message from user '<a href=%"/users/" + u.url_encoded_string + "/%">" + u.html_encoded_string + "</a>'.</p>"
|
||||||
|
if attached {WSF_STRING} req.form_parameter ("message") as m and then not m.is_empty then
|
||||||
|
s.append ("<textarea>"+ m.string +"</textarea>")
|
||||||
|
else
|
||||||
|
s.append ("<strong>No or empty message!</strong>")
|
||||||
|
end
|
||||||
|
Result.set_body (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -56,6 +56,12 @@ feature -- Status report
|
|||||||
is_string: BOOLEAN = True
|
is_string: BOOLEAN = True
|
||||||
-- Is Current as a WSF_STRING representation?
|
-- Is Current as a WSF_STRING representation?
|
||||||
|
|
||||||
|
is_empty: BOOLEAN
|
||||||
|
-- Is empty?
|
||||||
|
do
|
||||||
|
Result := string.is_empty
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Helper
|
feature -- Helper
|
||||||
|
|
||||||
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
@@ -84,6 +90,25 @@ feature -- Conversion
|
|||||||
create Result.make_from_string (string)
|
create Result.make_from_string (string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
html_encoded_name: READABLE_STRING_8
|
||||||
|
-- HTML encoded string `name'
|
||||||
|
do
|
||||||
|
Result := (create {HTML_ENCODER}).encoded_string (name)
|
||||||
|
end
|
||||||
|
|
||||||
|
html_encoded_string: READABLE_STRING_8
|
||||||
|
-- HTML encoded string `string'
|
||||||
|
do
|
||||||
|
Result := (create {HTML_ENCODER}).encoded_string (string)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Conversion
|
||||||
|
|
||||||
|
html_decoded_string (s: READABLE_STRING_GENERAL): READABLE_STRING_32
|
||||||
|
do
|
||||||
|
Result := (create {HTML_ENCODER}).general_decoded_string (s)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Visitor
|
feature -- Visitor
|
||||||
|
|
||||||
process (vis: WSF_VALUE_VISITOR)
|
process (vis: WSF_VALUE_VISITOR)
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ feature {WSF_SERVICE, WSF_RESPONSE} -- Output
|
|||||||
|
|
||||||
send_to (res: WSF_RESPONSE)
|
send_to (res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
b: like body
|
|
||||||
h: like header
|
h: like header
|
||||||
s: STRING_8
|
s: STRING_8
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -91,63 +91,97 @@ feature -- Decoder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
general_decoded_string (v: READABLE_STRING_GENERAL): STRING_32
|
||||||
|
-- The HTML-encoded equivalent of the given string
|
||||||
|
local
|
||||||
|
i, n: INTEGER
|
||||||
|
c: NATURAL_32
|
||||||
|
cl_i: CELL [INTEGER]
|
||||||
|
amp_code: NATURAL_32
|
||||||
|
do
|
||||||
|
has_error := False
|
||||||
|
n := v.count
|
||||||
|
create Result.make (n)
|
||||||
|
create cl_i.put (0)
|
||||||
|
amp_code := ('&').natural_32_code
|
||||||
|
from i := 1 until i > n loop
|
||||||
|
c := v.code (i)
|
||||||
|
if c = amp_code then
|
||||||
|
cl_i.replace (i)
|
||||||
|
Result.append_string_general (next_entity (v, cl_i))
|
||||||
|
i := cl_i.item
|
||||||
|
else
|
||||||
|
Result.append_character (c.to_character_32)
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation: decoder
|
feature {NONE} -- Implementation: decoder
|
||||||
|
|
||||||
next_entity (v: STRING_8; cl_i: CELL [INTEGER]): STRING_32
|
next_entity (v: READABLE_STRING_GENERAL; cl_i: CELL [INTEGER]): STRING_32
|
||||||
-- Return next entity value
|
-- Return next entity value
|
||||||
-- move index
|
-- move index
|
||||||
local
|
local
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
c: CHARACTER
|
l_code: NATURAL_32
|
||||||
is_char: BOOLEAN
|
is_char: BOOLEAN
|
||||||
is_hexa: BOOLEAN
|
is_hexa: BOOLEAN
|
||||||
s: STRING_32
|
s: STRING_32
|
||||||
|
sharp_code,
|
||||||
|
x_code,
|
||||||
|
semi_colon_code: NATURAL_32
|
||||||
do
|
do
|
||||||
|
sharp_code := ('#').natural_32_code
|
||||||
|
x_code := ('x').natural_32_code
|
||||||
|
x_code := (';').natural_32_code
|
||||||
|
|
||||||
i := cl_i.item
|
i := cl_i.item
|
||||||
create s.make_empty
|
create s.make_empty
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
if c = '#' then
|
if l_code = sharp_code then
|
||||||
is_char := True
|
is_char := True
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
if c = 'x' then
|
if l_code = x_code then
|
||||||
is_hexa := True
|
is_hexa := True
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_char then
|
if is_char then
|
||||||
if is_hexa then
|
if is_hexa then
|
||||||
from
|
from
|
||||||
until
|
until
|
||||||
not c.is_hexa_digit or c = ';'
|
not is_hexa_digit (l_code) or l_code = semi_colon_code
|
||||||
loop
|
loop
|
||||||
s.append_character (c)
|
s.append_code (l_code)
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
from
|
from
|
||||||
until
|
until
|
||||||
not c.is_digit or c = ';'
|
not is_digit (l_code) or l_code = semi_colon_code
|
||||||
loop
|
loop
|
||||||
s.append_character (c)
|
s.append_code (l_code)
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
from
|
from
|
||||||
until
|
until
|
||||||
not valid_entity_character (c) or c = ';'
|
not valid_entity_character (l_code) or l_code = semi_colon_code
|
||||||
loop
|
loop
|
||||||
s.append_character (c)
|
s.append_code (l_code)
|
||||||
i := i + 1
|
i := i + 1
|
||||||
c := v[i]
|
l_code := v.code (i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if c = ';' then
|
if l_code = semi_colon_code then
|
||||||
if is_char then
|
if is_char then
|
||||||
if is_hexa then
|
if is_hexa then
|
||||||
-- not yet implemented
|
-- not yet implemented
|
||||||
@@ -242,22 +276,37 @@ feature {NONE} -- Implementation: decoder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
valid_entity_character (c: CHARACTER): BOOLEAN
|
valid_entity_character (a_code: NATURAL_32): BOOLEAN
|
||||||
-- Is `c' a valid character in html entity value?
|
-- Is `c' a valid character in html entity value?
|
||||||
--| such as &
|
--| such as &
|
||||||
|
local
|
||||||
|
c: CHARACTER_8
|
||||||
do
|
do
|
||||||
inspect
|
if a_code.is_valid_character_8_code then
|
||||||
c
|
c := a_code.to_character_8
|
||||||
when 'a'..'z' then
|
inspect
|
||||||
Result := True
|
c
|
||||||
when 'A'..'Z' then
|
when 'a'..'z' then
|
||||||
Result := True
|
Result := True
|
||||||
when '0'..'9' then
|
when 'A'..'Z' then
|
||||||
Result := True
|
Result := True
|
||||||
else
|
when '0'..'9' then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_hexa_digit (c: NATURAL_32): BOOLEAN
|
||||||
|
do
|
||||||
|
Result := c.is_valid_character_8_code and then c.to_character_8.is_hexa_digit
|
||||||
|
end
|
||||||
|
|
||||||
|
is_digit (c: NATURAL_32): BOOLEAN
|
||||||
|
do
|
||||||
|
Result := c.is_valid_character_8_code and then c.to_character_8.is_digit
|
||||||
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Eiffel Software and others"
|
copyright: "2011-2012, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
4
precomp/build.bat
Normal file
4
precomp/build.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
echo Precompiling wsf
|
||||||
|
ec -config wsf-safe.ecf -precompile -c_compile -clean
|
||||||
|
ec -config wsf-mt-safe.ecf -precompile -c_compile -clean
|
||||||
|
ec -config wsf-scoop-safe.ecf -precompile -c_compile -clean
|
||||||
11
precomp/wsf-mt-safe.ecf
Normal file
11
precomp/wsf-mt-safe.ecf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="precomp_wsf-mt" uuid="72298F1A-98C7-4BED-8617-11DEFEFB625F" library_target="wsf-mt">
|
||||||
|
<target name="wsf-mt">
|
||||||
|
<root class="ANY"/>
|
||||||
|
<option full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||||
|
<assertions precondition="true"/>
|
||||||
|
</option>
|
||||||
|
<setting name="multithreaded" value="true"/>
|
||||||
|
<library name="wsf" location="../library/server/wsf/wsf-safe.ecf"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
10
precomp/wsf-safe.ecf
Normal file
10
precomp/wsf-safe.ecf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="precomp_wsf" uuid="3E534F9D-A25F-4CAF-8AAF-FF95DA8F8B64" library_target="wsf-safe">
|
||||||
|
<target name="wsf-safe">
|
||||||
|
<root class="ANY"/>
|
||||||
|
<option full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||||
|
<assertions precondition="true"/>
|
||||||
|
</option>
|
||||||
|
<library name="wsf" location="../library/server/wsf/wsf-safe.ecf"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
11
precomp/wsf-scoop-safe.ecf
Normal file
11
precomp/wsf-scoop-safe.ecf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-7-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-7-0 http://www.eiffel.com/developers/xml/configuration-1-7-0.xsd" name="precomp_wsf-scoop-safe" uuid="344344D6-5CA1-43B4-8D4B-CD1763883BE2" library_target="wsf-scoop-safe">
|
||||||
|
<target name="wsf-scoop-safe">
|
||||||
|
<root class="ANY"/>
|
||||||
|
<option full_class_checking="true" is_attached_by_default="true" void_safety="all">
|
||||||
|
<assertions precondition="true"/>
|
||||||
|
</option>
|
||||||
|
<setting name="concurrency" value="scoop"/>
|
||||||
|
<library name="wsf" location="../library/server/wsf/wsf-safe.ecf"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
Reference in New Issue
Block a user