March 17, 2017

Subscription Management in RHEL 7

Register first, then manually add a subscription.

# subscription-manager register

List all available subscription.

# subscription-manager list --available --all

Attach a specific subscription.

# subscription-manager attach --pool=XXXXXXXXXXXXXX

Verify that you now have access to subscribed rpm repos.

# yum repolist

Debugging HTTP Request in JBoss EAP 7

<subsystem xmlns="urn:jboss:domain:undertow:3.1">
    ...
    <server name="default-server">
        ...
        <host name="default-host" alias="localhost">
            ...
            <filter-ref name="request-dumper"/>
        </host>
    </server>
    ...
    <filters>
        ...
        <filter name="request-dumper" class-name="io.undertow.server.handlers.RequestDumpingHandler" module="io.undertow.core"/>
    </filters>
</subsystem>

How to Set Hostname on RHEL 7

To change permanent:

# hostnamectl set-hostname openam.example.com

Reboot and verify.

# hostnamectl status

January 23, 2017

Elliptic Curve Keys with OpenSSL

List pre-defined curves in OpenSSL:

Generate private key:

Generate public key:

Reference: https://wiki.openssl.org/index.php/Command_Line_Elliptic_Curve_Operations

January 12, 2017

Jackson Standard JSON library for Java

Introduction

Jackson is build up by the following modules:

  • Streaming: "jackson-core"
  • Annotations: "jackson-annotations"
  • Databind: "jackson-databind" implements data-binding (and object serialization)

Maven

Jackson JSON Parser and Generator

To do JSON parsing and generation you only need one class com.fasterxml.jackson.databind.ObjectMapper.

To parse a json file.

And to generate json.

Different ObjectMapper#readValue(...) and ObjectMapper#writeValue(...)

Different parse methods:

  • com.fasterxml.jackson.databind.ObjectMapper.readValue(File, Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(URL, Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(String, Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(Reader, Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(InputStream, Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(byte[], Class)
  • com.fasterxml.jackson.databind.ObjectMapper.readValue(DataInput, Class)

Different generation methods:

  • com.fasterxml.jackson.databind.ObjectMapper.writeValue(File, Object)
  • com.fasterxml.jackson.databind.ObjectMapper.writeValue(OutputStream, Object)
  • com.fasterxml.jackson.databind.ObjectMapper.writeValue(DataOutput, Object)
  • com.fasterxml.jackson.databind.ObjectMapper.writeValue(Writer, Object)
  • com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(Object)
  • com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes(Object)

Configure ObjectMapper