|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAbstractController
org.directwebremoting.spring.DwrController
public class DwrController
A Spring Controller that handles DWR requests.
Using this controller allows you to configure DWR entirely in Spring. You do not have to create
a separate dwr.xml
configuration file when using this controller.
The following configuration provides a basic example of how too define this controller as a bean
in your application context.
In the near future we want to provide a DWR namespace for Spring, which should allow you to
something like the following:
<bean id="dwrController" class="org.directwebremoting.spring.DwrController">
<property name="configurators">
<list>
<ref bean="dwrConfiguration"/>
</list>
</property>
<property name="debug" value="true"/>
</bean>
<bean id="dwrConfiguration" class="org.directwebremoting.spring.SpringConfigurator">
<property name="creators">
<map>
<entry key="mybean">
<bean class="org.directwebremoting.spring.CreatorConfig">
<property name="creator">
<bean class="org.directwebremoting.spring.BeanCreator">
<property name="bean" ref="myBean"/>
</bean>
</property>
</bean>
</entry>
</map>
</property>
</bean>
<-- the bean you want to remote using DWR -->
<bean id="myBean" class="MyBean"/>
Which should be equivalent to the previous example. Please note that this is still work in progress
and is therefore subject to change.
<dwr:configuration>
<debug/>
</dwr:configuration>
<-- the bean you want to remote using DWR -->
<bean id="myBean" class="MyBean">
<dwr:remote javascript="mybean"/>
</bean>
Field Summary | |
---|---|
protected WebContextFactory.WebContextBuilder |
webContextBuilder
The builder for the WebContext that keeps http objects local to a thread |
Constructor Summary | |
---|---|
DwrController()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Is called by the Spring container after all properties have been set. |
protected ModelAndView |
handleRequestInternal(HttpServletRequest request,
HttpServletResponse response)
Handles all request to this controller. |
void |
setBeanFactory(BeanFactory beanFactory)
Is called by the Spring container to set the bean factory. |
void |
setBeanName(java.lang.String name)
Is called by the Spring container to set the name of this bean. |
void |
setConfigParams(java.util.Map configParams)
Additional parameters such as pollAndCometEnabled. |
void |
setConfigurators(java.util.List configurators)
Sets the configurators to apply to this controller. |
void |
setDebug(boolean debug)
Sets whether DWR should be in debug mode (default is false ). |
void |
setIncludeDefaultConfig(boolean includeDefaultConfig)
Sets whether the default DWR configuration should be included (default is true ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected WebContextFactory.WebContextBuilder webContextBuilder
WebContext
that keeps http objects local to a thread
WebContext
Constructor Detail |
---|
public DwrController()
Method Detail |
---|
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeansException
org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
public void setDebug(boolean debug)
false
). /[app-ctx]/dwr/
.
NOTE: make sure to not set this property to true
in a production environment.
debug
- the indication of whether to start DWR in debug modepublic void setConfigurators(java.util.List configurators)
configurators
- the configurators to apply to this controllerpublic void setIncludeDefaultConfig(boolean includeDefaultConfig)
true
).
includeDefaultConfig
- the indication of whether to include the default configurationpublic void afterPropertiesSet() throws java.lang.Exception
java.lang.Exception
- in case setting up failsorg.springframework.beans.factory.InitializingBean#afterPropertiesSet()
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws java.lang.Exception
UrlProcessor
and also takes case of setting and unsetting of the
current WebContext
.
request
- the request to handleresponse
- the reponse to handle
java.lang.Exception
- in case handling of the request fails unexpectedlyWebContext
public void setBeanName(java.lang.String name)
name
- the name of this bean in the Spring containerBeanNameAware#setBeanName(String)
public void setConfigParams(java.util.Map configParams)
configParams
- the configParams to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |