Convert tag and setWebContextBuilder

View: New views
3 Messages — Rating Filter:   Alert me  

Convert tag and setWebContextBuilder

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm starting to use the dwr convert JSP tag (not checked in yet) and I have some custom converters that rely on WebContextFactory.get() to access the session etc.
So, is it safe for the tag to call WebContextFactory.setWebContextBuilder() so that the converters can get access to the WebContext.
Is this dangerous since the thread is not a thread managed by the DWR servlet?
I realise that there will be no script session at this point, is there anything else I might break by doing this?

Cheers,
Lance.


Re: Convert tag and setWebContextBuilder

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm not sure that there is anything wrong with what you want to do, but it's not the solution that I envisaged.
My recommendation would be that you do this, and use the built in WebContextBuilder:

Container c = ServerContextFactory.get().getContainer();
WebContextBuilder wcb = c.getBean(WebContextBuilder.class);
wcb.set(null, null, servletConfig, servletContext, container);

Joe.

On Mon, Jul 7, 2008 at 10:44 AM, Lance Java <lance.java@...> wrote:
I'm starting to use the dwr convert JSP tag (not checked in yet) and I have some custom converters that rely on WebContextFactory.get() to access the session etc.
So, is it safe for the tag to call WebContextFactory.setWebContextBuilder() so that the converters can get access to the WebContext.
Is this dangerous since the thread is not a thread managed by the DWR servlet?
I realise that there will be no script session at this point, is there anything else I might break by doing this?

Cheers,
Lance.



Re: Convert tag and setWebContextBuilder

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep, that's my solution with a wcb.unset(); in a finally block.
Great

2008/7/11 Joe Walker <joe@...>:

I'm not sure that there is anything wrong with what you want to do, but it's not the solution that I envisaged.
My recommendation would be that you do this, and use the built in WebContextBuilder:

Container c = ServerContextFactory.get().getContainer();
WebContextBuilder wcb = c.getBean(WebContextBuilder.class);
wcb.set(null, null, servletConfig, servletContext, container);

Joe.


On Mon, Jul 7, 2008 at 10:44 AM, Lance Java <lance.java@...> wrote:
I'm starting to use the dwr convert JSP tag (not checked in yet) and I have some custom converters that rely on WebContextFactory.get() to access the session etc.
So, is it safe for the tag to call WebContextFactory.setWebContextBuilder() so that the converters can get access to the WebContext.
Is this dangerous since the thread is not a thread managed by the DWR servlet?
I realise that there will be no script session at this point, is there anything else I might break by doing this?

Cheers,
Lance.



LightInTheBox - Buy quality products at wholesale price