今天我面对constructServiceUrl()的是org.jasig.cas.client.util.CommonUtils班上的方法.我觉得他很奇怪:
final StringBuffer buffer = new StringBuffer();
synchronized (buffer)
{
if (!serverName.startsWith("https://") && !serverName.startsWith("http://"))
{
buffer.append(request.isSecure() ? "https://" : "http://");
}
buffer.append(serverName);
buffer.append(request.getRequestURI());
if (CommonUtils.isNotBlank(request.getQueryString()))
{
final int location = request.getQueryString().indexOf(
artifactParameterName + "=");
if (location == 0)
{
final String returnValue = encode ? response.encodeURL(buffer.toString()) : buffer.toString();
if (LOG.isDebugEnabled())
{
LOG.debug("serviceUrl generated: " + returnValue);
}
return returnValue;
}
buffer.append("?");
if (location == -1)
{
buffer.append(request.getQueryString());
}
else if (location > 0)
{
final int …Run Code Online (Sandbox Code Playgroud) 我想为进程序列编写一个函数,如下所示:
def wrap[A >: Seq[_], B](seq : A)(f : () => B): Option[B] = {
if(seq.isEmpty) None
else Some(f())
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用错误:
error: value isEmpty is not a member of type parameter A
Run Code Online (Sandbox Code Playgroud)
if(seq.isEmpty)无
我做错了什么?