<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Jaxrs on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/jaxrs/</link>
    <description>Recent content in Jaxrs on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #e9d956c0c0154a221ad83c925346a8fa0e72f866</copyright>
    <lastBuildDate>Sun, 18 Sep 2016 00:00:00 +0200</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/jaxrs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Creating Microservices with Bootique</title>
      <link>https://www.hascode.com/creating-microservices-with-bootique/</link>
      <pubDate>Sun, 18 Sep 2016 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/creating-microservices-with-bootique/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;When it comes to writing microservices in Java, plenty of tools and frameworks exist. In the following tutorial, I’d like to demonstrate another minimalistic framework called Bootique by implementing a simple microservice exposing its functions either as a RESTful web-service or as a runnable command executed using the command line.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;div class=&#34;title&#34;&gt;Bootique Command Line&lt;/div&gt;
&lt;p&gt;&lt;span class=&#34;image&#34;&gt;&lt;img src=&#34;bootique-command-line.png&#34; alt=&#34;bootique command line&#34;/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_dependencies&#34;&gt;Dependencies&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Using Maven here, we’re adding the following elements to our project’s &lt;em&gt;pom.xml:&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Bootiques Bill of Materials as dependency management: &lt;em&gt;bootique-bom&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bootique Jersey for our REST service: &lt;em&gt;bootique-jersey&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bootique Logback for logging: &lt;em&gt;bootique-logback&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://maven.apache.org/plugins/maven-shade-plugin/&#34;&gt;Maven Shade Plugin&lt;/a&gt; to assemble our fat-jar&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Creating REST Clients for JAX-RS based Webservices with Netflix Feign</title>
      <link>https://www.hascode.com/creating-rest-clients-for-jax-rs-based-webservices-with-netflix-feign/</link>
      <pubDate>Thu, 22 Oct 2015 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/creating-rest-clients-for-jax-rs-based-webservices-with-netflix-feign/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;For us developers there plenty of libraries exist helping us in deriving and generating clients for existing RESTful web-services and I have already covered some of the in this blog (e.g. the JAX-RS Client API). Nevertheless, I’d like to share my experience with another interesting lightweight library here: Netflix Feign.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Feign offers a nice fluent-builder API, a rich integration for  common libraries and APIs like JAX-RS, Jackson, GSON, SAX, JAX-B, OkHttp, Ribbon, Hystrix, SLF4J and more and last bot not least, it is setup easy and the service contracts are specified using interfaces and annotations.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Documenting RESTful Webservices in Swagger, AsciiDoc and Plain Text with Maven and the JAX-RS Analyzer</title>
      <link>https://www.hascode.com/documenting-restful-webservices-in-swagger-asciidoc-and-plain-text-with-maven-and-the-jax-rs-analyzer/</link>
      <pubDate>Tue, 16 Jun 2015 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/documenting-restful-webservices-in-swagger-asciidoc-and-plain-text-with-maven-and-the-jax-rs-analyzer/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;A variety of different tools exists to help us analyze RESTful web-services and create documentations for their APIs in different formats.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following tutorial I’d like to demonstrate how to document an existing JAX-RS web-service in multiple formats like Swagger, AsciiDoc or Plain Text using Maven, the JAX-RS Analyzer and the JAX-RS Analyzer Maven Plugin.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The JAX-RS Analyzer gathers its information not only by reflection like most other tools but also by bytecode analysis and therefore does not require us to add special annotations for documentation to our code.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>JAX-RS Server API Snippets</title>
      <link>https://www.hascode.com/jax-rs-server-api-snippets/</link>
      <pubDate>Sun, 28 Sep 2014 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/jax-rs-server-api-snippets/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Because a lot of my current projects are using JAX-RS in different versions I’d like to write down and share some frequently used snippets for implementing RESTful web-services with the JAX-RS specification here.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_using_regex_in_path_expressions&#34;&gt;Using RegEx in Path Expressions&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Sometimes we need to extract multiple parameters from a path expression e.g. in the following example where year, month and day are fragments if the path.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;@GET
@Path(&amp;#34;/orders/{year:\\d{4}}-{month:\\d{2}}-{day:\\d{2}}&amp;#34;)
@Produces(MediaType.TEXT_PLAIN)
public Response getOrders(@PathParam(&amp;#34;year&amp;#34;) final int year, @PathParam(&amp;#34;month&amp;#34;) final int month, @PathParam(&amp;#34;day&amp;#34;) final int day) {
	return Response.ok(&amp;#34;Year: &amp;#34; + year + &amp;#34;, month: &amp;#34; + month + &amp;#34;, day: &amp;#34; + day).build();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Java EE 7 Database Migrations with Liquibase and WildFly</title>
      <link>https://www.hascode.com/java-ee-7-database-migrations-with-liquibase-and-wildfly/</link>
      <pubDate>Thu, 31 Jul 2014 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/java-ee-7-database-migrations-with-liquibase-and-wildfly/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I have written about other database migration frameworks before but in this article I’d like to cover the Liquibase framework in combination with WildFly as Java EE 7 compatible application server.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following tutorial, we’re going to write a full Java EE 7 book store application with a few steps and with Liquibase on board to create the database structure and insert example data into the database.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Thanks to the WildFly Maven Plug-in we even do not need to download and configure the application server but let Maven and the plug-in do the work for us.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Java EE: Logging User Interaction the Aspect-Oriented Way using Interceptors</title>
      <link>https://www.hascode.com/java-ee-logging-user-interaction-the-aspect-oriented-way-using-interceptors/</link>
      <pubDate>Mon, 26 May 2014 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/java-ee-logging-user-interaction-the-aspect-oriented-way-using-interceptors/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Using dependency injection and aspect-oriented mechanisms like interceptors allow us to separate cross-cutting-concerns in our Java enterprise application, to control global aspects of our application and to avoid boilerplate code.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following short tutorial we’re going to create an aspect-oriented logger to protocol the initiating user, class and method called and the parameters passed to the method and finally we’re adding this interceptor to a sample RESTful web-service by adding a simple annotation.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>JAX-RS 2.0 REST Client Features by Example</title>
      <link>https://www.hascode.com/jax-rs-2.0-rest-client-features-by-example/</link>
      <pubDate>Mon, 30 Dec 2013 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/jax-rs-2.0-rest-client-features-by-example/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;JAX-RS 2.0 aka JSR 339 not also specifies the API to build up a RESTful webservice but also enhances the client side API to ease up the process of writing a client for a REST service.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following tutorial we’re building up a client for a ready-to-play REST service and explore the different new options e.g. how to handle requests in a synchronous or asynchronous way, how to add callback handlers for a request, how to specify invocation targets to build up requests for a later execution or how to filter the client-server communication using client request filters and client response filters.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Testing RESTful Web Services made easy using the REST-assured Framework</title>
      <link>https://www.hascode.com/testing-restful-web-services-made-easy-using-the-rest-assured-framework/</link>
      <pubDate>Sun, 23 Oct 2011 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/testing-restful-web-services-made-easy-using-the-rest-assured-framework/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;rest-service-testing-logo1.png&#34; alt=&#34;REST-assured Integration Test Tutorial Logo&#34; width=&#34;413&#34; height=&#34;265&#34;/&gt;
&lt;/div&gt;
&lt;div class=&#34;title&#34;&gt;Figure 1. REST-assured Integration Test Tutorial Logo&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There are many frameworks out there to facilitate testing RESTful
webservices but there is one framework I’d like to acquaint you with is my
favourite framework named REST-assured.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;REST-assured offers a bunch of nice features like a DSL-like syntax,
XPath-Validation, Specification Reuse, easy file uploads and those
features we’re going to explore in the following article.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;With a few lines of code and Jersey I have written a RESTful web service
that allows us to explore the features of the REST-assured framework and
to run tests against this service.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>REST-assured vs Jersey-Test-Framework: Testing your RESTful Web-Services</title>
      <link>https://www.hascode.com/rest-assured-vs-jersey-test-framework-testing-your-restful-web-services/</link>
      <pubDate>Mon, 05 Sep 2011 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/rest-assured-vs-jersey-test-framework-testing-your-restful-web-services/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Today we’re going to take a look at two specific frameworks that enables you to efficiently test your REST-ful services: On the one side there is the framework &lt;strong&gt;REST-assured&lt;/strong&gt; that offers a nice DSL-like syntax to create well readable tests – on the other side there is the &lt;strong&gt;Jersey-Test-Framework&lt;/strong&gt; that offers a nice execution environment and is built upon the JAX-RS reference implementation, Jersey.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;rest-service-testing-logo.png&#34; alt=&#34;rest service testing logo&#34;/&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following tutorial we’re going to create a simple REST service first and then implement integration tests for this service using both frameworks.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Creating a REST Client Step-by-Step using JAX-RS, JAX-B and Jersey</title>
      <link>https://www.hascode.com/creating-a-rest-client-step-by-step-using-jax-rs-jax-b-and-jersey/</link>
      <pubDate>Thu, 25 Nov 2010 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/creating-a-rest-client-step-by-step-using-jax-rs-jax-b-and-jersey/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Often in a developer’s life there is a REST service to deal with and nowadays one wants a fast and clean solution to create a client for such a service.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following tutorial shows a quick approach using JAX-RS with its reference implementation, Jersey in combination with JAX-B for annotation driven marshalling between XML or JSON structures and our Java-Beans.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following stuff is needed to run the following examples and code samples&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Java Snippets</title>
      <link>https://www.hascode.com/java-snippets/</link>
      <pubDate>Mon, 01 Mar 2010 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/java-snippets/</guid>
      <description>&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_remote_debug_a_pods_java_process&#34;&gt;Remote Debug a Pod’s Java Process&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Simple steps for remote debugging a Java process running on a k8 pod:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;Edit deployment and add the following parameters to the Java start line: &lt;code&gt;-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Also add the following port mapping at the section &lt;code&gt;container → ports&lt;/code&gt; in the deployment:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code&gt;- containerPort: 5005
  protocol: TCP&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Safe, wait for the new pods and then add a port forward for port 5005 for this pod:&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;kubectl port-forward podname 5005&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
