Refine search
@Override protected BasicHttpProcessor createHttpProcessor() { BasicHttpProcessor httpproc = new BasicHttpProcessor(); httpproc.addInterceptor(new RequestDefaultHeaders()); // Required protocol interceptors httpproc.addInterceptor(new RequestContent()); httpproc.addInterceptor(new RequestTargetHost()); // Recommended protocol interceptors httpproc.addInterceptor(new RequestConnControl()); httpproc.addInterceptor(new RequestUserAgent()); httpproc.addInterceptor(new RequestExpectContinue()); // HTTP state management interceptors httpproc.addInterceptor(new RequestAddCookies()); httpproc.addInterceptor(new ResponseProcessCookies()); // HTTP authentication interceptors httpproc.addInterceptor(new RequestTargetAuthentication()); httpproc.addInterceptor(new RequestProxyAuthentication()); return httpproc; }
public final void addInterceptor(final HttpRequestInterceptor interceptor, int index) { addRequestInterceptor(interceptor, index); }
/** * Same as {@link #addResponseInterceptor(HttpResponseInterceptor) addResponseInterceptor}. * * @param interceptor the interceptor to add */ public final void addInterceptor(final HttpResponseInterceptor interceptor) { addResponseInterceptor(interceptor); }
/** * Clears both interceptor lists maintained by this processor. */ public void clearInterceptors() { clearRequestInterceptors(); clearResponseInterceptors(); }
/** * Creates a copy of this instance * * @return new instance of the BasicHttpProcessor */ public BasicHttpProcessor copy() { BasicHttpProcessor clone = new BasicHttpProcessor(); copyInterceptors(clone); return clone; }
public synchronized void addResponseInterceptor(final HttpResponseInterceptor itcp, int index) { getHttpProcessor().addInterceptor(itcp, index); }
private synchronized HttpProcessor getProtocolProcessor() { if (protocolProcessor == null) { // Get mutable HTTP processor final BasicHttpProcessor proc = getHttpProcessor(); // and create an immutable copy of it final int reqc = proc.getRequestInterceptorCount(); final HttpRequestInterceptor[] reqinterceptors = new HttpRequestInterceptor[reqc]; for (int i = 0; i < reqc; i++) { reqinterceptors[i] = proc.getRequestInterceptor(i); } final int resc = proc.getResponseInterceptorCount(); final HttpResponseInterceptor[] resinterceptors = new HttpResponseInterceptor[resc]; for (int i = 0; i < resc; i++) { resinterceptors[i] = proc.getResponseInterceptor(i); } protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors); } return protocolProcessor; }
/** * Override just to set RequestContent(true) */ @Override protected BasicHttpProcessor createHttpProcessor() { final BasicHttpProcessor parentHttpProcessor = super.createHttpProcessor(); for (int i = 0; i < parentHttpProcessor.getRequestInterceptorCount(); i++) { final HttpRequestInterceptor requestInterceptor = parentHttpProcessor.getRequestInterceptor(i); //Replace the existing RequestContent interceptor with a version that sets overwrite=true if (requestInterceptor instanceof RequestContent) { parentHttpProcessor.removeRequestInterceptorByClass(RequestContent.class); parentHttpProcessor.addInterceptor(new RequestContent(true), i); break; } } return parentHttpProcessor; } }
Object obj = list.get(i); if (obj instanceof HttpRequestInterceptor) { addInterceptor((HttpRequestInterceptor)obj); addInterceptor((HttpResponseInterceptor)obj);
public synchronized HttpRequestInterceptor getRequestInterceptor(int index) { return getHttpProcessor().getRequestInterceptor(index); }
public synchronized int getRequestInterceptorCount() { return getHttpProcessor().getRequestInterceptorCount(); }
public synchronized void clearRequestInterceptors() { getHttpProcessor().clearRequestInterceptors(); }
public synchronized void clearResponseInterceptors() { getHttpProcessor().clearResponseInterceptors(); }
/** * {@inheritDoc} */ @Override protected BasicHttpProcessor createHttpProcessor() { final BasicHttpProcessor result = super.createHttpProcessor(); result.addRequestInterceptor(new RequestAcceptEncoding()); result.addResponseInterceptor(new ResponseContentEncoding()); return result; }
public synchronized void addRequestInterceptor(final HttpRequestInterceptor itcp) { getHttpProcessor().addInterceptor(itcp); }
/** * Creates a copy of this instance * * @return new instance of the BasicHttpProcessor */ public BasicHttpProcessor copy() { BasicHttpProcessor clone = new BasicHttpProcessor(); copyInterceptors(clone); return clone; }
private synchronized HttpProcessor getProtocolProcessor() { if (protocolProcessor == null) { // Get mutable HTTP processor final BasicHttpProcessor proc = getHttpProcessor(); // and create an immutable copy of it final int reqc = proc.getRequestInterceptorCount(); final HttpRequestInterceptor[] reqinterceptors = new HttpRequestInterceptor[reqc]; for (int i = 0; i < reqc; i++) { reqinterceptors[i] = proc.getRequestInterceptor(i); } final int resc = proc.getResponseInterceptorCount(); final HttpResponseInterceptor[] resinterceptors = new HttpResponseInterceptor[resc]; for (int i = 0; i < resc; i++) { resinterceptors[i] = proc.getResponseInterceptor(i); } protocolProcessor = new ImmutableHttpProcessor(reqinterceptors, resinterceptors); } return protocolProcessor; }
protected HttpServerConnectionUpnpStream(ProtocolFactory protocolFactory, HttpServerConnection connection, final HttpParams params) { super(protocolFactory); this.connection = connection; this.params = params; // The Date header is recommended in UDA, need to document the requirement in StreamServer interface? httpProcessor.addInterceptor(new ResponseDate()); // The Server header is only required for Control so callers have to add it to UPnPMessage // httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); httpService = new UpnpHttpService( httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory() ); httpService.setParams(params); }
public synchronized HttpRequestInterceptor getRequestInterceptor(int index) { return getHttpProcessor().getRequestInterceptor(index); }
public synchronized int getRequestInterceptorCount() { return getHttpProcessor().getRequestInterceptorCount(); }