1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
70 * Called by HttpServer when there is a matching request for the context |
70 * Called by HttpServer when there is a matching request for the context |
71 */ |
71 */ |
72 public void handle(HttpExchange msg) { |
72 public void handle(HttpExchange msg) { |
73 try { |
73 try { |
74 if (fineTraceEnabled) { |
74 if (fineTraceEnabled) { |
75 LOGGER.fine("Received HTTP request:"+msg.getRequestURI()); |
75 LOGGER.log(Level.FINE, "Received HTTP request:{0}", msg.getRequestURI()); |
76 } |
76 } |
77 if (executor != null) { |
77 if (executor != null) { |
78 // Use application's Executor to handle request. Application may |
78 // Use application's Executor to handle request. Application may |
79 // have set an executor using Endpoint.setExecutor(). |
79 // have set an executor using Endpoint.setExecutor(). |
80 executor.execute(new HttpHandlerRunnable(msg)); |
80 executor.execute(new HttpHandlerRunnable(msg)); |
88 |
88 |
89 private void handleExchange(HttpExchange msg) throws IOException { |
89 private void handleExchange(HttpExchange msg) throws IOException { |
90 WSHTTPConnection con = new ServerConnectionImpl(adapter,msg); |
90 WSHTTPConnection con = new ServerConnectionImpl(adapter,msg); |
91 try { |
91 try { |
92 if (fineTraceEnabled) { |
92 if (fineTraceEnabled) { |
93 LOGGER.fine("Received HTTP request:"+msg.getRequestURI()); |
93 LOGGER.log(Level.FINE, "Received HTTP request:{0}", msg.getRequestURI()); |
94 } |
94 } |
95 String method = msg.getRequestMethod(); |
95 String method = msg.getRequestMethod(); |
96 if(method.equals(GET_METHOD) || method.equals(POST_METHOD) || method.equals(HEAD_METHOD) |
96 if(method.equals(GET_METHOD) || method.equals(POST_METHOD) || method.equals(HEAD_METHOD) |
97 || method.equals(PUT_METHOD) || method.equals(DELETE_METHOD)) { |
97 || method.equals(PUT_METHOD) || method.equals(DELETE_METHOD)) { |
98 adapter.handle(con); |
98 adapter.handle(con); |