I've missed that _buf value is populated with

StringBuilder buf = _connection.getRequest().getRootURL();

https://github.com/eclipse/jetty.project/blob/master/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java#L666


But the algorithm is the same
It goes to Request
https://github.com/eclipse/jetty.project/blob/master/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java#L1345

And to URIUtil
https://github.com/eclipse/jetty.project/blob/master/jetty-util/src/main/java/org/eclipse/jetty/util/URIUtil.java#L758

public static void appendSchemeHostPort(StringBuilder url,String scheme,String server, int port)
    {
        if (server.indexOf(':')>=0&&server.charAt(0)!='[')
            url.append(scheme).append("://").append('[').append(server).append(']');
        else
            url.append(scheme).append("://").append(server);

        if (port > 0)
        {
            switch(scheme)
            {
                case "http":
                    if (port!=80) 
                        url.append(':').append(port);
                    break;
                    
                case "https":
                    if (port!=443) 
                        url.append(':').append(port);
                    break;

                default:
                    url.append(':').append(port);
            }
        }
    }

I've tried to call

println org.kohsuke.stapler.Stapler.currentRequest.getRootURL()

But still with no success

groovy.lang.MissingMethodException: No signature of method: org.kohsuke.stapler.RequestImpl.getRootURL() is applicable for argument types: () values: []
Possible solutions: getRootPath(), getProtocol(), getCookies(), getRequestURL()
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to