Hi,
honestly, the best embedded http server framework was implemented in
Sun Labs' Brazil project by Stephen Uhler.
We use it to dynamically compose at runtime different handlers for
http content. So for example if for a server I wanted to enable file
access first and everything else to be processed by a JSON handler, I
can do this:
config.put ("handler", "simple");
config.put ("simple.class", "sunlabs.brazil.server.ChainHandler");
config.put ("simple.handlers", "file json");
config.put ("file.class", "sunlabs.brazil.server.FileHandler");
config.put ("json.class",
"com.altmobile.platform.webserver.brazil.handler.JSONHandler");
config.put ("serverClass", "com.altmobile...MashupServer");
so the line
config.put ("simple.handlers", "file json");
determines if there is a file handler and if so it's dynamically
installed for a specific HTTP server/port and that it's the first
handler to run. And in a more secure HTTP server/port, I can deny file
access by excluding the file handler.
Fully dynamic and configurable at runtime. Composition vs inheritance
of handlers.
Anyway, just some thoughts.
thanks as always.
--Zaid
http://altmobile.com/Home.html
On Jan 30, 2008, at 7:59 PM, Jeanfrancois Arcand wrote:
> Hi,
>
> ALT Mobile DEV wrote:
>> Hi,
>> you're correct :-)
>> I noticed in GrizzletContainer:
>> 119 adapter.setRootFolder(folder);
>
> Thanks for the fast turnaround. You are right I've changed the
> contract and forgot to add it to my emails. Shame on me :-(
>
>> which I think is a new API.
>> So for embedded Grizzly, we should be setting both:
>> selectorThread.setWebAppRootPath(folder);
>> and
>> adapter.setRootFolder(folder);
>
> Hum you are right but I don't like it :-) The idea here was to
> remove the dependency the StaticResourceAdapter had to the
> SelectorThread. I think the best solution is to change the Adapter
> API...but I will breaks a lot of customers :-)
>
> Thanks!!!!!
>
> -- Jeanfrancois
>
>
>> thanks.
>> --Zaid
>> http://altmobile.com/Home.html
>> On Jan 30, 2008, at 7:30 PM, Jeanfrancois Arcand wrote:
>>> Hi,
>>>
>>> ALT Mobile DEV wrote:
>>>> Hi,
>>>> Email runs slow... maybe java.net??
>>>
>>> Right
>>>
>>>> Anyway, no... the new r753 doesn't fix the priority of
>>>> StaticResources :-(
>>>
>>> Hum this is what I just did:
>>>
>>>> [ja120114_at_localhost comet]$ java -jar grizzly-comet-1.7-
>>>> SNAPSHOT.jar 8080 /grizzly/trunk/examples/grizzlet/chat/src/main/
>>>> webapp/ com.sun.grizzly.grizzlet.ChatGrizzlet
>>>> Launching Grizzlet: com.sun.grizzly.grizzlet.ChatGrizzlet
>>>> Server startup in 213 ms
>>>
>>> And then:
>>>
>>>> [ja120114@localhost ja120114]$ wget -SO result http://localhost:8080/index.html
>>>> --19:29:30-- http://localhost:8080/index.html
>>>> => `result'
>>>> Resolving localhost... done.
>>>> Connecting to localhost[127.0.0.1]:8080... connected.
>>>> HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK
>>>> 2 Content-Type: text/html
>>>> 3 Content-Length: 1637
>>>> 4 Date: Thu, 31 Jan 2008 00:29:30 GMT
>>>> 5 Connection: Keep-Alive
>>>> 100%
>>>> [=
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ===============================================================>]
>>>> 1,637 1.56M/s ETA 00:00
>>>> 19:29:30 (1.56 MB/s) - `result' saved [1637/1637]
>>>> [ja120114_at_localhost ja120114]$ cat result <?xml version="1.0"
>>>> encoding="UTF-8" ?>
>>>> <!DOCTYPE html
>>>> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>>>> <head>
>>>> <meta http-equiv="Content-Type" content="text/html;
>>>> charset=UTF-8" />
>>>> <title>Glassfish Chat</title>
>>>> <link rel="stylesheet" href="stylesheets/default.css" type="text/
>>>> css" />
>>>> <script type="text/javascript" src="javascripts/prototype.js"></
>>>> script>
>>>> <script type="text/javascript" src="javascripts/behaviour.js"></
>>>> script>
>>>> <script type="text/javascript" src="javascripts/moo.fx.js"></
>>>> script>
>>>> <script type="text/javascript" src="javascripts/moo.fx.pack.js"></
>>>> script>
>>>> <script type="text/javascript" src="javascripts/application.js"></
>>>> script>
>>>> </head>
>>>> <body>
>>>> <div id="container">
>>>> <div id="container-inner">
>>>> <div id="header">
>>>> <h1>Glassfish Chat</h1>
>>>> </div>
>>>> <div id="main">
>>>> <div id="display">
>>>> </div>
>>>> <div id="form">
>>>> <div id="system-message">Please input your name:</div>
>>>> <div id="login-form">
>>>> <input id="login-name" type="text" />
>>>> <br />
>>>> <input id="login-button" type="button" value="Login" />
>>>> </div>
>>>> <div id="message-form" style="display: none;">
>>>> <div>
>>>> <textarea id="message" name="message" rows="2" cols="40"></
>>>> textarea>
>>>> <br />
>>>> <input id="post-button" type="button" value="Post Message" />
>>>> </div>
>>>> </div>
>>>> </div>
>>>> </div>
>>>> </div>
>>>> </div>
>>>> <iframe id="comet-frame" style="display: none;"></iframe>
>>>> </body>
>>>> </html>
>>>
>>> How can I reproduce your issue?
>>>
>>> Thanks
>>>
>>> -- Jeanfrancois
>>>
>>>
>>>> --Zaid
>>>> http://altmobile.com
>>>> On Jan 30, 2008, at 1:48 PM, ALT Mobile DEV <dev_at_altmobile.com>
>>>> wrote:
>>>>> Hi and thanks for the reply.
>>>>>
>>>>> Ok. But has file access/static resource priority changed since
>>>>> no file resource is accessible and the Grizzlet is always invoked.
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>> --Zaid
>>>>>
>>>>> http://altmobile.com
>>>>>
>>>>>
>>>>> On Jan 30, 2008, at 11:19 AM, Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM
>>>>> > wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> have you updated the entire workspace? The class has moved from
>>>>>> http to http-utils:
>>>>>>
>>>>>> http://www.nabble.com/-FYI--New-higher-level-HTTP-classes%2C-new-modules-for-better-Grizzly-HTTP-extensions-td15166870.html
>>>>>>
>>>>>> I've just did an end to end build and didn't see any failures.
>>>>>> Can you try and let me know?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> -- Jeanfrancois
>>>>>>
>>>>>> ALT Mobile DEV wrote:
>>>>>>> Hi,
>>>>>>> was this intentional? Grizzlets are broken since:
>>>>>>> public class GrizzletAdapter extends StaticResourcesAdapter
>>>>>>> implements Adapter
>>>>>>> thanks.
>>>>>>> --Zaid
>>>>>>> http://altmobile.com/Home.html
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>