protected HttpResponseFactory createHttpResponseFactory() { return new DefaultHttpResponseFactory(); }
public HttpResponse newHttpResponse(final StatusLine statusline, HttpContext context) { if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } final Locale loc = determineLocale(context); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
this.connmanager.process(conn); } catch (RejectedExecutionException e) { conn.sendResponse(new DefaultHttpResponseFactory().newHttpResponse( HttpVersion.HTTP_1_0, HttpStatus.SC_SERVICE_UNAVAILABLE, new BasicHttpContext(null)));
this.connmanager.process(conn); } catch (RejectedExecutionException e) { conn.sendResponse(new DefaultHttpResponseFactory().newHttpResponse( HttpVersion.HTTP_1_0, HttpStatus.SC_SERVICE_UNAVAILABLE, new BasicHttpContext(null)));
@Override protected String sendAndReturn(final HttpUriRequest request) throws IOException { final HttpResponseFactory factory = new DefaultHttpResponseFactory(); final HttpResponse response = factory.newHttpResponse( new BasicStatusLine(HttpVersion.HTTP_1_1, this.status, null), null); final StringBuilder sb = new StringBuilder(); sb.append(String.format("%s = %s;", "METHOD", request.getMethod())); sb.append(String.format("%s = %s;", "URI", request.getURI())); final HttpEntity entity = ((HttpEntityEnclosingRequestBase) request).getEntity(); sb.append(String.format("%s = %s;", "BODY", EntityUtils.toString(entity))); response.setEntity(new StringEntity(sb.toString())); return parseResponse(response); }
public HttpResponse newHttpResponse(final ProtocolVersion ver, final int status, HttpContext context) { if (ver == null) { throw new IllegalArgumentException("HTTP version may not be null"); } final Locale loc = determineLocale(context); final String reason = reasonCatalog.getReason(status, loc); StatusLine statusline = new BasicStatusLine(ver, status, reason); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
httpproc.addInterceptor(new ResponseConnControl()); BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(httpproc, new DefaultHttpResponseFactory(), new DefaultConnectionReuseStrategy(), params);
public HttpResponse newHttpResponse(final StatusLine statusline, HttpContext context) { if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } final Locale loc = determineLocale(context); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
httpproc.addInterceptor(new ResponseConnControl()); BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(httpproc, new DefaultHttpResponseFactory(), new DefaultConnectionReuseStrategy(), params);
public HttpResponse newHttpResponse(final StatusLine statusline, HttpContext context) { if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } final Locale loc = determineLocale(context); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
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 HttpResponse newHttpResponse(final StatusLine statusline, HttpContext context) { if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } final Locale loc = determineLocale(context); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
public ListenerThread(HttpRequestHandler requestHandler, int port) { _executor = Executors.newCachedThreadPool(new NamedThreadFactory("Cluster-Listener")); try { _serverSocket = new ServerSocket(port); } catch (IOException ioex) { s_logger.error("error initializing cluster service servlet container", ioex); return; } _params = new BasicHttpParams(); _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000) .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024) .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false) .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1"); // Set up the HTTP protocol processor BasicHttpProcessor httpproc = new BasicHttpProcessor(); httpproc.addInterceptor(new ResponseDate()); httpproc.addInterceptor(new ResponseServer()); httpproc.addInterceptor(new ResponseContent()); httpproc.addInterceptor(new ResponseConnControl()); // Set up request handlers HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry(); reqistry.register("/clusterservice", requestHandler); // Set up the HTTP service _httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory()); _httpService.setParams(_params); _httpService.setHandlerResolver(reqistry); }
public HttpResponse newHttpResponse(final StatusLine statusline, HttpContext context) { if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } final Locale loc = determineLocale(context); return new BasicHttpResponse(statusline, reasonCatalog, loc); }
public ListenerThread(final ApiServer requestHandler, final int port) { try { _serverSocket = new ServerSocket(port); } catch (final IOException ioex) { s_logger.error("error initializing api server", ioex); return; } _params = new BasicHttpParams(); _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000) .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024) .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false) .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1"); // Set up the HTTP protocol processor final BasicHttpProcessor httpproc = new BasicHttpProcessor(); httpproc.addInterceptor(new ResponseDate()); httpproc.addInterceptor(new ResponseServer()); httpproc.addInterceptor(new ResponseContent()); httpproc.addInterceptor(new ResponseConnControl()); // Set up request handlers final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry(); reqistry.register("*", requestHandler); // Set up the HTTP service _httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory()); _httpService.setParams(_params); _httpService.setHandlerResolver(reqistry); }
@Override public HttpResponse newHttpResponse( final StatusLine statusline, final HttpContext context) { Args.notNull(statusline, "Status line"); return new BasicHttpResponse(statusline, this.reasonCatalog, determineLocale(context)); }
public HttpResponseFactory newResponseFactory() { return new DefaultHttpResponseFactory(); }
public HttpResponse newHttpResponse( final StatusLine statusline, final HttpContext context) { Args.notNull(statusline, "Status line"); return new BasicHttpResponse(statusline, this.reasonCatalog, determineLocale(context)); }
protected HttpResponseFactory createHttpResponseFactory() { return new DefaultHttpResponseFactory(); }
@Override public HttpResponse newHttpResponse( final StatusLine statusline, final HttpContext context) { Args.notNull(statusline, "Status line"); return new BasicHttpResponse(statusline, this.reasonCatalog, determineLocale(context)); }