2012-12-26

Adding Customized HTTP Header in HTTPServletRequest in Jetty

Sometimes we need Adding some customized HTTP header in Jetty's Request.

Here is a way to change Request.getHeader() using java.lang.instrument and javassist.




contents of MANIFEST.MF:


command to compile and pack jar:
javac -classpath ./javassist.jar HeaderAgent.java
jar -cmf MANIFEST.MF sslagent.jar HeaderAgent.class


adding following option to your java command, then Request.getHeader() method will be customized after Request.class loaded.
-javaagent:$HOME/bin/jettySSLPlugin/sslagent.jar

git@github.com:whunmr/jettyHeaderAgent.git

No comments:

Post a Comment