All Downloads are FREE. Search and download functionalities are using the official Maven repository.

crafter.core.rest-context.xml Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <mvc:annotation-driven/>

    <bean id="crafter.cacheRestController" class="org.craftercms.core.controller.rest.CacheRestController">
        <property name="cacheTemplate" ref="crafter.cacheTemplate"/>
        <property name="storeService" ref="crafter.contentStoreService"/>
    </bean>

    <bean id="crafter.contentStoreRestController" class="org.craftercms.core.controller.rest.ContentStoreRestController">
        <property name="storeService" ref="crafter.contentStoreService"/>
    </bean>

    <bean id="crafter.coreObjectMapper" class="org.craftercms.commons.jackson.CustomSerializationObjectMapper">
        <property name="serializers">
            <list>
                <bean class="org.craftercms.core.util.json.jackson.Dom4jDocumentJsonSerializer"/>
            </list>
        </property>
    </bean>

    <!-- Main view resolver for REST services -->

    <bean id="crafter.mainViewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
        <property name="defaultViews">
            <list>
                <ref bean="crafter.jsonView"/>
                <ref bean="crafter.xmlView"/>
            </list>
        </property>
    </bean>

    <!-- JSON REST View -->

    <bean id="crafter.jsonView" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
        <property name="objectMapper" ref="crafter.coreObjectMapper"/>
        <property name="disableCaching" value="${crafter.core.rest.views.json.disableCaching}"/>
        <property name="prefixJson" value="${crafter.core.rest.views.json.prefixJson}"/>
        <property name="extractValueFromSingleKeyModel"
                  value="${crafter.core.rest.views.json.renderSingleAttributeAsRootObject}"/>
    </bean>

    <!-- XML REST View -->

    <bean id="crafter.xmlView" class="org.springframework.web.servlet.view.xml.MarshallingView">
        <constructor-arg>
            <bean class="org.craftercms.core.util.xml.marshalling.xstream.CrafterXStreamMarshaller">
                <property name="unsupportedClasses">
                    <array>
                        <value>org.springframework.validation.BindingResult</value>
                    </array>
                </property>
            </bean>
        </constructor-arg>
    </bean>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy