Skip to content

Instantly share code, notes, and snippets.

@gregw
gregw / logui
Created January 13, 2017 04:15
[2010] git log --all --graph --decorate --pretty='format:%C(yellow)%h%d %Cblue[%an]%Creset %s' | head -200
* 8921e3e (origin/master, origin/HEAD) [Simone Bordet] Merged branch 'jetty-9.4.x' into 'master'.
|\
| * df08f7f (origin/jetty-9.4.x) [Simone Bordet] Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.
| |\
| | * 2a416bb (HEAD -> jetty-9.3.x, origin/jetty-9.3.x) [Simone Bordet] Issue #1073 - JDK9 support in Jetty 9.3.x.
* | | f96939a [Simone Bordet] Fixed merge issues.
* | | b7b3dfd [Simone Bordet] Merged branch 'jetty-9.4.x' into 'master'.
|\ \ \
| |/ /
@gregw
gregw / TimeoutExample.java
Last active June 24, 2021 14:09
Timeout Listener Example
//
// ========================================================================
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
@gregw
gregw / VersionedJarFile.java
Created September 16, 2017 06:35
Alternate impl of VersionedJarFile that handles inner classes
package org.eclipse.jetty.util;
import java.util.Map;
import java.util.TreeMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.stream.Stream;
public class VersionedJarFile
{
@gregw
gregw / TestPackageLoading.java
Created October 10, 2017 05:50
Test of package loading
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
public class TestPackageLoading
{
@gregw
gregw / debug-2585
Created May 29, 2018 12:09
Test failure : HttpClientStreamTest.testInputStreamResponseListenerFailedBeforeResponse[transport: HTTP] #2585
2018-05-29 14:08:16.939:INFO::main: Logging initialized @258ms to org.eclipse.jetty.util.log.StdErrLog
Running org.eclipse.jetty.http.client.HttpClientStreamTest.testInputStreamResponseListenerFailedBeforeResponse[transport: HTTP]()
2018-05-29 14:08:17.110:DBUG:oejuc.ContainerLifeCycle:main: org.eclipse.jetty.server.Server@574caa3f[9.4.z-SNAPSHOT] added {QueuedThreadPool[server]@12f40c25{STOPPED,8<=0<=200,i=0,q=0}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$1/707806938@64cee07],AUTO}
2018-05-29 14:08:17.153:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.Server@574caa3f[9.4.z-SNAPSHOT]->QueuedThreadPool[server]@12f40c25{STOPPED,8<=0<=200,i=0,q=0}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$1/707806938@64cee07]
2018-05-29 14:08:17.153:DBUG:oejj.MBeanContainer:main: beanAdded null->org.eclipse.jetty.server.Server@574caa3f[9.4.z-SNAPSHOT]
2018-05-29 14:08:17.156:DBUG:oejj.ObjectMBean:main: ObjectMBean: mbeanFor org.eclipse.jetty.server.Server@574caa3f[9.4.z-SNAPSHOT] mClass=class or
@gregw
gregw / TimeoutFilter.java
Created May 31, 2018 09:39
Filter to timeout requests
package org.example;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@gregw
gregw / TimeoutFilter.java
Created May 31, 2018 16:31
No jetty classes timeout filter
package org.eclipse.jetty.servlets;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@gregw
gregw / TestMethodHandle.java
Created October 24, 2018 06:27
test of chaining method handles
import java.io.PrintStream;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import static java.lang.invoke.MethodHandles.empty;
import static java.lang.invoke.MethodType.methodType;
public class TestMethodHandle
{
@gregw
gregw / gist:61f923f825963addd0aaf036bb9ea8d7
Created November 3, 2018 16:54
hpack works with direct buffers
diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java
index ddb2c4a97d..438a5a7267 100644
--- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java
+++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java
@@ -357,16 +357,16 @@ public class Huffman
int current = 0;
int bits = 0;
- byte[] array = buffer.array();
+ byte[] array = buffer.hasArray()?buffer.array():null;
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:helpmojo (exec-plugin-doc) on project jetty-maven-plugin: Error extracting plugin descriptor: 'Goal: help already exists in the plugin descriptor for prefix: jetty
[ERROR] Existing implementation is: HelpMojo
[ERROR] Conflicting implementation is: org.eclipse.jetty.maven.plugin.HelpMojo'
[ERROR] -> [Help 1]