Tag: httprequest

GWT RequestBuilder – 跨站请求

我正在尝试使用GWT请求构建器创建跨站点请求,我无法使其工作。 正如您所看到的,这是一个样本GWT项目,我已经浏览了https://developers.google.com/web-toolkit/doc/latest/tutorial/Xsite 。 但我仍然缺少一些东西。 我在这里发布代码。 我错过了什么..? package com.gwt.reqbuilder.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.http.client.Request; import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; import com.google.gwt.http.client.URL; import com.google.gwt.user.client.Window; public class GWTRequestBuilder implements EntryPoint { private static final String JSON_URL = “http://localhost:8000/?q=ABC&callback=callback125″; public void onModuleLoad() { GWTPOSTHTTP(); } public void GWTPOSTHTTP() { String postUrl=”http://localhost:8000″; String requestData=”q=ABC&callback=callback125”; RequestBuilder builder = new […]

如何从http或https请求获取带端口的主机名

我在jboss容器中部署了两个应用程序(相同的unix框)。 如果我从app1收到请求,我需要为app2构建相应的请求。 例如: 如果app1请求是: http : //example.com/context? param1 = 123 然后我需要提取“ http://example.com/ ”,以便我可以构建第二个应用程序的请求。 我试过用: HttpServletRequest.getServerName() & HttpServletRequest.getServerPort() & \ HttpServletRequest.getHeader(“host”) 方法,但请求可能是http或https。 如果还有其他更好的方法,请告诉我。 谢谢!