How to configure spring mvc project which contains controller both annotated and configured - spring-mvc

Can any one tell me, how to configure spring mvc project that contains controllers both annotated and configured??
I want to configure static pages using ParametrizedViewController and rest of all using Annotations.
But it is not working??
Please someone tell the configuration file(dispatcher-servlet.xml in my case) which will contain both this requirements.
Thanks in advance.

<!-- Registering MVC stuff necessary for #RequestMapping -->
<mvc:annotation-driven />
<!-- Your view controller definition -->
<mvc:view-controller path="/home" view-name="home" />

Related

Spring Security addFilterAfter using XML confirguation

I am currently using Spring Security 4 on Spring MVC. I try to config anti-CSRF using REST service, not servlet. This post is very useful but it uses Java configuration. How can I convert
http.addFilterAfter(new CsrfTokenResponseHeaderBindingFilter(), CsrfFilter.class);
into an XML configuration environment?
Thanks.
XML can be following for addfilterAfter()
<http>
<custom-filter after="BASIC_AUTH_FILTER" ref="myFilter" />
</http>
<beans:bean id="myFilter" class="org.security.filter.CustomFilter"/>
Hope it will help....

Spring MVC resource TAG in MVC configuration

I'm trying to find a clean solution to configure spring mvc to handle requests to static resources using the tag resources in my configuration.
It works well so far for simple configuration like:
<mvc:resources mapping="/img/**" location="file:${environment_variable}/mystaticfolder/img/" cache-period="31556926" />
<mvc:resources mapping="/css/**" location="file:${environment_variable}/mystaticfolder/css/" cache-period="31556926" />
and so on..
But i would like to be able to redirect the requests coming with a path containing "content" (always static files)+ specific_folder with some kind of regular expression (like rewrite rules).
For example:
<mvc:resources mapping="/content/${specificfolder}**"
location="file:${environment_variable}/content/${specificfolder}/" cache-period="31556926" />
Without doing a configuration for each folder under content.
Is that possible ?.
I could not find some detail about what i can put in the "location" attribute of the tag (a link could be useful too)
Thanks in advance for any tips you can share.
Regards.
S.

Spring mvc does not find my /opt/ path

I'm trying to access to static resources outside context root with spring mvc (yes, it's possible), but the "file:/opt/final-test/target/**" is red and I cannot access to anything. (404).
<mvc:resources mapping="/generatedThumbnails/" location="file:/opt/final-test/target/**" />
I already tried to put :
file:/opt/final-test/target/**
file:/opt/final-test/target/
file:/opt/final-test/target
but nothing is good.
Can you help me ? Thanks
Add two stars to the mapping /generatedThumbnails/** :
<mvc:resources mapping="/generatedThumbnails/**" location="file:/opt/final-test/target/**" />

Which are the classes used for User Authentication in alfresco.4.2.c in the case of External SSO?

I am trying to implement External SSO in alfresco share. I am using alfresco.4.2.c.
I want to enable debug mode for the classes which are using for Authentication in the case of External SSO.
So please let me know the class names which are using in External SSO.
Depends on which SSO you are integrating say OpenAM, CAS etc
SlingshotUserFactory class is used for default authentication in Alfresco Share
You can override its entry as below in share-config-custom.xml
<config evaluator="string-compare" condition="WebFramework">
<web-framework>
<!-- SpringSurf Autowire Runtime Settings -->
<!-- Developers can set mode to 'development' to disable; SpringSurf caches,
FreeMarker template caching and Rhino JavaScript compilation. -->
<defaults>
<page-type>
<id>login</id>
<page-instance-id>slingshot-login</page-instance-id>
</page-type>
<user-factory>webframework.factory.user.custom.slingshot
</user-factory>
</defaults>
</web-framework>
</config>
Add below entry in custom-slingshot-application-context.xml
<bean id="webframework.factory.user.custom.slingshot" class="com.test.web.site.ExtSlingshotUserFactory"
parent="webframework.factory.user.slingshot">
</bean>
now on login it will call your class for authentication

Web Flow view resolver problems

I have a sample application with web flows in a number of jars (extensions) and the configuration is loaded from the classpath this works fine. But I'm struggling with the view resolver configuration that will load the JSP's from the same location as the flow definitions on the classpath?
so I have the following folder structure on the classpath
MEAT-INF/config-webflow/ext1/ flow definition and JSP's for flow extension 1 are here
The web flow configuration works fine as I set this as flow-builder-services="flowBuilderServices" base-path="classpath*:/META-INF/config-webflow">
But as yet I can not come up with a view resolver configuration to load the JSP's
Any ideas?
I had the same problem. I discovered that you get the desired behaviour by NOT setting the normal Spring MVC 'viewResolver' bean on the MvcViewFactoryCreator.
<flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" development="true" />
<beans:bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator" />

Resources