How to change 'Server' Header from Restlet 2.1 - spring

I'am using Restlet 2.1 with Spring 3 and I need to remove the header named Server with value Restlet-Framework/2.1.x.
I know this information come from ServerInfo.agent. A solution I found is to change the value in the Response object, but it could be difficult because I had a lot of resources.
The object Resolver seems to be interesting, but I don't really find how to use it.
I try to find a generic solution for all my resources. Ideally only change the spring configuration and let the IoC doing the job.

The ServerInfo is set on the SpringComponent. Maybe you can find the Spring Context where the ServerInfo instance is instanciated.

Related

Spring boot 2.4 Reverse document order

In spring boot 2.4, later loaded properties override earlier properties.
But, for my need, I am importing document inside document using spring.config.import. Say, import abc.properties from application.properties.
But, I need to override, later loaded properties with earlier loaded ones.
Say, application.properties should override abc.properties. not the other way arpund.
Please help me on how to do this.
Thanks in advance.
I resolved the issue with EnvironmentPostProcessor, as it seems to be not doable simply with spring.config.import.
As, both yaml (and in terns json) and properties, property source parser is readily available in spring boot, this required very little coding.

Spring Boot field watcher (observer) or something similar

How to run a method in Spring Boot when the value of concrete database field changed or it reached a certain level (programmatically)? The user wants to choose which field the method will respond to. Is there any common solution or best practice in Spring Boot?
I think what you are looking is reload a bean when the properties which are loading from db is changed. you can use something similar here in this stackoverflow post with ApplicationContextAware in prototype scope.

Register Jackson with wink using spring integration

I have developed a small RESTful web service using apache wink. I am using the spring integration module and define my rest services there. I am trying to add JSON support and have run into a small bug. When I try to return a java list with only 1 element in it, wink returns just the object instead of an array with 1 object in it. It seems this is a bug with the default JSON providers that come with wink.
So I have attempted to use Jackson as the wink JSON provider. I have found documentation of how to define a WinkApplication and set Jackson as the provider. This never gets used in my app and I believe it's because the winkCoreContext-server.xml file defines a Registrar instead of using the Application I defined.
Can anyone point me to some documentation or an example of how to use Jackson together with the spring integration module of Apache Wink?
I finally found a post that answered my question:
http://agoodexample.tumblr.com/
I needed to extend the wink-spring-integration Registrar class and add a setter for singletons then load my jackson provider through a reference.

Creating a PropertyOverrideConfigurer that takes values from the Database

Currently we have a PropertyOverrideConfigurer from Spring that is used to override some values of our configuration, the configuration is then used in Spring and Seam. Now I'd like to create an OverrideConfigurer that uses a DB connection managed by Seam to inject the overridden values into the configuration.
Is there already such a class or am I on my own?
I see that there is no support from Spring. Probably you need to do it yourself. This link may help you to confirm that you need do it yourself.

A heavily customized Spring Web application and the dispatcher servlet

We have a web application that uses spring, struts and camel right now and there is a lot of customization we have done to allow us to know when beans are added to the context.
So, we have gotten to a point where we would like to remove struts from the application, because we are only using it to handle actions and we figure we could either use spring or camel to do the same thing. So I was able to get it to work with camel/velocity, but we didn't like how we really couldn't use the request object directly in the jsp (afaik, you have to put everything in the header of the Exchange and in the jsp you would do ${header.someReqVariableName}).
So we wanted to go the spring route, but since we load the context.xml directly, we have a provider that extends ContextSingletonBeanFactoryLocator and we pass the xml file name as a param, we haven't been able to figure out how to get the DispatcherServlet to work without giving it another configuration xml.
Is there a way to either:
Have camel use jsp for processing a jsp (and have all the usage of jsp tags)?
or
Have spring to see that a context has already been loaded and use that instead of having another new one?
or
Something better I have thought up?
You can use camel-jetty to expose HTTP endpoints, but I wouldn't use it for any complex web app development (JPS, etc). I'd use use Spring MVC (or similar) and use Camel for any complex routing/messaging requirements...
Here is another way, you can use the producer template to send the request to the camel context if you can get the reference of the camel context from the spring.

Resources