users@grizzly.java.net

grizzly http embed questions

From: rama <rama.rama_at_tiscali.it>
Date: Sat, 29 Nov 2008 19:19:27 +0100

Dear friends of grizzly community, i need some help to better
understand grizzly http embed.

so, let's start :)

Question 1:
i want to setup a webserver, port 7777 that server a certain path

String root1 = "/Users/ramarama/root";
String root2 = "/Users/ramarama/root2";
                
GrizzlyWebServer ws = new GrizzlyWebServer(8080,10,root1);

when a file is not present on /Users/ramarama/root
i want that webserver try to take a look on root2.
Seems quite easy to do, but i don't get if there is a good way to do
it :)
(btw, don't propose solution like "do a ls -n or whatever" this is
just a learing session of grizzly http embed library)

I can identify the file, in request method, then i can read it and
wrote the answare on response...
but, if i do that, i will not be able to use caching system or all
fancy things like that isn't it?

--
ws.addGrizzlyAdapter(new GrizzlyAdapter(){
                 public void service(GrizzlyRequest request,  
GrizzlyResponse response){
                     try {                 	
			//should come here for file not found
                     } catch (IOException ex) {
                     	
                     }
                 }
             });
Question 2:
The easy one, to take a bit of relax before question number 3.
how do i change the default filename?
right now is index.html, i want to change it with foobar.xhtml just  
because i am strange :)
Question 3:
Suppose that i want to handle a particular situation.
I want that all request do at localhost/virtual
return a "hello guy" and bypass the static file services.
Question 4:
Suppose that i want to handle a particular extension (similar to case  
of above)
i want that all request do at localhost/file.exotic
will be handled in a certain way.
my bet for 3-4 is using an async filter, that parse for the name of  
the file or for the extension (ie, a reqular expression?)
then, if there is a match, simply write "heay" to response, and  
return false (returning false, will be block the grizzlyadapter sync  
block right?)
Question 5:
How can i start a grizzlyWebserver on port 443 with ssl support,  
using certificate stuff?
Not a real question, but
import com.sun.grizzly.http.AsyncFilter;
is deprecated?
if yes, and i want to use the asyncfilter (for question3 and 4) how i  
can proceed? it's normal that is deprecated, and i should use it
without any problem, or there is something that i miss?
Tnx to all for the patience, and sorry for my terrible english, i  
hope that i haven't do too much mistake :)
Matteo