I think I figured it out. There are lots and lots of options :)
thanks though!
Richard
----- Original Message ----
From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
To: users_at_grizzly.dev.java.net
Sent: Monday, February 2, 2009 2:32:13 PM
Subject: Re: Grizzly and Servlet Adapter
Salut,
Richard Corsale wrote:
> Ok, so.. unless im missing something here, the servlet to adapter ration is 1:1 like i can only add one servlet to one adapter and I have to make a new adapter for each servlet?
Yes.
>
> If thats the case, whats the sadapter.addServletListener("API.Web.Servlets"); for? as shown in the latest example on http://weblogs.java.net/blog/jfarcand/archive/2009/01/extending_the_g_5.html
Can you elaborate? You add the listener to the Servlet you want via the ServletAdapter. An example can be seen here:
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/hudson/Hudson.html
A+
--Jeanfrancois
>
>
> --Thanks
> Richard
>
>
>
> ------------------------------------------------------------------------
> *From:* Survivant 00 <survivant00_at_gmail.com>
> *To:* users_at_grizzly.dev.java.net
> *Sent:* Saturday, January 31, 2009 7:28:11 PM
> *Subject:* php on GrizzlyWebServer 100%java with JSR 223
>
> I have something that can do PHP wihtout native php installation.
>
> I wasn't able to get Quercus servlet to work with GrizzlyWebServer, but I have a workaround for now that will allow the users to run php with the JSR223.
>
> you have a create a serlvet that you will use with GrizzlyWebServer (I'll post a complete demo on my blog later this weekend)
>
>
>
>
> protected void doPut (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
> System.out.println("doPut");
> Object php2javaResult = null;
> ScriptContext context = phpEngine.getContext();
>
> try {
> context.setWriter(new StringWriter());
> //put the parameters and attributes into the engine
> Enumeration attributes = req.getAttributeNames();
> while (attributes.hasMoreElements()) {
> String key = (String) attributes.nextElement();
> // put the parameters and attributes into the engine
> phpEngine.put(key, req.getAttribute(key));
> }
> Map<String, Object> params = req.getParameterMap();
> for (Iterator iterator = params.keySet().iterator(); iterator.hasNext();) {
> String key = (String) iterator.next();
> // put the parameters and attributes into the engine
> phpEngine.put(key, params.get(key));
> }
> // need a better way to find the requested file
> String uri = req.getRequestURI();
> if(uri.startsWith("/")){
> uri = uri.substring(1);
> }
> php2javaResult = phpEngine.eval(new FileReader(uri), context);
> //php2javaResult = phpEngine.eval(new FileReader("phpinfo.php"), context);
> StringWriter writer = (StringWriter) context.getWriter();
> res.getWriter().println(writer.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> protected void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
> doPut(req, res);
> }
>
>
> if I enter the URL :
> http://localhost/phpinfo.php?coucou&id=12 <http://localhost/phpinfo.php?coucou&id=12>
>
> the file phpinfo will be executed with the params in the URL.
>
>
> PS. if I need to put attributes in the response just tell me.. I did though about that.
>
> PS2 : if you need a complete solution... Glassfish with Quercus is one good solution.
>
> PS3 : I used Quercus librairies for this example.
>
> 2009/1/29 Richard Corsale <igf1_at_yahoo.com <mailto:igf1_at_yahoo.com>>
>
> Great tutorial man!! I was wondering about this very subject the
> other day.
>
> I still can't get my PHP scripts to run on Grizzly... I don't know
> why I wrote them in SQL?? :)
>
> --Richard
>
> ------------------------------------------------------------------------
> *From:* Survivant 00 <survivant00_at_gmail.com
> <mailto:survivant00_at_gmail.com>>
> *To:* users_at_grizzly.dev.java.net <mailto:users_at_grizzly.dev.java.net>
> *Sent:* Thursday, January 29, 2009 1:53:27 PM
> *Subject:* Demo : How to host jsp files with GrizzlyWebServer
>
> I did a little demo how to use JSP and GrizzlyWebServer.
>
> http://weblogs.java.net/blog/survivant/archive/2009/01/jsp_on_grizzlyw.html
>
> you won't do a complete web server with that.. but I'm sure you can
> still have fun :)
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
For additional commands, e-mail: users-help_at_grizzly.dev.java.net