users@grizzly.java.net

Re: [Q] Grizzlet access to server URL, client address, etc

From: ALT Mobile DEV <dev_at_altmobile.com>
Date: Mon, 7 Jan 2008 19:05:11 -0500

Hi,

I assume you want me to hack the source as GrizzletRequest.getRequest
() is protected.


com.sun.grizzly.tcp.Request is definately what I want. Thanks for
pointing me in the right direction.


--Zaid

http://altmobile.com




On Jan 7, 2008, at 5:26 PM, Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM
> wrote:

> Hi,
>
> ALT Mobile DEV wrote:
>> Hi and thank you for the superior implementation!
>> I was porting our yet-to-be-released Dynamic Mashup server from Sun
>> Labs' Brazil to Grizzly for its Comet support. In addition to
>> creating composite web sites, our Mashup technologies can
>> dynamically generate text-to-speech audio of the mash-up content.
>> This feature is in support of the visually impaired as well as
>> power users who want to listen to their aggregated data. Based on
>> the presence of URL parameters, the Mashup server will generate an
>> audio file and append an EMBED element to the mash-up content with
>> the URL to the audio file. For example, Element t_embedElement =
>> t_aDocument.createElementNS(null, "EMBED");
>> t_embedElement.setAttributeNS(null, "id", "tts-embed");
>> t_embedElement.setAttributeNS(null, "autostart", "true");
>> t_embedElement.setAttributeNS(null, "width", "200");
>> t_embedElement.setAttributeNS(null, "height", "20");
>> t_embedElement.setAttributeNS(null, "src", request.serverUrl() + "/
>> audio/" + t_audioIdString + ".aif");
>> A Brazil Handler/Servlet Request object provides a serverUrl()
>> which is seen above in the SRC attribute-- enabling any mash-up to
>> be audible.
>> Though it's easier to do this on server, I can of course generate a
>> JavaScript which would use document.URL. So that's why I need a
>> serverUrl() method. As for information about the client's IP
>> address and browser, our Mashup server technologies also uses geo-
>> location to provide contextual mash-up filtering and dynamic
>> content transcoding based on client capabilities. I have not tested
>> to see if Grizzlets support cookie access.
>
> You will have to do some Request manipulation (my next post will
> contains the code for doing that).
>
> OK as usual, the documentation is lacking :-( This is my resolution
> for this year....release 1.8.0 only based on documentation and bug
> fixes. For a workaround (until I implement the missing methods), you
> can do:
>
> import com.sun.grizzly.tcp.Request;
>
> ....
>
>
> Request request = asyncConnection.getRequest().getRequest();
> request.action(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_HOST_ATTRIBUTE);
> request.action(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE);
>
> and then invoking the method below will gives you what you are
> looking at:
>
> request.remoteAddr();
> request.remoteHost();
>
>
> Not simple, but at least you have a workaround until I implement
> those missing method and more important, documents them :-)
>
> Thanks!
>
> -- Jeanfrancois
>
>
>
>
>> Thanks again.
>> --Zaid
>> http://altmobile.com
>> On Jan 7, 2008, at 10:57 AM, Jeanfrancois Arcand wrote:
>>> Salut,
>>>
>>> Zaid Al-Timimi wrote:
>>>> it does not seem that a Grizzlet can access server or client info
>>>> from the AsyncConnection in onRequest(). Any way to get this?
>>>
>>> Good catch :-) This is missing right now. Can you tell me what you
>>> need exactly so I can add it to the truck so you aren't blocked?
>>>
>>> Thanks!
>>>
>>> -- Jeanfrancois
>>>
>>>
>>>> thanks.
>>>> --Zaid
>>>> http://altmobile.com <http://altmobile.com/>
>>>
>>> ---
>>> ------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>> <mailto: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
>