@@ -70,7 +70,6 @@ final class SimpleServer extends HttpServer<SimpleServer.ReqRes, SimpleServer.Re
7070 private Thread processor ;
7171
7272 private static final Pattern PATTERN_GET = Pattern .compile ("(HEAD|GET|POST|PUT|DELETE) */([^ \\ ?]*)(\\ ?[^ ]*)?" );
73- private static final Pattern PATTERN_LANGS = Pattern .compile (".*^Accept-Language:(.*)$" , Pattern .MULTILINE );
7473 private static final Pattern PATTERN_HOST = Pattern .compile (".*^Host: *(.*):([0-9]+)$" , Pattern .MULTILINE );
7574 private static final Pattern PATTERN_LENGTH = Pattern .compile (".*^Content-Length: ([0-9]+)$" , Pattern .MULTILINE );
7675 static final Logger LOG = Logger .getLogger (SimpleServer .class .getName ());
@@ -375,17 +374,12 @@ private ReqRes findRequest(
375374 String method , ByteBuffer bodyToFill
376375 ) {
377376 LOG .log (Level .FINE , "Searching for page {0}" , url );
378- Matcher m = PATTERN_LANGS .matcher (header );
379- String langs = m .find () ? m .group (1 ) : null ;
380- if (langs != null ) {
381- LOG .log (Level .FINE , "Accepted languages {0}" , langs );
382- }
383- Matcher m2 = PATTERN_HOST .matcher (header );
377+ Matcher hostMatch = PATTERN_HOST .matcher (header );
384378 String host = null ;
385379 int port = -1 ;
386- if (m2 .find ()) {
387- host = m2 .group (1 );
388- port = Integer .parseInt (m2 .group (2 ));
380+ if (hostMatch .find ()) {
381+ host = hostMatch .group (1 );
382+ port = Integer .parseInt (hostMatch .group (2 ));
389383 }
390384 if (host != null ) {
391385 LOG .log (Level .FINE , "Host {0}:{1}" , new Object [] { host , port });
@@ -394,7 +388,7 @@ private ReqRes findRequest(
394388 for (Map .Entry <String , Handler > entry : maps .entrySet ()) {
395389 if (url .startsWith (entry .getKey ())) {
396390 final Handler h = entry .getValue ();
397- return new ReqRes (h , url , args , host , port , header , method , bodyToFill , args , langs );
391+ return new ReqRes (h , url , args , host , port , header , method , bodyToFill );
398392 }
399393 }
400394 throw new IllegalStateException ("No mapping for " + url + " among " + maps );
@@ -545,8 +539,6 @@ final class ReqRes extends SelectionKey {
545539 final String header ;
546540 final String method ;
547541 final ByteBuffer body ;
548- private final Map <String , ? extends Object > context ;
549- private final String langs ;
550542 private ByteBuffer bb = ByteBuffer .allocate (8192 );
551543 private SelectionKey delegate ;
552544 private final ByteArrayOutputStream os = new ByteArrayOutputStream ();
@@ -559,19 +551,15 @@ final class ReqRes extends SelectionKey {
559551 public ReqRes (
560552 Handler h ,
561553 String url , Map <String , ? extends Object > args , String host ,
562- int port , String header , String method , ByteBuffer body ,
563- Map <String , ? extends Object > a ,
564- String langs
554+ int port , String header , String method , ByteBuffer body
565555 ) {
566556 this .h = h ;
567557 this .url = url ;
568558 this .hostName = host ;
569559 this .hostPort = port ;
570560 this .header = header ;
571561 this .args = args ;
572- this .context = a ;
573562 this .method = method ;
574- this .langs = langs ;
575563 this .body = body ;
576564 }
577565
0 commit comments