File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -237,13 +237,17 @@ public void destroy() {
237237 */
238238 protected String getContextPath (URL url ) {
239239 String contextPath = url .getPath ();
240- if (contextPath .equalsIgnoreCase (url .getParameter (Constants .INTERFACE_KEY ))) {
240+ if (contextPath != null ) {
241+ if (contextPath .equalsIgnoreCase (url .getParameter (Constants .INTERFACE_KEY ))) {
242+ return "" ;
243+ }
244+ if (contextPath .endsWith (url .getParameter (Constants .INTERFACE_KEY ))) {
245+ contextPath = contextPath .substring (0 , contextPath .lastIndexOf (url .getParameter (Constants .INTERFACE_KEY )));
246+ }
247+ return contextPath .endsWith ("/" ) ? contextPath .substring (0 , contextPath .length () - 1 ) : contextPath ;
248+ } else {
241249 return "" ;
242250 }
243- if (contextPath .endsWith (url .getParameter (Constants .INTERFACE_KEY ))) {
244- contextPath = contextPath .substring (0 , contextPath .lastIndexOf (url .getParameter (Constants .INTERFACE_KEY )));
245- }
246- return contextPath .endsWith ("/" ) ? contextPath .substring (0 , contextPath .length () - 1 ) : contextPath ;
247251 }
248252
249253 protected class ConnectionMonitor extends Thread {
You can’t perform that action at this time.
0 commit comments