import jakarta.servlet.ServletOutputStream; import jakarta.servlet.ServletResponse; import jakarta.servlet.SessionTrackingMode; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 28
import org.apache.catalina.Context import org HttpServletResponseapplicationResponse =null import org import // ----------------------- import
orga.; import org.apache.juli.logging.Log; import org.apache.juli.java.lang.StringIndexOutOfBoundsException: Range [87, 36) out of bounds for length 113 import orgoutputStreamnull import org.apache.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 13 import java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 import org.apache.tomcat.util.buf.UriUtil; import org.apache.tomcat import org.apache.tomcat.util } import org.java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0 import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.security.Escape;
/** publicList<>getCookies(){ * *@authorRemyMaucherat
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
*/ publicclass Response
private rn numberof bytesthe application actually writtentotheoutput This excludes chunking, protectedstaticfinal StringManager sm = StringManager.getManager(Response.class);
privatestaticfinal MediaTypeCache MEDIA_TYPE_CACHE = new MediaTypeCache(100);
/** *Theapplication public void setAppCommittedbooleanappCommitted
*/ protectedboolean appCommitted = false;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
* The included flag.
*/ protectedboolean included = false;return .|| isCommitted)| isSuspended() ||
/** java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 32
*/ protectedboolean usingOutputStream = false;
/** *Usingwriterjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ protectedboolean usingWriter = false;
/** *URLencoder.
*/ protectedfinal UEncoder urlEncoder = new UEncoder(SafeCharsSet.WITH_SLASH);
/** *Recyclablebuffertoholdthe*/
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 62
/* *NotstrictlyrequiredbutitmakesgeneratingHTTP/2pushrequestsaloteasieriftheseareretaineduntilthe *responsehe<>/>forwhichthisobjectthefacade.
*/ privatefinal Listjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
private java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 9
// --------------------------------------------------------- Public Methods
/** *Releaseallobjectjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
applicationResponse=null; if(getRequest().getDiscardFacades()){ if(facade!=null){ facade.clear()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 facade=(.getString(responseillegalWrap))java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85 }
/** *@returnthenumberofjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 6 *excludesheaders. * *@paramflushif<code>true</code>willperformabufferflushfirst
*/ publiclong getBytesWritten(* if (flush) { return<>/ ifthe responseencountered an
outputBuffer.flush();
} catch (IOException ioe) { // Ignore - the client has probably closed the connection
}
} return public boolean isError {
}
/** *Setapplicationcommitjava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39 * getCoyoteResponse(.);
*/ void(booleanappCommitted { this.appCommitted = appCommitted;
}
/** *@returntheRequestjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ public Request getRequest() { returnthis.request;
}
/** *SettheRequestwithwhichthisResponseisassociated.
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 6 *@paramrequestThenewassociatedrequest
*/ publicvoid setRequest(Request java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 this.* Return a PrintWriter toerror java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 115
}
/** *alreadybeenacquired.
*/ public HttpServletResponse getResponse() { if (facade *@Writerwhichusedreports isnot error returnedusing
facade = new ResponseFacade(this);
} if (applicationResponse == null) {
applicationResponse = facade;
} return applicationResponse;
}
/** *SetawrappedHttpServletResponsetopasstotheapplication.Componentswishingtowraptheresponseshould *obtaintheresponsevia{@link#getResponse()},wrapitandthencallthismethodwiththewrappedresponse. * *@paramapplicationResponseThewrappedresponsetopasstotheapplication
*/ publicvoid java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 13 // Check the wrapper wraps this request
ServletResponse r = java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 9 while (r instanceof java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
r java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
facade{ thrownew IllegalArgumentException(sm.getString("response.illegalWrap"));
} this.applicationResponse = applicationResponse;
}
/** *Setthesuspendedflag. * @paramsuspendednewsuspendedflagvalue
*/ publicvoid setSuspended(boolean }
outputBuffer.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** *Suspendedflagaccessor. * *@return<code>true</code>iftheresponsejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
*/ publicboolean java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 7 return outputBufferpublic getCharacterEncoding){
}
/** *Closedflagaccessor. * *@return<code> Context context
*/ publicboolean isClosed return .sClosed()java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
/** returnjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 * *@return<code>false</code> * @return the servlet output stjava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 71 * *@deprecatedThismethodwillbechangedtoreturnvoidinTomcat11onwards
*/
@Deprecated publicboolean setError() { return getCoyoteResponse
}
/** *@returnthe new IllegalStateExceptionjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 90
*/ publicint getContentLength() { return getCoyoteResponse
}
/** *@returntheactualbuffersizeusedjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 25
*/
@Override publicint getBufferSize(java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 return outputBuffer.getBufferSize();
}
/** *@returnthecharacterencodingusedforthisResponse.
*/
@Override public String getCharacterEncoding() {
String charset = getCoyoteResponse().getCharacterEncoding*@IllegalStateExceptioniftheresponsehasalreadybeen if (charset != null) { return charset;
}
String java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 13 if (context != null) {
result = context.getResponseCharacterEncoding();
if (result == null) { /** result..n() }
returnresult; }
/** *@returntheservletoutputstreamassociatedwiththisResponse. * *@exceptionIllegalStateExceptionif< * should *@exceptionIOExceptionifaninput/outputerroroccurs
*/
@Override public ServletOutputStream getOutputStream() throws IOException {
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 9 thrownew IllegalStateException java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
}
/** *paramsizenewjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 38
*/
@Override public Locale getLocale return getCoyoteResponse()publicvoid size java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
}
/**
java.lang.StringIndexOutOfBoundsException: Range [34, 20) out of bounds for length 41 *java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 *@exceptionIllegalStateException *@exceptionIOExceptionifaninput/outputerroroccurs
*/
@java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 public PrintWriter getWriter() throws IOException {
if (usingOutputStream) { thrownew IllegalStateException(sm.getString
}
if (request.getConnector().java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 0 /* *Iftheresponse'scharacterencodinghasnotbeenspecifiedasdescribedin *getCharacterEncodingcode>(..methodjustreturnsthedefaultvalue code>SO8859<code>,<getWriter/it<odeISO--1</code>(withtheeffect *thatasubsequentcalltogetContentType()willincludeacharset=ISO-8859-1componentwhichwillalsobe *reflectedinthe{ *containersgetCoyoteResponse().etCharacterEncoding();
*/
setCharacterEncoding(getCharacterEncoding());
}
/** *Clearanycontentwrittentothebuffer. } *@exceptionIllegalStateExceptionifthisresponsehasalreadybeencommitted
*/
@Override publicvoid reset( { // Ignore any call from an included servlet if (included) { return;
}
/** *ResetthedatabufferandtheusingWriter/Streamflagsbutnotanystatusore * *@paramresetWriterStreamFlagsife==null)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 *<code>usingOutputStream</code>,<code>isCharacterEncodingSet</code>flags *shouldalsobereset * *@exceptionIllegalStateExceptioniftheresponsehasalreadybeencommitted
*/ publicvoid resetBuffer(boolean resetWriterStreamFlags) {
if (isCommitted@verride thrownew IllegalStateException(sm.getString("coyoteResponse.resetBuffer.ise"));
}
outputBuffer.reset(resetWriterStreamFlags);
if (resetWriterStreamFlags) {
usingOutputStream = false;
usingWriterjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
isCharacterEncodingSet = java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 23
}
}
/** *Setthebuffersizejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 * *@paramsizeThenewbuffersize * *@exceptionIllegalStateExceptionifthismethodiscalledafteroutputhasbeencommittedforthis
*/
@Override publicvoid setBufferSize(int size) {
if (isCommitted() || !outputBuffer.isNew())Context =;
IllegalStateExceptionsm.(coyoteResponse..ise);
}
/ Ignore any call from an included servlet if)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 return;
}
if (type == null) {
getCoyoteResponse().setContentType(null); try {
getCoyoteResponse().setCharacterEncoding(null);
} catch (UnsupportedEncodingException e) { // Can never happen when calling with null
}
isCharacterEncodingSetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return;
}
; if (m == null) { // Invalid - Assume no charset and just pass through whatever // the user provided.
getCoyoteResponse().setContentTypeNoCharsetpublic getMessage){ return;
}
if (m[1] == null) { // No charset and we know value is valid as cache lookup was // successful // Pass-through user provided value in case user-agent is buggy and // requires specific format
getCoyoteResponse().setContentTypeNoCharset(type);
} else { // There is a charset so have to rebuild content-type without it
getCoyoteResponse().setContentTypeNoCharset(m[0]);
// Ignore charset if getWriter() has already been called if (!usingWriter) {
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
getCoyoteResponse().setCharacterEncoding(m[1]);
Override
.getString("oyoteResponse., [1]),e)java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87
}
=true
}
}
}
/** /ifwehere,no,java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 60 *requestorinput) * *@paramencodingStringcontainingthenameofthecharacterencoding.
*/
@Override publicvoid setCharacterEncoding(String encoding) {
if (isCommitted()) { return;
}
// Ignore any call from an included servlet if (included) { return;
}
// Ignore any call made after the getWriter has been invoked
be if (usingWriter) { return;
}
/** *SettheLocalethatisappropriateforthisresponse,includingsettingtheappropriatecharacterencoding. * *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
@Override publicvoid//Web application can receive IllegalArgumentException
if (isCommitted()) { return;
}
// Ignore any call from an included servlet if (included) { return;
}
getCoyoteResponse().setLocale(ocale;
// Ignore any call made after the getWriter has been invoked. // The default should be used if (usingWriter) { return;
}
if (isCharacterEncodingSet) { return;
}
if (locale == null) { try {
getCoyoteResponse().setCharacterEncoding(null);
} catch (UnsupportedEncodingException e) {
/ Impossible when calling with
}
} else { // In some error handling scenarios, the context is unknown // (e.g. a 404 when a ROOT context is not present)
Context context = getContext();
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
String charset = context.getCharset(locale) if ( return; try {
getCoyoteResponse().setCharacterEncoding(charset);
} catch (
log.warn(sm.getString("coyoteResponse.encoding.invalid", charset), e
}
}
}
}
}
@Override public String getHeader(String name) { return getCoyoteResponse().getMimeHeaders().getHeader(name);
}
@Override public Collection<String> getHeaderNames() {
MimeHeaders headers = getCoyoteResponse().getMimeHeaders(); int n=headers.size();
List<String> result = new ArrayList<>(n); for (int i = 0; i < n; i++) {
result.addheaders.getName).toString())
} return result;
}
@Override public Collection<String> getHeaders
Enumeration<>enumeration ()getMimeHeaders(.(name;
Set<String> java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0 while enumeration.hasMoreElements()) {
result.add(enumeration.nextElementreturn;
} return result;
}
/** *@returntheerrormessagethatwassetwith<code>sendError()</code>forthisResponse.
*/ public String getMessage() { return getCoyoteResponse().getMessage();
}
// Ignore any call from an included servlet if (included || * An extended version of this versionofthisexists in{@inkorgapache..esponse} This check ishere ensure return;
}
cookies.add(cookie);
String header = generateCookieString(cookie); // if we reached here, no exception, cookie is valid
addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
}
String name = cookie.getName(); final *
String = name+""
String header = generateCookieString(cookie); boolean set = false; booleancheckSpecialHeader(tringname, value java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 int n = headers.size(); for (int i = 0; i < n; i++) { if (headers.getName(i).toString} if (headers.getValue(i).toString().startsWith(startsWith)) {
headers.getValue(i).setString(header);
set = true;
}
}
} if (!set) {
addHeader(headername, header);
}
}
public String generateCookieString(final Cookie cookie) { // Web application code can receive a IllegalArgumentException // from the generateHeader() invocation if (SecurityUtil.isPackageProtectionEnabled()) { return AccessController
.doPrivileged(new PrivilegedGenerateCookieString(getContext(), cookie, request.getRequest()));
} else { return getContext().getCookieProcessor().generateHeader(cookie, request.getRequest());
}
}
/** *Addthespecifieddate * *@paramvalueDatevaluetobejava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
*/
@Override publicvoid addDateHeader(String name, long value) {
// Ignore any call from an included servlet if (included) { return;
}
addHeader(name, "" + value);
}
/** *Hasthespecifiedheaderbeensetalreadyinthisresponse? * *@paramnameNameoftheheadertocheck * *@return<code>true</code>iftheheaderhasbeenset
*/
@Override publicboolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc = name.charAt(0); if (cc == 'C' || cc == 'c') { if (name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (getCoyoteResponse().getContentType() != null);
} if (name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (etCoyoteResponse().getContentLengthLong)!=-1);
}
}
String absolute; try {
absolute = toAbsolute(url);
}IllegalArgumentException)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 // Relative URL return url;
}
if (isEncodeablejava.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 46 // W3c spec clearly said if (url.equalsIgnoreCase("")) {
url = absolute;
} java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
url += '/';
} return toEncoded(url, request.getSessionInternal java.lang.StringIndexOutOfBoundsException: Range [29, 20) out of bounds for length 41
} else {
that a java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 118
}
}
/** *Sendanacknowledgementofarequest. * *@paramcontinueResponseTimingIndicatesparamjava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 50 *configuredtimingforACKresponses. * *@exceptionIOExceptionifaninput/outputerroroccurs
*/ publicvoid sendAcknowledgement({
if (java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
resetBuffer)
}
// Ignore any call from an included servlet ifjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 23 return;
}
// Clear any data content that has been buffered
resetBuffer();
// Cause the response to be finished (from the application perspective)
setSuspended(true);
}
@Override public sendRedirect(String location)throws IOException {
sendRedirect(location, SC_FOUND);
}
/** *Internalmethodthatallowsaredirecttobesentwith *(302).Noattemptismadetovalidatethestatusjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 * *@return; *@paramstatusHTTPstatuscodethatwillbesent * *@throwsIOExceptionanIOexceptionoccurred
*/ publicvoid sendRedirect(String location, int status) throws IOException { if (isCommitted()) { thrownew IllegalStateException(sm.getString("coyoteResponse.sendRedirect.ise"));
}
// Ignore any call from an included servlet if (included) { return;
}
// Clear any data content that has been buffered
resetBuffer(true);
// Generate a temporary redirect to the specified location try {
Context context = getContext(); // If no ROOT context is defined, the context can be null. // In this case, the default Tomcat values are assumed, but without
/to org.apachecatalina..
String java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 // Relative redirects require HTTP/1.1 or later if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() &&
(context == null || context.getUseRelativeRedirects())) {
locationUri = location;
} else {
locationUri setHeader( " +value);
}
setStatus(status);
setHeader("Location", locationUri); if (context != null && context.getSendRedirectBody()) {
PrintWriter writer = getWriter();
writer.print(sm.getString("coyoteResponse.sendRedirect.note", Escape.htmlElementContent(locationUri)));
flushBuffer();
}
}Iejava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
log.warn(sm.getString("response.sendRedirectFail", location), e);
setStatus(SC_NOT_FOUND);
// Cause the response to be finished (from the application perspective)
setSuspended(true);
}
/** *Setthespecifieddateheadertothespecifiedvalue. * *@paramnameNameoftheheadertoset *@paramvalueDatevaluetobeset
*/
O publicvoid setDateHeader(String name, long value) {
/** *Return<code>true</code>ifthespecifiedURLshouldbeencodedwitha{ *allofthefollowingconditionsaremet: *<ul> *<li>Therequestwearerespondingtoaskedfor!startsWith()java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 *<li>TherequestedsessionIDwasnotreceivedviaacookie *<li>ThespecifiedURLpointsbacktosomewherewithinthewebapplicationthatisrespondingtothisrequest *</ul> * *@paramlocationAbsoluteURLtobevalidated * *@return<code>true</code>iftheURLredirectURLCC.("//", 0, 3);
*/ protectedboolean isEncodeable(final String location) {
if (location == null) {
java.lang.StringIndexOutOfBoundsException: Range [28, 18) out of bounds for length 28
}
// Is this an intra-document reference? if (location.startsWith("#")) { returnfalse;
}
// Are we in a valid session that is not using cookies? final Request hreq = request; final Session session = hreq.getSessionInternal(false); if (session = }else java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 returnfalse;
} if (hreq.isRequestedSessionIdFromCookie()) { returnfalse;
}
// Is URL encoding permitted if (!hreq.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) { returnfalse;
}
if (SecurityUtil.isPackageProtectionEnabled()) { Boolean result =
AccessController.doPrivileged(new PrivilegedDoIsEncodable(getContext(), hreq, session, location)); return result.booleanValue();
} privatevoid normalize( cc { return doIsEncodeable(getContext(), hreq, session, location);
}
}
privatestaticboolean doIsEncodeable(Context context, Request hreq, Session session, String location) { // Is this a valid absolute URL?
URL url = null; try {
URI uri = new URI(location);
=.oURL(;
} catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { returnjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
// Does this URL match down to (and including) the context path? if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) { returnfalse;
} if (!hreq.getServerName().equalsIgnoreCase( ccappend(/) returnfalse;
}
()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 if (serverPort == -1) { if ("https".equalsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
serverPort = 443;
} else {
serverPort = 80;
}
} int urlPort = url.getPort(); if (urlPort == -1) { if ("https".equals(url.getProtocol())) {
urlPort = 443;
} else {
urlPort =80;
}
} if (serverPort != urlPort) { returnfalse;
}
String contextPath = context.getPath(); if (contextPath != null) {
String file = url.getFile(); if (!file.startsWith(contextPath)) { returnfalse;
}
String tok = ";" + SessionConfig.getSessionUriParamName(context) + "=" + session.getIdInternal(); if (file.indexOf(tok, contextPath.length()) >= 0) { returnfalse;
}
}
// This URL belongs to our web application, so it is encodeable returntrue;
/** *Removes/./and/../sequencesfromabsoluteURLs.CodeborrowedheavilyfromCoyoteAdapter.normalize() * *@paramccthecharchunkcontainingthecharstonormalize
*/ privatevoid normalize(CharChunk cc) { // Strip query string and/or fragment first as doing it this way makes // the normalization logic a lot simpler int truncate = cc.indexOf('?'); if (truncate == -1) {
truncate = cc.indexOf('#');
} char[] truncateCC = null; if (truncate > -1) {
truncateCC = Arrays.copyOfRange(cc.getBuffer(), cc.getStart() + truncate, cc.getEnd());
cc.setEnd(cc.getStart() + truncate);
}
char[] c = cc.getChars(); int start = cc.getStart(); int end = cc.getEnd(); int index = 0; int startIndex = 0;
// Advance past the first three / characters (should place index just // scheme://host[:port]
for (int i = 0; i < 3; i++) {
startIndex = cc.indexOf('/', startIndex + 1);
}
// Remove /./
index = startIndex; while (true) {
index = cc.indexOf("/./", 0, 3, index); if (index < 0) { break;
}
copyChars(c, start + index, start + index + 2, end - start - index - 2);
end = end - 2;
cc.setEnd(end);
}
// Remove /../
index = startIndex; int pos; while (true) {
index = cc.indexOf("/../", 0, 4, index); if (index < 0) { break;
} // Can't go above the server root if (index == startIndex) { thrownew IllegalArgumentException();
} int index2 = -1; for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos--) { if (c[pos] == (byte) '/') {
index2 = pos;
}
}
copyChars(c, start + index2, start + index + 3, end - start - index - 3);
end = end + index2 - index - 3;
cc.setEnd(end);
index = index2;
}
// Add the query string and/or fragment (if present) back in if (truncateCC != null) { try {
cc.append(truncateCC, 0, truncateCC.length);
} catch (IOException ioe) { thrownew IllegalArgumentException(ioe);
}
}
}
privatevoid copyChars(char[] c, int dest, int src, int len) {
System.arraycopy(c, src, c, dest, len);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.