Igor's Blog

WebLogic 12.1.2 may not be listed on Oracle Technology Network Downloads page but it is still being used. When it comes to RESTful services on WebLogic, 12.1.2 supports Jersey 1.13 so if you're looking to make use of Jersey 2.x features, there's some extra work to be done. With 12.1.3 you can go straight for Jersey 2.x but that's outside the scope of this article.

There is an upgrade guide for Jersey in the WebLogic 12.1.2 documentation but it doesn't cover upgrading to Jersey 2.x. That is exactly what I wanted to do however, the process is very similar to the 1.x upgrade.

My approach to using Jersey 2.x was to first package it as a shared library. I've previously covered how to package shared libraries for WebLogic deployment so will not cover it again here. How you package Jersey depends on the features you use, but in the minimum the following is required as a dependency (change version as required) - Servlet based server-side application...
 pom.xml Maven Dependency
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.25.1</version>
</dependency>


You're likely going to want other parts of Jersey as well, the modules list contains these. I had to use a number of media modules so I added those to my dependency list, e.g.
 Maven Dependency
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.25.1</version>
</dependency>
...


[Read More and Comment]  

, , , , ,

I've written an article last year about using Google DFP with AdSense on infinite scroll pages which worked very well and was the basis for a number of my own sites and projects. In the past week however I noticed that GPT, which is the JavaScript library used to create DFP ad slots, started behaving erratically.
Update: Looks like Google have fixed this problem as of 22 March 2017.


The very first thing that was noticeably different was that whenever an ad slot was loaded, the web browser window would scroll down to that ad immediately. This behaviour wasn't there before the 20th of March (version 111) release.

The new behaviour of course broke any infinite scroll page, including my example on GitHub. Because the page was automatically scrolling to the ad slot, it would trigger the infinite scroll content loading event, which would load/create more content and another ad slot. Once that ad slot loaded, the page would scroll to it too, would trigger more content loading, and so on. The video below shows this in action.



[Read More and Comment]  

, , , ,

I've recently discovered that on Mobile Safari the $(window).scrollTop() would not update during the scroll event animation. It appeared to only update after the scroll (the elastic scroll) had finished its animation. This was a rather annoying 'feature' for me because I needed to update my UI during the animation, so I went looking for a workaround and here's what I've come up with.

Below are two videos showing the before and after the workaround. The first video shows the default behaviour where scrollTop() is only updated after the scroll event completes, the second video shows a workaround that has continuous updates during scrolling.



This was my 'before' code:
 Before Code
<!DOCTYPE html>
<html lang="en">
<head>
<title>ScrollTop test</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<style>
div#message {
position: fixed;
right: 0;
top: 0;
color: red;
font-size: 300%;
}
</style>
</head>
<body>
<div id="body">
<div id="message"></div>
</div>
<div id="content" style="display: none; margin: 1em;"></div>
<script>
$(document).ready(function() {
/* generate some content */
for (var i = 0; i < 100; i++) {
$('#content').clone().text('Content item ' + i).show().appendTo($('#body'));
}
$(document).scroll(function(e) {
var scrollTop = $(window).scrollTop();
$('#message').text('Scroll Top: ' + scrollTop);
});
});
</script>
</body>
</html>


[Read More and Comment]  

, , , ,

Many of the plugins that would be used in a typical Maven setup provide an option to skip execution of that plugin via the <skip> configuration parameter or in the case of the Surefire plugin, the -DskipTests system property. Unfortunately some plugins, like the WebLogic Maven Plugin do not offer this facility.

I had a situation where I wanted each of the developers to be able to locally do a build and automatically deploy to WebLogic, but I didn't want jobs executed by the CI pipeline to do any automatic deployments. Since the WebLogic plugin didn't offer a skip option, I had to find another way.

What I ended up doing was changing the <phase> for the plugin to a variable instead of it being static. Something like this...
 Maven
<plugin>
...
<execution>
...
<phase>${skipPluginPhase}</phase>
...
</execution>
...
</plugin>


Then I could define the value for the skipPluginPhase property like...
 Maven
<properties>
<skipPluginPhase>none</skipPluginPhase>
</properties>


Leaving it as 'none' would skip plugin execution, whereas putting in a valid phase like 'install' would execute the plugin as expected. The only change each developer would need to do locally was update their version of the pom.xml file to reflect this.

To avoid unnecessary editing of the pom.xml file it is also possible to set up a number of different profiles in your Maven build. The default profile could then set skipPluginPhase to a valid phase name and a profile set up just for the CI pipeline could set skipPluginPhase to none, whereby skipping plugin execution.

[Read More and Comment]  

, ,
 
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Using Jersey 2.x as a shared library on WebLogic 12.1.2

Google DFP with AdSense fallback is causing infinite scroll pages to go haywire

Workaround for Mobile Safari scrollTop() not updating during scroll

Skipping execution of Maven plugins that do not have a native skip option

Unmarshalling an XML fragment representing a JAXB object without XmlRootElement

Injecting a ContainerRequestContext into a Jersey entity provider class

Obfuscating PHP source code with Maven and YAK Pro PO

Making use of corner shelves with easy to make slide out draws

Octotree breaks GitLab Issue Boards

Compiling the FHIR schema with XJC

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth

Friends

RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
     
...or subscribe for updates!

Don't show this again