org.glassfish.jersey.examples.managedclient
Class CustomHeaderFilter

java.lang.Object
  extended by org.glassfish.jersey.examples.managedclient.CustomHeaderFilter
All Implemented Interfaces:
ClientRequestFilter, ContainerRequestFilter

public class CustomHeaderFilter
extends java.lang.Object
implements ContainerRequestFilter, ClientRequestFilter

A filter for appending and validating custom headers.

On the client side, appends a new custom request header with a configured name and value to each outgoing request.

On the server side, validates that each request has a custom header with a configured name and value. If the validation fails a HTTP 403 response is returned.

Author:
Marek Potociar (marek.potociar at oracle.com)

Constructor Summary
CustomHeaderFilter(java.lang.String headerName, java.lang.String headerValue)
           
 
Method Summary
 void filter(ClientRequestContext ctx)
           
 void filter(ContainerRequestContext ctx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomHeaderFilter

public CustomHeaderFilter(java.lang.String headerName,
                          java.lang.String headerValue)
Method Detail

filter

public void filter(ContainerRequestContext ctx)
            throws java.io.IOException
Specified by:
filter in interface ContainerRequestFilter
Throws:
java.io.IOException

filter

public void filter(ClientRequestContext ctx)
            throws java.io.IOException
Specified by:
filter in interface ClientRequestFilter
Throws:
java.io.IOException


Copyright © 2007-2013 Oracle Corporation. All Rights Reserved. Use is subject to license terms.