src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 70,79 **** --- 70,80 ---- * @return The uriStartString */ public String getURIStartString () { return uriStartString; } + /** * Get the rewritePrefix attribute. * @return The rewritePrefix attribute value. */ public URL getRewritePrefix() {
*** 89,106 **** * @param currentMatch The length of uriStartString of previous match if any. * @return The replacement URI if the match is successful, null if not. */ @Override public String match(String systemId, int currentMatch) { ! if (uriStartString.length() <= systemId.length() && uriStartString.equals(systemId.substring(0, uriStartString.length()))) { if (currentMatch < uriStartString.length()) { String prefix = rewritePrefix.toExternalForm(); ! if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) { ! return prefix + SLASH + systemId.substring(uriStartString.length()); } else { ! return prefix + systemId.substring(uriStartString.length()); } } } return null; } --- 90,113 ---- * @param currentMatch The length of uriStartString of previous match if any. * @return The replacement URI if the match is successful, null if not. */ @Override public String match(String systemId, int currentMatch) { ! if (uriStartString.length() < systemId.length() && uriStartString.equals(systemId.substring(0, uriStartString.length()))) { if (currentMatch < uriStartString.length()) { String prefix = rewritePrefix.toExternalForm(); ! String sysId; ! if (uriStartString.endsWith(SLASH)) { ! sysId = systemId.substring(uriStartString.length()); ! } else { ! sysId = systemId.substring(uriStartString.length() + 1); ! } ! if (prefix.endsWith(SLASH)) { ! return prefix + sysId; } else { ! return prefix + SLASH + sysId; } } } return null; }