Marcel's Tech-Blog

Latest Posts

My first experiences with embedded Jetty

In this post I’d like to share my first experiences with embedded Jetty. During the last weeks I had a few small projects in mind to work on. Because I’m constantly working with web applications at work I wanted to use this knowledge for my projects. In my current project at work we use a proprietary web server which offers a hugh number of features I would never use in my small projects. Usally I work with Tomcat on private projects with success but there could be other possibilities to host static web pages or web applications. At least I heard about that ūüôā

Jetty

Jetty is a open-source project which enables you to provide a HTTP Server, HTTP Client and handle javax.servlet Container. You can start the standalone Java application via CLI and configure it as you like (see¬†Quickstart). I won’t write more about Jetty (standalone). If you’d like to go into details please use the¬†Projectpage or¬†documentation (recent Version¬†9.4.6).

Jetty Embedded

Unfortunately, I can’t remember where I found this quote (roughly translated).

Don’t prepare your application for deployment on a application server. Integrate the application server INTO your application.

At first I was sceptical about this mindset, because I only know otherwise from my project at work. We define/create EARs and WARs to deploy on the proprietary web server. But it looks like there are alternatives to consider. And that’s what I did.

Examples

For this post I worked with two simple implementations. Both examples were build with this Maven POM. Here the current and used Jetty Dependency.

Static HTTP Server

In this example I created a working File/Web Server with a some lines of code. A few adjustments later I was able to export this Server as a executable JAR in my folder of choice. Depending on the ResourceBase configuration you can turn this JAR into a portable WebServer of your current or specific path (here  "./src/webapp" ).

This Static HTTP Server can be used for two purposes. You can host a simple¬†File Server to display the Files contained within the current folder. Or you’ll use it as Web Server¬†to host your¬†WebContent¬†in your browser of choice. Without any further configuration¬†Jetty will scan your¬†ResourceBase for a index.html file. This file can easily turn your File Server into a Web Server. Even if you don’t provide a¬†index.html file you are still able to enable or force the¬†Web Server¬†to start with the¬† resource_handler.setWelcomeFiles(String[] welcomeFiles);¬†¬†configuration.

Some impressions.

REST Service

In my next project I’d like to create a REST Service. I’d like to increase the value of my project with portablitiy achived by combining¬†Jetty embeded with¬†Jersey. This combination was working after some lines of code like the Static HTTP Server.

DummyClass Servlet

With this small Class I build a simple Test Tool to check if the Servlet is working. At first I placed the DummyClass within my RESTServer Class as integrated class to keep everything in one file. This wasn’t working at all. That’s why I split it into separate files (see¬†Commit).

DummyClass integrated into the file RESTServer.class

RESTServer

You can access the server via port 8090 and Servlet path /dummy/test¬†. I did not verify if you need to call the method .setInitOrder(int order).¬†I found this configuration in this post¬†and didn’t investigate further, but I worked. ūüôā

successful REST access with DummyClass

next steps

With this knowledge I’m able to simply setup a FileServer, HttpServer or RESTService with Jetty. My future projects will benefit from this prototype. I look forward to implement my project to automate the manual actions of my¬†remote access to my Media Center via Owncloud.¬† I thought about a small webUI to show all available files and make them selectable. A REST Service will be triggered with these selections and start their convertion in the background. Depending on the fun I have with this project I might add additional features.

sources

I used those two to create this post.:

You can find the source files for this post in my github repository.

Remote access to my Media Center via Owncloud

In my last post I wrote about my own data-cloud. After several weeks of usage I found some aspects I’d like to combine. Before I had to travel a lot for work I used to watch movies and TV shows with my wife every evening. Because of the distance this is no longer possible, because we both are no longer at home during the week.

Now I’d like to stream my data via¬†Owncloud instead of existing data access. Sadly the internet connection of my hotel and her appartment is not suitable for Blu-Ray quality and size. Because of that I want to convert my existing files before streaming. At the moment all my media are .mkv files which are not supported by the Owncloud internal player (see¬†Server Enhancement Request). That’s why I won’t just reduce the file size and quality but also switch containers from .mkv to a¬†Owncloud Player compatible format.

In the process I don’t want to reduce my current (high quality) media so I have to create duplicates instead. Those shall be deleted after a certain time, like 30 days. Otherwise I’ll run into space problems on my¬†NAS.

This procedure I want to pursue:

Next to my orginal files, which are accessable via¬†Samba-Shares at my Owncloud instance, I will create one additional share. This new share will contain all converted files. I could continue to share my high quality files, but after this process I don’t see the point. Because neither the file size nor the format are suitable for sharing.

For the first prototyp I will convert the files manually with Handbrake and store them at the new location. I already thought of a way to automate this process. The first lines of code and concepts already exists. But at the moment they are not worth to talk about, because I want to evaluate some technologies I used only separatly. Now I want to combine them. In my next post I will reveil more.

My own data-cloud

I’d love to share data with friends and family. But the free services from¬†Dropbox, GoogleDrive¬†or¬†OneDrive¬†do not satisfy my needs. In this post I’d like to document my steps through setup and configuration of my Owncloud. (more…)

Shu-Ha-Ri, estimate like never before

This week I want to talk about¬†Shu-Ha-Ri and it’s meaning in my everyday life. In this post I won’t go into details about the way you learn new techniques. The focus will be on the way of thinking. To illustrate my point I will talk about a recent experience¬†with a customer.

(more…)

Eclipse Che and Neon are like potatos and apple juice

Also this week Eclipse Che will be topic of my blog. Last week I’ve talked about how you setup Eclipse Che. For my client presentation preparations I’ll compare¬†Che and¬†Neon in this post. (more…)

How you setup Eclipse Che on Windows/Linux

This week I want to share with you my experiences with the Eclipse¬†Che¬†setup and the problems I had during the installation on Windows and Linux (Ubuntu). (more…)

First experiences with remote-gaming by using Steam and Steam Link

This week I want to write about remote-gaming or inhouse-streaming because I’ve invested some time in this topic over the last weeks. In this post I’ll describe my expectations and difficulties I’ve experienced during the setup. (more…)

Welcome to my blog!

Hello,

my name is Marcel Hodan. I would like to introduce my self and the following content before the first post will be published. (more…)