import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.gitblit.Constants;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.models.PathModel;
String fsc = settings.getString(Keys.web.forwardSlashCharacter, "/");
String encodedPath = document.replace(' ', '-');
try {
- encodedPath = URLEncoder.encode(encodedPath, "UTF-8");
+ encodedPath = URLEncoder.encode(encodedPath, Constants.ENCODING);
} catch (UnsupportedEncodingException e) {
logger.error(null, e);
}
*/
package com.gitblit.wicket;
+import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import org.apache.wicket.Component;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.form.StatelessForm;
-import org.apache.wicket.protocol.http.RequestUtils;
-//import org.apache.wicket.protocol.http.WicketURLDecoder;
-//import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
+import org.apache.wicket.util.encoding.UrlDecoder;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.gitblit.Constants;
import com.gitblit.utils.GitBlitRequestUtils;
import com.gitblit.wicket.pages.BasePage;
// render the hidden bookmarkable page field
AppendingStringBuffer buffer = new AppendingStringBuffer(HIDDEN_DIV_START);
buffer.append("<input type=\"hidden\" name=\"")
- .append(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME)
+ .append("wicket:bookmarkablePage")
.append("\" value=\":")
.append(pageClass.getName())
.append("\" />");
// insert the page parameters, if any, as hidden fields as long as they
// do not collide with any child wicket:id of the form.
if (pageParameters != null) {
- for (String key : pageParameters.keySet()) {
+ for (String key : pageParameters.getNamedKeys()) {
Component c = get(key);
if (c != null) {
// this form has a field id which matches the
log.warn(MessageFormat.format("Skipping page parameter \"{0}\" from sessionless form hidden fields because it collides with a form child wicket:id", key));
continue;
}
- String value = pageParameters.getString(key);
+ String value = pageParameters.get(key).toString();
buffer.append("<input type=\"hidden\" name=\"")
.append(recode(key))
.append("\" value=\"")
* @return reencoded value
*/
private String recode(String s) {
- String un = WicketURLDecoder.QUERY_INSTANCE.decode(s);
+ String un = UrlDecoder.QUERY_INSTANCE.decode(s, Constants.ENCODING);
return Strings.escapeMarkup(un).toString();
}
import java.util.List;
import org.apache.wicket.protocol.http.WebApplication;
-//import org.apache.wicket.protocol.http.WicketURLEncoder;
+import org.apache.wicket.util.encoding.UrlDecoder;
+import org.apache.wicket.util.encoding.UrlEncoder;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffEntry.Side;
import org.jsoup.nodes.Element;
+import com.gitblit.Constants;
import com.gitblit.servlet.RawServlet;
import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.HtmlBuilder;
// Actually, this should be done in RawServlet.asLink(). As it is now, this may be incorrect if that
// operation ever uses query parameters instead of paths, or if it is fixed to urlencode its path
// components. But I don't want to touch that static method in RawServlet.
- return WicketURLEncoder.PATH_INSTANCE.encode(component, StandardCharsets.UTF_8.name()).replaceAll("%2[fF]", "/");
+ return UrlEncoder.PATH_INSTANCE.encode(component, Constants.ENCODING).replaceAll("%2[fF]", "/");
}
}
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
+import com.gitblit.Constants;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
if (userAgent != null && userAgent.indexOf("MSIE 5.5") > -1) {\r
response.setHeader("Content-Disposition", "filename=\""\r
- + URLEncoder.encode(filename, "UTF-8") + "\"");\r
+ + URLEncoder.encode(filename, Constants.ENCODING) + "\"");\r
} else if (userAgent != null && userAgent.indexOf("MSIE") > -1) {\r
response.setHeader("Content-Disposition", "attachment; filename=\""\r
- + URLEncoder.encode(filename, "UTF-8") + "\"");\r
+ + URLEncoder.encode(filename, Constants.ENCODING) + "\"");\r
} else {\r
response.setHeader("Content-Disposition", "attachment; filename=\""\r
- + new String(filename.getBytes("UTF-8"), "latin1") + "\"");\r
+ + new String(filename.getBytes(Constants.ENCODING), "latin1") + "\"");\r
}\r
}\r
catch (UnsupportedEncodingException e) {\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.apache.wicket.model.StringResourceModel;\r
-import org.apache.wicket.protocol.http.RequestUtils;\r
import org.eclipse.jgit.lib.Ref;\r
import org.eclipse.jgit.lib.Repository;\r
\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.apache.wicket.model.StringResourceModel;\r
-import org.apache.wicket.request.cycle.RequestCycle;\r
import org.eclipse.jgit.lib.Constants;\r
import org.eclipse.jgit.lib.Repository;\r
\r