Posts

Showing posts from November, 2018

Casting ServletRequest to HttpServletRequest

Sometimes is a need to convert ServletRequest object into HttpServletRequest object, because, for example, we need more metadata about a request to get from. There is a simple way to do that (taken from Josh Long's course): // Let's check if request is of type HttpServletRequest Assert.isTrue(servletRequest instanceof HttpServletRequest, "this assumes you have an HTTP request"); // Now do casting HttpServletRequest httpServletRequest = HttpServletRequest.class.cast(servletRequest);

RabbitMQ and OpenShift

RedHat created very good launcher for a RabbitMQ cluster in OpenShift ( can be found here ). The problem I was stacked a little bit was creation of the cluster in an already created project. I found out that it is easy to do, just change slightly a all.yml file. --- openshift_cluster_content: # No need to create a new project #- object: projectrequest # content: # - name: rabbitmq-spaces # file: "{{ inventory_dir }}/../files/projects/projects.yml" # file_action: create - object: imagestream content: - name: rhel7 file: "{{ inventory_dir }}/../files/imagestreams/images.yml" namespace: scouting # Also important to fix deployment config template, which is located in the files/deployments/template.yml . The deployment will hook wrong image, so cluster won't build without the fix. Problem is in the naming of the image used to build rabbits. image: "${APPLICATION_NAME}:${RABBITMQ_VERSION}" Change to: image: ...

OANDA

Today started my acquaintance with online trading platform  OANDA . They give nice possibility to build and test trading bots. There is special place for developers. To start development I use Build Trading Bots in Java book. Unfortunately, API described in the book is deprecated now, however that's not a problem. I am looking for logic more.