myRequestProcessor.process(request.getAddress().toString(), request.getClientAddress().getAddress().getHostAddress(), getRequestHandler(response)); } else { myMultiAnnounceRequestProcessor.process(request.getContent(), request.getAddress().toString(), request.getClientAddress().getAddress().getHostAddress(), getRequestHandler(response));
@Override public String getFromAddress() { Address add = baseRequest.getAddress(); if (add == null) { return null; } return add.toString(); }
@Override public String toString() { return request.getMethod() + " " + request.getAddress().toString(); }
public void handle( Request req, Response resp ) { try { PrintStream out = resp.getPrintStream(1024); String address = req.getAddress().toString(); if( address.equals(DEFAULT_ENPOINT) ) { String content = readInputStreamAsString(req.getInputStream()); JaxbCommandsRequest cmdsReq = (JaxbCommandsRequest) jaxbSerializationProvider.deserialize(content); String [] headerNames = { TEST_HEADER_NAME, ANOTHER_TEST_HEADER_NAME, NOT_SENT_HEADER_NAME }; List<String> headerValues = new ArrayList<String>(); for( String headerName : headerNames ) { String headerVal = req.getValue(headerName); if( headerVal != null ) { headerValues.add(headerVal); } } String output = handleJaxbCommandsRequest(cmdsReq, headerValues); resp.setCode(HttpURLConnection.HTTP_OK); out.print(output); } else { resp.setCode(HttpURLConnection.HTTP_BAD_REQUEST); } out.close(); } catch( Exception e ) { e.printStackTrace(); } }
logger.debug(headers[0] + ": " + user + "/" + pass); String address = req.getAddress().toString(); if( address.equals(DEFAULT_ENDPOINT) ) { resp.setValue(HttpHeaders.CONTENT_TYPE, "text/plain");
public void handle( Request req, Response resp ) { try { PrintStream out = resp.getPrintStream(1024); String address = req.getAddress().toString(); if( address.equals(REDIRECT_PATH) ) { resp.setValue(HttpHeaders.LOCATION, REAL_ENDPOINT_PATH);