code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
private String renderUrl(Url url, IRequestHandler handler) { if (url != null) { boolean shouldEncodeStaticResource = Application.exists() && Application.get().getResourceSettings().isEncodeJSessionId(); String renderedUrl = getUrlRenderer().renderUrl(url); if (handler instanceof ResourceReferenceRequ...
Returns the rendered URL for the request handler or <code>null</code> if the handler couldn't have been rendered. <p> The resulting URL will be relative to current page. @param handler @return Url String or <code>null</code>
renderUrl
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public final void detach() { set(this); try { onDetach(); } finally { try { onInternalDetach(); } finally { set(null); } } }
Detaches {@link RequestCycle} state. Called after request processing is complete
detach
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
private void onInternalDetach() { if (Session.exists()) { Session.get().internalDetach(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) requestLogger.performLogging(); } }
Detaches {@link RequestCycle} state. Called after request processing is complete
onInternalDetach
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void onDetach() { try { onEndRequest(); listeners.onEndRequest(this); } catch (RuntimeException e) { log.error("Exception occurred during onEndRequest", e); } try { requestHandlerExecutor.detach(); } catch (RuntimeException exception) { handleDetachException(exception); }...
Called after request processing is complete, usually takes care of detaching state
onDetach
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
private void handleDetachException(RuntimeException exception) { boolean isBufferedResponse = true; if (Application.exists()) { isBufferedResponse = Application.get().getRequestCycleSettings().getBufferResponse(); } //if application is using a buffered response strategy, //then we display exception to...
Called to handle a {@link java.lang.RuntimeException} that might be thrown during detaching phase. @param exception
handleDetachException
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void setResponsePage(IRequestablePage page) { if (page instanceof Page) { ((Page) page).setStatelessHint(false); } scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new PageProvider(page), RenderPageRequestHandler.RedirectPolicy.AUTO_REDIRECT)); }
Convenience method for setting next page to be rendered. @param page
setResponsePage
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void setResponsePage(Class<? extends IRequestablePage> pageClass) { setResponsePage(pageClass, null, RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT); }
Convenience method for setting next page to be rendered. @param pageClass The class of the page to render
setResponsePage
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void setResponsePage(Class<? extends IRequestablePage> pageClass, RenderPageRequestHandler.RedirectPolicy redirectPolicy) { setResponsePage(pageClass, null, redirectPolicy); }
Convenience method for setting next page to be rendered. @param pageClass The class of the page to render @param redirectPolicy The policy to use when deciding whether to redirect or not
setResponsePage
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void setResponsePage(Class<? extends IRequestablePage> pageClass, PageParameters parameters) { setResponsePage(pageClass, parameters, RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT); }
Convenience method for setting next page to be rendered. @param pageClass The class of the page to render @param parameters The query parameters for the page to be rendered
setResponsePage
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void setResponsePage(Class<? extends IRequestablePage> pageClass, PageParameters parameters, RenderPageRequestHandler.RedirectPolicy redirectPolicy) { IPageProvider provider = new PageProvider(pageClass, parameters); scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandle...
Convenience method for setting next page to be rendered. @param pageClass The class of the page to render @param parameters The query parameters for the page to be rendered @param redirectPolicy The policy to use when deciding whether to redirect or not
setResponsePage
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public final long getStartTime() { return startTime; }
@return The start time for this request
getStartTime
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public IRequestHandler getActiveRequestHandler() { return requestHandlerExecutor.getActive(); }
@see RequestHandlerStack#getActive() @return active handler on executor
getActiveRequestHandler
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public IRequestHandler getRequestHandlerScheduledAfterCurrent() { return requestHandlerExecutor.next(); }
@see RequestHandlerStack#next() @return the handler scheduled to be executed after current by the executor
getRequestHandlerScheduledAfterCurrent
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
public void replaceAllRequestHandlers(final IRequestHandler handler) { requestHandlerExecutor.replaceAll(handler); }
@see RequestHandlerStack#replaceAll(IRequestHandler) @param handler
replaceAllRequestHandlers
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@SuppressWarnings("unchecked") public <T extends IRequestHandler> T find(final Class<T> type) { if (type == null) { return null; } IRequestHandler result = getActiveRequestHandler(); if (result == null || type.isAssignableFrom(result.getClass()) == false) { result = getRequestHandlerScheduledAfter...
Finds a IRequestHandler which is either the currently executing handler or is scheduled to be executed. @return the found IRequestHandler or {@code null}
find
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override protected void respond(IRequestHandler handler) { Response originalResponse = getResponse(); try { handler.respond(RequestCycle.this); } finally { setResponse(originalResponse); } }
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
respond
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override protected void detach(IRequestHandler handler) { handler.detach(RequestCycle.this); }
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
detach
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override public boolean equals(Object other) { if (!(other instanceof ResourceUrlCacheKey)) return false; if (this == other) return true; ResourceUrlCacheKey otherKey = (ResourceUrlCacheKey) other; return new EqualsBuilder() .append(resourceReference, otherKey.resourceReference) .append(...
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
equals
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override public int hashCode() { return new HashCodeBuilder(17, 37) .append(resourceReference) .append(params) .toHashCode(); }
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
hashCode
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override public boolean equals(Object other) { if (!(other instanceof PageUrlCacheKey)) return false; if (this == other) return true; PageUrlCacheKey otherKey = (PageUrlCacheKey) other; return new EqualsBuilder() .append(pageClass, otherKey.pageClass) .append(params, otherKey.params) ...
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
equals
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override public int hashCode() { return new HashCodeBuilder(17, 37) .append(pageClass) .append(params) .toHashCode(); }
Adapts {@link RequestHandlerStack} to this {@link RequestCycle} @author Igor Vaynberg
hashCode
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
MIT
@Override public String run() { return System.getProperty("line.separator"); }
Constructs something like <em>;jsessionid=</em>. This is what {@linkplain Strings#stripJSessionId(String)} actually uses.
run
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String afterFirst(final String s, final char c) { if (s == null) { return null; } final int index = s.indexOf(c); if (index == -1) { return ""; } return s.substring(index + 1); }
Returns everything after the first occurrence of the given character in s. @param s The string @param c The character @return Everything after the first occurrence of the given character in s. If the character cannot be found, an empty string is returned.
afterFirst
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String afterFirstPathComponent(final String path, final char separator) { return afterFirst(path, separator); }
Gets everything after the first path component of a path using a given separator. If the separator cannot be found, an empty String is returned. <p> For example, afterFirstPathComponent("foo:bar:baz", ':') would return "bar:baz" and afterFirstPathComponent("foo", ':') would return "". @param path The path t...
afterFirstPathComponent
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String afterLast(final String s, final char c) { if (s == null) { return null; } final int index = s.lastIndexOf(c); if (index == -1) { return ""; } return s.substring(index + 1); }
Returns everything after the last occurrence of the given character in s. @param s The string @param c The character @return Everything after the last occurrence of the given character in s. If the character cannot be found, an empty string is returned.
afterLast
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String beforeFirst(final String s, final char c) { if (s == null) { return null; } final int index = s.indexOf(c); if (index == -1) { return ""; } return s.substring(0, index); }
Returns everything before the first occurrence of the given character in s. @param s The string @param c The character @return Everything before the first occurrence of the given character in s. If the character cannot be found, an empty string is returned.
beforeFirst
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String beforeLast(final String s, final char c) { if (s == null) { return null; } final int index = s.lastIndexOf(c); if (index == -1) { return ""; } return s.substring(0, index); }
Returns everything before the last occurrence of the given character in s. @param s The string @param c The character @return Everything before the last occurrence of the given character in s. If the character cannot be found, an empty string is returned.
beforeLast
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String beforeLastPathComponent(final String path, final char separator) { return beforeLast(path, separator); }
Gets everything before the last path component of a path using a given separator. If the separator cannot be found, the path itself is returned. <p> For example, beforeLastPathComponent("foo.bar.baz", '.') would return "foo.bar" and beforeLastPathComponent("foo", '.') would return "". @param path The path t...
beforeLastPathComponent
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String capitalize(final String s) { if (s == null) { return null; } final char[] chars = s.toCharArray(); if (chars.length > 0) { chars[0] = Character.toUpperCase(chars[0]); } return new String(chars); }
Capitalizes a string. @param s The string @return The capitalized string
capitalize
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence escapeMarkup(final CharSequence s) { return escapeMarkup(s, false); }
Converts a Java String to an HTML markup string, but does not convert normal spaces to non-breaking space entities (&lt;nbsp&gt;). @param s The characters to escape @see Strings#escapeMarkup(CharSequence, boolean) @return The escaped string
escapeMarkup
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence escapeMarkup(final CharSequence s, final boolean escapeSpaces) { return escapeMarkup(s, escapeSpaces, false); }
Converts a Java String to an HTML markup String by replacing illegal characters with HTML entities where appropriate. Spaces are converted to non-breaking spaces (&lt;nbsp&gt;) if escapeSpaces is true, tabs are converted to four non-breaking spaces, less than signs are converted to &amp;lt; entities and greater than si...
escapeMarkup
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence escapeMarkup(final CharSequence s, final boolean escapeSpaces, final boolean convertToHtmlUnicodeEscapes) { if (s == null) { return null; } int len = s.length(); final AppendingStringBuffer buffer = new AppendingStringBuffer((int)(len * 1.1)); for (int i = 0; i < len; i++)...
Converts a Java String to an HTML markup String by replacing illegal characters with HTML entities where appropriate. Spaces are converted to non-breaking spaces (&lt;nbsp&gt;) if escapeSpaces is true, tabs are converted to four non-breaking spaces, less than signs are converted to &amp;lt; entities and greater than si...
escapeMarkup
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence unescapeMarkup(final String markup) { String unescapedMarkup = StringEscapeUtils.unescapeHtml(markup); return unescapedMarkup; }
Unescapes the escaped entities in the <code>markup</code> passed. @param markup The source <code>String</code> to unescape. @return the unescaped markup or <code>null</null> if the input is <code>null</code>
unescapeMarkup
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String firstPathComponent(final String path, final char separator) { if (path == null) { return null; } final int index = path.indexOf(separator); if (index == -1) { return path; } return path.substring(0, index); }
Gets the first path component of a path using a given separator. If the separator cannot be found, the path itself is returned. <p> For example, firstPathComponent("foo.bar", '.') would return "foo" and firstPathComponent("foo", '.') would return "foo". @param path The path to parse @param separator ...
firstPathComponent
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String fromEscapedUnicode(final String escapedUnicodeString) { int off = 0; char[] in = escapedUnicodeString.toCharArray(); int len = in.length; char[] out = new char[len]; char aChar; int outLen = 0; int end = off + len; while (off < end) { aChar = in[off++]; if (aChar == '\\') ...
Converts encoded &#92;uxxxx to unicode chars and changes special saved chars to their original forms. @param escapedUnicodeString escaped unicode string, like '\u4F60\u597D'. @return The actual unicode. Can be used for instance with message bundles
fromEscapedUnicode
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static boolean isEmpty(final CharSequence string) { return (string == null) || (string.length() == 0) || (string.toString().trim().length() == 0); }
Checks whether the <code>string</code> is considered empty. Empty means that the string may contain whitespace, but no visible characters. "\n\t " is considered empty, while " a" is not. @param string The string @return True if the string is null or ""
isEmpty
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static boolean isEqual(final String string1, final String string2) { if ((string1 == null) && (string2 == null)) { return true; } if (isEmpty(string1) && isEmpty(string2)) { return true; } if ((string1 == null) || (string2 == null)) { return false; } return string1.equals(string2)...
Checks whether two strings are equals taken care of 'null' values and treating 'null' same as trim(string).equals("") @param string1 @param string2 @return true, if both strings are equal
isEqual
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static boolean isTrue(final String s) throws StringValueConversionException { if (s != null) { if (s.equalsIgnoreCase("true")) { return true; } if (s.equalsIgnoreCase("false")) { return false; } if (s.equalsIgnoreCase("on") || s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y...
Converts the text in <code>s</code> to a corresponding boolean. On, yes, y, true and 1 are converted to <code>true</code>. Off, no, n, false and 0 (zero) are converted to <code>false</code>. An empty string is converted to <code>false</code>. Conversion is case-insensitive, and does <em>not</em> take internationalizati...
isTrue
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String join(final String separator, final List<String> fragments) { if (fragments == null) { return ""; } return join(separator, fragments.toArray(new String[fragments.size()])); }
Joins string fragments using the specified separator @param separator @param fragments @return combined fragments
join
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String join(final String separator, final String... fragments) { if ((fragments == null) || (fragments.length < 1)) { // no elements return ""; } else if (fragments.length < 2) { // single element return fragments[0]; } else { // two or more elements StringBuilder buff =...
Joins string fragments using the specified separator @param separator @param fragments @return combined fragments
join
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String lastPathComponent(final String path, final char separator) { if (path == null) { return null; } final int index = path.lastIndexOf(separator); if (index == -1) { return path; } return path.substring(index + 1); }
Gets the last path component of a path using a given separator. If the separator cannot be found, the path itself is returned. <p> For example, lastPathComponent("foo.bar", '.') would return "bar" and lastPathComponent("foo", '.') would return "foo". @param path The path to parse @param separator ...
lastPathComponent
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence replaceAll(final CharSequence s, final CharSequence searchFor, CharSequence replaceWith) { if (s == null) { return null; } // If searchFor is null or the empty string, then there is nothing to // replace, so returning s is the only option here. if ((searchFor == null) || ""...
Replace all occurrences of one string replaceWith another string. @param s The string to process @param searchFor The value to search for @param replaceWith The value to searchFor replaceWith @return The resulting string with searchFor replaced with replaceWith
replaceAll
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String replaceHtmlEscapeNumber(String str) { if (str == null) { return null; } Matcher matcher = HTML_NUMBER_REGEX.matcher(str); while (matcher.find()) { int pos = matcher.start(); int end = matcher.end(); int number = Integer.parseInt(str.substring(pos + 2, end - 1)); char ch ...
Replace HTML numbers like &#20540 by the appropriate character. @param str The text to be evaluated @return The text with "numbers" replaced
replaceHtmlEscapeNumber
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String[] split(final String s, final char c) { if (s == null || s.length() == 0) { return NO_STRINGS; } final List<String> strings = new ArrayList<>(); int pos = 0; while (true) { int next = s.indexOf(c, pos); if (next == -1) { strings.add(s.substring(pos)); break; } ...
Simpler, faster version of String.split() for splitting on a simple character. @param s The string to split @param c The character to split on @return The array of strings
split
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String stripEnding(final String s, final String ending) { if (s == null) { return null; } // Stripping a null or empty string from the end returns the // original string. if ((ending == null) || "".equals(ending)) { return s; } final int endingLength = ending.length(); final in...
Strips the ending from the string <code>s</code>. @param s The string to strip @param ending The ending to strip off @return The stripped string or the original string if the ending did not exist
stripEnding
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String stripJSessionId(final String url) { if (Strings.isEmpty(url)) { return url; } // http://.../abc;jsessionid=...?param=... int ixSemiColon = url.toLowerCase(Locale.ROOT).indexOf(SESSION_ID_PARAM); if (ixSemiColon == -1) { return url; } int ixQuestionMark = url.indexOf('?');...
Strip any jsessionid and possibly other redundant info that might be in our way. @param url The url to strip @return The stripped url
stripJSessionId
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static Boolean toBoolean(final String s) throws StringValueConversionException { return isTrue(s); }
Converts the string s to a Boolean. See <code>isTrue</code> for valid values of s. @param s The string to convert. @return Boolean <code>TRUE</code> when <code>isTrue(s)</code>. @throws StringValueConversionException when s is not a valid value @see #isTrue(String)
toBoolean
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static char toChar(final String s) throws StringValueConversionException { if (s != null) { if (s.length() == 1) { return s.charAt(0); } else { throw new StringValueConversionException("Expected single character, not \"" + s + "\""); } } throw new StringValueConversionExc...
Converts the 1 character string s to a character. @param s The 1 character string to convert to a char. @return Character value to convert @throws StringValueConversionException when the string is longer or shorter than 1 character, or <code>null</code>.
toChar
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String toEscapedUnicode(final String unicodeString) { if ((unicodeString == null) || (unicodeString.length() == 0)) { return unicodeString; } int len = unicodeString.length(); int bufLen = len * 2; StringBuilder outBuffer = new StringBuilder(bufLen); for (int x = 0; x < len; x++) { ...
Converts unicodes to encoded &#92;uxxxx. @param unicodeString The unicode string @return The escaped unicode string, like '\u4F60\u597D'.
toEscapedUnicode
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static CharSequence toMultilineMarkup(final CharSequence s) { if (s == null) { return null; } final AppendingStringBuffer buffer = new AppendingStringBuffer(); int newlineCount = 0; buffer.append("<p>"); for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); switch (c) ...
Converts a String to multiline HTML markup by replacing newlines with line break entities (&lt;br/&gt;) and multiple occurrences of newline with paragraph break entities (&lt;p&gt;). @param s String to transform @return String with all single occurrences of newline replaced with &lt;br/&gt; and all ...
toMultilineMarkup
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String toString(final Object object) { if (object == null) { return null; } if (object instanceof Throwable) { return toString((Throwable)object); } if (object instanceof String) { return (String)object; } if ((object instanceof String[]) && (((String[])object).length == 1...
Converts the given object to a string. Does special conversion for {@link Throwable throwables} and String arrays of length 1 (in which case it just returns to string in that array, as this is a common thing to have in the Servlet API). @param object The object @return The string
toString
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String toString(final Throwable throwable) { if (throwable != null) { List<Throwable> al = new ArrayList<>(); Throwable cause = throwable; al.add(cause); while ((cause.getCause() != null) && (cause != cause.getCause())) { cause = cause.getCause(); al.add(cause); } Append...
Converts a Throwable to a string. @param throwable The throwable @return The string
toString
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
private static void append(final AppendingStringBuffer buffer, final CharSequence s, final int from, final int to) { if (s instanceof AppendingStringBuffer) { AppendingStringBuffer asb = (AppendingStringBuffer)s; buffer.append(asb.getValue(), from, to - from); } else { buffer.append(s.subSequence(...
Converts a Throwable to a string. @param throwable The throwable @return The string
append
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
private static char toHex(final int nibble) { return HEX_DIGIT[(nibble & 0xF)]; }
Convert a nibble to a hex character @param nibble the nibble to convert. @return hex character
toHex
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static int lengthInBytes(final String string, final Charset charset) { Args.notNull(string, "string"); if (charset != null) { try { return string.getBytes(charset.name()).length; } catch (UnsupportedEncodingException e) { throw new RuntimeException( "StringResourceStream create...
Calculates the length of string in bytes, uses specified <code>charset</code> if provided. @param string @param charset (optional) character set to use when converting string to bytes @return length of string in bytes
lengthInBytes
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static boolean startsWith(final String str, final String prefix, final boolean caseSensitive) { if (caseSensitive) { return str.startsWith(prefix); } else { return str.toLowerCase(Locale.ROOT).startsWith(prefix.toLowerCase(Locale.ROOT)); } }
Extended {@link String#startsWith(String)} with support for case sensitivity @param str @param prefix @param caseSensitive @return <code>true</code> if <code>str</code> starts with <code>prefix</code>
startsWith
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static int indexOf(final CharSequence sequence, final char ch) { if (sequence != null) { for (int i = 0; i < sequence.length(); i++) { if (sequence.charAt(i) == ch) { return i; } } } return -1; }
returns the zero-based index of a character within a char sequence. this method mainly exists as an faster alternative for <code>sequence.toString().indexOf(ch)</code>. @param sequence character sequence @param ch character to search for @return index of character within character sequence or <co...
indexOf
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String toHexString(byte[] bytes) { Args.notNull(bytes, "bytes"); final StringBuilder hex = new StringBuilder(bytes.length << 1); for (final byte b : bytes) { hex.append(toHex(b >> 4)); hex.append(toHex(b)); } return hex.toString(); }
convert byte array to hex string @param bytes bytes to convert to hexadecimal representation @return hex string
toHexString
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static <T extends Enum<T>> T toEnum(final CharSequence value, final Class<T> enumClass) { Args.notNull(enumClass, "enumClass"); Args.notNull(value, "value"); try { return Enum.valueOf(enumClass, value.toString()); } catch (Exception e) { throw new StringValueConversionException( String...
Return this value as en enum value. @param value the value to convert to an enum value @param enumClass the enum type @return an enum value
toEnum
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public static String defaultIfEmpty(String originalString, String defaultValue) { return isEmpty(originalString) ? defaultValue : originalString; }
Returns the original string if this one is not empty (i.e. {@link #isEmpty(CharSequence)} returns false), otherwise the default one is returned. The default string might be itself an empty one. @param originalString the original sting value @param defaultValue the default string to return if the original is e...
defaultIfEmpty
java
theonedev/onedev
server-core/src/main/java/org/apache/wicket/util/string/Strings.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/apache/wicket/util/string/Strings.java
MIT
public HttpChannel getHttpChannel() { return _channel; }
If a header name starts with this string, the header (stripped of the prefix) can be set during include using only {@link #setHeader(String, String)} or {@link #addHeader(String, String)}.
getHttpChannel
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
protected void recycle() { // _channel need not be recycled _fields.clear(); _errorSentAndIncludes.set(0); _out.recycle(); _status = HttpStatus.OK_200; _reason = null; _locale = null; _mimeType = null; _characterEncoding = null; _encodingFrom = EncodingFrom.NOT_SET; _contentType = null; _output...
If a header name starts with this string, the header (stripped of the prefix) can be set during include using only {@link #setHeader(String, String)} or {@link #addHeader(String, String)}.
recycle
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public HttpOutput getHttpOutput() { return _out; }
If a header name starts with this string, the header (stripped of the prefix) can be set during include using only {@link #setHeader(String, String)} or {@link #addHeader(String, String)}.
getHttpOutput
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void reopen() { // Make the response mutable and reopen output. setErrorSent(false); _out.reopen(); }
If a header name starts with this string, the header (stripped of the prefix) can be set during include using only {@link #setHeader(String, String)} or {@link #addHeader(String, String)}.
reopen
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void errorClose() { // Make the response immutable and soft close the output. setErrorSent(true); _out.softClose(); }
If a header name starts with this string, the header (stripped of the prefix) can be set during include using only {@link #setHeader(String, String)} or {@link #addHeader(String, String)}.
errorClose
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
private boolean isMutable() { return _errorSentAndIncludes.get() == 0; }
@return true if the response is mutable, ie not errorSent and not included
isMutable
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
private void setErrorSent(boolean errorSent) { _errorSentAndIncludes.getAndSetHi(errorSent ? 1 : 0); }
@return true if the response is mutable, ie not errorSent and not included
setErrorSent
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public boolean isIncluding() { return _errorSentAndIncludes.getLo() > 0; }
@return true if the response is mutable, ie not errorSent and not included
isIncluding
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void include() { _errorSentAndIncludes.add(0, 1); }
@return true if the response is mutable, ie not errorSent and not included
include
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void included() { _errorSentAndIncludes.add(0, -1); if (_outputType == OutputType.WRITER) { _writer.reopen(); } _out.reopen(); }
@return true if the response is mutable, ie not errorSent and not included
included
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void addCookie(HttpCookie cookie) { if (StringUtil.isBlank(cookie.getName())) throw new IllegalArgumentException("Cookie.name cannot be blank/null"); // add the set cookie _fields.add(new SetCookieHttpField(checkSameSite(cookie), getHttpChannel().getHttpConfiguration().getResponseCookieCompliance()));...
@return true if the response is mutable, ie not errorSent and not included
addCookie
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
private HttpCookie checkSameSite(HttpCookie cookie) { if (cookie == null || cookie.getSameSite() != null) return cookie; //sameSite is not set, use the default configured for the context, if one exists SameSite contextDefault = HttpCookie.getSameSiteDefault(_channel.getRequest().getServletContext()); if (c...
Check that samesite is set on the cookie. If not, use a context default value, if one has been set. @param cookie the cookie to check @return either the original cookie, or a new one that has the samesit default set
checkSameSite
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void replaceCookie(HttpCookie cookie) { for (ListIterator<HttpField> i = _fields.listIterator(); i.hasNext(); ) { HttpField field = i.next(); if (field.getHeader() == HttpHeader.SET_COOKIE) { CookieCompliance compliance = getHttpChannel().getHttpConfiguration().getResponseCookieCompliance(); ...
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
replaceCookie
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void addCookie(Cookie cookie) { //Servlet Spec 9.3 Include method: cannot set a cookie if handling an include if (isMutable()) { if (StringUtil.isBlank(cookie.getName())) throw new IllegalArgumentException("Cookie.name cannot be blank/null"); String comment = cookie.getComment(); ...
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
addCookie
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public boolean containsHeader(String name) { return _fields.containsKey(name); }
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
containsHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public String encodeURL(String url) { if (url == null) return null; final Request request = _channel.getRequest(); SessionHandler sessionManager = request.getSessionHandler(); if (sessionManager == null) return url; HttpURI uri = null; boolean hasScheme = URIUtil.hasScheme(url); if (s...
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
encodeURL
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public String encodeRedirectURL(String url) { return encodeURL(url); }
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
encodeRedirectURL
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override @Deprecated public String encodeUrl(String url) { return encodeURL(url); }
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
encodeUrl
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override @Deprecated public String encodeRedirectUrl(String url) { return encodeRedirectURL(url); }
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
encodeRedirectUrl
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void sendError(int sc) throws IOException { sendError(sc, null); }
Replace (or add) a cookie. Using name, path and domain, look for a matching set-cookie header and replace it. @param cookie The cookie to add/replace
sendError
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void sendError(int code, String message) throws IOException { if (isIncluding()) return; switch (code) { case -1: _channel.abort(new IOException(message)); break; case HttpStatus.PROCESSING_102: sendProcessing(); break; default: _channel.getState().sendError(cod...
Send an error response. <p>In addition to the servlet standard handling, this method supports some additional codes:</p> <dl> <dt>102</dt><dd>Send a partial PROCESSING response and allow additional responses</dd> <dt>-1</dt><dd>Abort the HttpChannel and close the connection/stream</dd> </dl> @param code The error code ...
sendError
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void sendProcessing() throws IOException { if (_channel.isExpecting102Processing() && !isCommitted()) { _channel.sendResponse(HttpGenerator.PROGRESS_102_INFO, null, true); } }
Sends a 102-Processing response. If the connection is an HTTP connection, the version is 1.1 and the request has a Expect header starting with 102, then a 102 response is sent. This indicates that the request still be processed and real response can still be sent. This method is called by sendError if it is passed 10...
sendProcessing
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void sendRedirect(int code, String location) throws IOException { sendRedirect(code, location, false); }
Sends a response with one of the 300 series redirection codes. @param code the redirect status code @param location the location to send in {@code Location} headers @throws IOException if unable to send the redirect
sendRedirect
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void sendRedirect(String location, boolean consumeAll) throws IOException { sendRedirect(getHttpChannel().getRequest().getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER, location, consumeAll); }
Sends a response with a HTTP version appropriate 30x redirection. @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close` header to the res...
sendRedirect
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void sendRedirect(int code, String location, boolean consumeAll) throws IOException { if (consumeAll) getHttpChannel().ensureConsumeAllOrNotPersistent(); if (!HttpStatus.isRedirection(code)) throw new IllegalArgumentException("Not a 3xx redirect code"); if (!isMutable()) return; if (location ...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
sendRedirect
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void sendRedirect(String location) throws IOException { sendRedirect(HttpServletResponse.SC_MOVED_TEMPORARILY, location); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
sendRedirect
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void setDateHeader(String name, long date) { if (isMutable()) _fields.putDateField(name, date); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setDateHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void addDateHeader(String name, long date) { if (isMutable()) _fields.addDateField(name, date); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
addDateHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void setHeader(HttpHeader name, String value) { if (isMutable()) { if (HttpHeader.CONTENT_TYPE == name) setContentType(value); else { _fields.put(name, value); if (HttpHeader.CONTENT_LENGTH == name) { if (value == null) _contentLength = -1L; else _contentLengt...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void setHeader(String name, String value) { long biInt = _errorSentAndIncludes.get(); if (biInt != 0) { boolean errorSent = AtomicBiInteger.getHi(biInt) != 0; boolean including = AtomicBiInteger.getLo(biInt) > 0; if (!errorSent && including && name.startsWith(SET_INCLUDE_HEADER_PREFIX)...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public Collection<String> getHeaderNames() { return _fields.getFieldNamesCollection(); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
getHeaderNames
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public String getHeader(String name) { return _fields.get(name); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
getHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public Collection<String> getHeaders(String name) { Collection<String> i = _fields.getValuesList(name); if (i == null) return Collections.emptyList(); return i; }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
getHeaders
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void addHeader(String name, String value) { long biInt = _errorSentAndIncludes.get(); if (biInt != 0) { boolean errorSent = AtomicBiInteger.getHi(biInt) != 0; boolean including = AtomicBiInteger.getLo(biInt) > 0; if (!errorSent && including && name.startsWith(SET_INCLUDE_HEADER_PREFIX)...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
addHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void setIntHeader(String name, int value) { if (isMutable()) { _fields.putLongField(name, value); if (HttpHeader.CONTENT_LENGTH.is(name)) _contentLength = value; } }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setIntHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void addIntHeader(String name, int value) { if (isMutable()) { _fields.add(name, Integer.toString(value)); if (HttpHeader.CONTENT_LENGTH.is(name)) _contentLength = value; } }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
addIntHeader
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public void setStatus(int sc) { if (sc <= 0) throw new IllegalArgumentException(); if (isMutable()) { // Null the reason only if the status is different. This allows // a specific reason to be sent with setStatusWithReason followed by sendError. if (_status != sc) _reason = null; _s...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setStatus
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override @Deprecated public void setStatus(int sc, String sm) { setStatusWithReason(sc, sm); }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setStatus
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
public void setStatusWithReason(int sc, String sm) { if (sc <= 0) throw new IllegalArgumentException(); if (isMutable()) { _status = sc; _reason = sm; } }
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
setStatusWithReason
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT
@Override public String getCharacterEncoding() { if (_characterEncoding == null) { String encoding = MimeTypes.getCharsetAssumedFromContentType(_contentType); if (encoding != null) return encoding; encoding = MimeTypes.getCharsetInferredFromContentType(_contentType); if (encoding != null) retu...
Sends a response with a given redirection code. @param code the redirect status code @param location the location to send in {@code Location} headers @param consumeAll if True, consume any HTTP/1 request input before doing the redirection. If the input cannot be consumed without blocking, then add a `Connection: close...
getCharacterEncoding
java
theonedev/onedev
server-core/src/main/java/org/eclipse/jetty/server/Response.java
https://github.com/theonedev/onedev/blob/master/server-core/src/main/java/org/eclipse/jetty/server/Response.java
MIT