Register Jackson with wink using spring integration - spring

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.

Related

Can we convert fields to/from GemFire PdxSerializer using annotations or Java Reflection?

Currently we are using GemFire for caching. We are in our initial phase of integrating it.
While we are working on integrating GemFire using the Spring Data GemFire libraries, and using GemFire's PdxSerializer, too, I am wondering if there is a way to convert fields to/from PDXReader/PDXWriter using basic annotations and Java Reflection.
We are using Sprint Boot's 2.0.3.RELEASE JARs.
Note: I have looked at the below link:
https://gemfire.docs.pivotal.io/95/geode/developing/data_serialization/auto_serialization.html
I am more curious how to use a non-XML way of doing this.
Have a look at the following:
SDG's o.s.d.g.mapping.MappingPdxSerializer as described in the documentation.
Then read how to configure it.
If you are using Spring Boot for Pivotal GemFire, then PDX is auto-configured automatically, by default, for you and you do not need to explicitly declare SDG's #EnablePdx annotation.
NOTE: SDG's MappingPdxSerializer, when configured and registered with Pivotal GemFire, automatically de/serializes your application domain object types without any special config, like you have to do when using GemFire's own ReflectionBasedAutoSerializer and clumsy REGEX to identify your types properly, blah! SDG's MappingPdxSerializer is much more robust, using first-class filters to express exclusions and even inclusions (which can override the default exclusions, that is any class types in java.*, com.gemstone.gemfire.*, org.apache.geode.* or org.springframework.*, by default).
Anyway...
Take 2 pills and call me in the morning - the "doc", ;-)

Spring boot , Elasticsearch

Searched over the net but unable to find the satisfying approach.
I am new to spring boot and aware of starter dependancies,
I want to develop a springboot app using elastic search as a storage system.
Wherever i searched i found that somewhere my service class will have to implement some interface from springframework for ES crud operations.
Is there any other way without implementing or extending the components.
I myself want to create transport client and want to query ES by my code or methods not by overidden ones.
Please if you ahve ever seen any projects you can redirect me to that link .
Thanks.
Assuming I understand you correctly, you can use the Elasticsearch REST client: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html
You supply the JSON entities for the queries and parse the responses yourself. Its pretty basic in what it does, so you're not dependent on a lot of third party stuff to perform operations.

How to change 'Server' Header from Restlet 2.1

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.

Does Spring contain something similar to BeanUtils populate method?

I'm trying to populate a pojo with data from a map. I can use Apache Commons but I'm curious if Spring also has an implementation built in.
I know Spring must contain a method that does this mapping; spring integration inbound http gateways will map HTTP payloads to a POJO (request-payload-type).
Is BeanUtils the de facto standard for doing exactly what I want?
Spring Integration has this one MapToObjectTransformer and it's logic is the same as it is in the case of Spring MVC - DataBinder.
So, I suppose it would be enough just read source code of MapToObjectTransformer.
Spring also contains the BeanUtils.
Refer the following link:
org.springframework.beans.BeanUtils

How to build any framework so that framework user does not need to learn any underlying frameworks used in building the framework?

I am involved in building framework offering financial, non financial mobile services.
Underlying technology we are using is Spring 3.2 framework , especially Spring MVC.
Now Spring MVC offers many features by way of annotations.for example, to create controller just annotate class with #Controller annotation and you are done.besides this, there are many more things like handlers,adapters, exception resolver.
My question is.
As I already leveraged Spring framework and I know how to use Spring framework or customize by available hook points.and I might had did it but what about my framework users.
Should I create wrappers on above offerings by Spring so that my framework user does not need to know or learn Spring framework?
For example, Spring provides flexibility to register exception handlers to handle exceptions but for that we need to create bean entry for required exception handler and need to register in exception resolvers class and its his job to dig into Spring details to get idea how they have provided exception handlers and all those stuff.
He needs to do exactly same as I already did.
instead of that Should I provide some provision so that user just can define bean entry for their exception handler and register it in my framework provided registry, not in Spring provided bean class?|
Spring already provide all those features, is widely used, is well documented, have thriving community, etc.
You should expose them directly so the user of your framework can easily adapt to your framework.
You should not try to hide Spring.
No matter how hard you try, your abstraction will leak,
and then the API users will need to know Spring anyway.
See http://www.joelonsoftware.com/articles/LeakyAbstractions.html

Resources