Posts

Showing posts from August, 2018

Accessing HttpServletRequest in normal Java class

Accessing HttpServletRequest in normal Java class  Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. Recently i came across the situation at work where i need to access HttpServletRequest in a normal Java class inorder to get Ip Address from the request. In my normal Java class i do not have direct access to the request and hence i used the below code to do that. But the normal Java class should be the part of HttpServlet request thread. It means that the normal Java class is being called from a HttpServlet request thread. ServletRequest servletRequest = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); if(servletRequest instanceOf HttpServletRequest) {    ipAddress =  ((HttpServletRequest)request).getHeader(" X-Forwarded-For "); } if(ipAddress ...

Problems and Solutions regarding Fedora VM

Hi, This post addresses the problems developers face in Fedora VM in their daily work. How to configure proxies to get internet connection in Guest VM? - Login to Fedora VM. - Click on arrow symbol located next to Battery icon. It may differ according to the flavour of VM     that you use. - Choose Wired Connected -> Wired Settings - Go to Network proxy and click on Settings icon. - There you go!!! Choose option Manual and set Http and Https proxies. Now you could able to access the internet in Guest VM too. Please add your experiences too. It would be helpful for others. find . -name scooter\* - find a file in a directory from a command line sudo mount -t vboxsf projects /home/malathiboggavarapu/Shared - Mounts the folder projects to /home/malathiboggavarapu/Shared in Fedora cp [src][dest] - Copies the file from src to dest mv [src][dest] - Moves the file from src to dest history | grep mount - Find mount from history. If history contains some com...

Load Balancing using Spring Cloud Netflix Ribbon

Image
Hi, I am Malathi Boggavarapu working at Volvo Group and i live in Gothenburg, Sweden. I have been working on Java since several years and had vast experience and knowledge across various technologies. This post teaches you about how to acheive Client side LoadBalancing using SpringCloud Netflix Ribbon Api. So let's jump start into the details. First we learn what is meant by LaodBalancing and the differences between Client side and Server side Load Balancing and also we see which one is the best fit for MicroServices. What is Load Balancing Simply put, Load balancing is a way to improve distribution of work load across multiple computing resources -Wikipedia The most important thing you need to know is what role does Load balancing plays in cloud native architecture. It would be very clear if we understand the difference between load balancing in cloud and non-cloud native architecture. In non-cloud native application, we go from having multiple instances...