|
@@ -21,6 +21,7 @@ import java.net.URLEncoder;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.codelibs.core.lang.StringUtil;
|
|
import org.codelibs.core.lang.StringUtil;
|
|
import org.codelibs.core.net.URLUtil;
|
|
import org.codelibs.core.net.URLUtil;
|
|
@@ -41,6 +42,7 @@ import org.lastaflute.web.Execute;
|
|
import org.lastaflute.web.response.ActionResponse;
|
|
import org.lastaflute.web.response.ActionResponse;
|
|
import org.lastaflute.web.response.HtmlResponse;
|
|
import org.lastaflute.web.response.HtmlResponse;
|
|
import org.lastaflute.web.response.StreamResponse;
|
|
import org.lastaflute.web.response.StreamResponse;
|
|
|
|
+import org.lastaflute.web.util.LaRequestUtil;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@@ -152,13 +154,31 @@ public class GoAction extends FessSearchAction {
|
|
return redirect(ErrorAction.class);
|
|
return redirect(ErrorAction.class);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return HtmlResponse.fromRedirectPathAsIs(targetUrl + hash);
|
|
|
|
|
|
+ return redirect(targetUrl + hash);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return HtmlResponse.fromRedirectPathAsIs(targetUrl + hash);
|
|
|
|
|
|
+ return redirect(targetUrl + hash);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected ActionResponse redirect(final String url) {
|
|
|
|
+ final HttpServletRequest request2 = LaRequestUtil.getRequest();
|
|
|
|
+ final String enc = request2.getCharacterEncoding() == null ? Constants.UTF_8 : request2.getCharacterEncoding();
|
|
|
|
+ final StringBuilder buf = new StringBuilder(url.length() + 100);
|
|
|
|
+ for (final char c : url.toCharArray()) {
|
|
|
|
+ if (CharUtil.isUrlChar(c)) {
|
|
|
|
+ buf.append(c);
|
|
|
|
+ } else {
|
|
|
|
+ try {
|
|
|
|
+ buf.append(URLEncoder.encode(String.valueOf(c), enc));
|
|
|
|
+ } catch (final UnsupportedEncodingException e) {
|
|
|
|
+ buf.append(c);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return HtmlResponse.fromRedirectPathAsIs(buf.toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
protected boolean isFileSystemPath(final String url) {
|
|
protected boolean isFileSystemPath(final String url) {
|
|
return url.startsWith("file:") || url.startsWith("smb:") || url.startsWith("ftp:");
|
|
return url.startsWith("file:") || url.startsWith("smb:") || url.startsWith("ftp:");
|
|
}
|
|
}
|