本文整理汇总了Java中org.eclipse.jetty.proxy.ProxyServlet.Transparent方法的典型用法代码示例。如果您正苦于以下问题:Java ProxyServlet.Transparent方法的具体用法?Java ProxyServlet.Transparent怎么用?Java ProxyServlet.Transparent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.proxy.ProxyServlet
的用法示例。
在下文中一共展示了ProxyServlet.Transparent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GadgetProxyServlet
import org.eclipse.jetty.proxy.ProxyServlet; //导入方法依赖的package包/类
@Inject
public GadgetProxyServlet(
@Named(CoreSettings.GADGET_SERVER_HOSTNAME) final String gadgetServerHostname,
@Named(CoreSettings.GADGET_SERVER_PORT) final int gadgetServerPort,
@Named(CoreSettings.GADGET_SERVER_PATH) final String gadgetServerPath) {
this.gadgetServerHostname = gadgetServerHostname;
this.gadgetServerPort = gadgetServerPort;
this.gadgetServerPath = gadgetServerPath;
LOG.info("Starting GadgetProxyServlet for " + gadgetServerHostname + ":" + gadgetServerPort);
proxyServlet = new ProxyServlet.Transparent();
}
示例2: run
import org.eclipse.jetty.proxy.ProxyServlet; //导入方法依赖的package包/类
@Override
public void run(final ExampleConfiguration configuration, final Environment environment) throws Exception {
environment.jersey().register(new ExampleResource());
final String proxyPrefix = configuration.getProxyPrefix();
final String proxyTo = configuration.getProxyTo();
final ProxyServlet.Transparent proxyServlet = new ProxyServlet.Transparent(proxyTo, proxyPrefix);
environment.servlets().addServlet("ProxyServlet", proxyServlet).addMapping(proxyPrefix + "/*");
}
示例3: addTransparentProxy
import org.eclipse.jetty.proxy.ProxyServlet; //导入方法依赖的package包/类
/**
* Add a transparent proxy to the servlet registry. The servlet will proxy to the
* specified URL pattern.
* For example: addTransparentProxy("/gadgets/*","http://gmodules:80/gadgets", "/gadgets")
* @param urlPattern the URL pattern for paths. Eg, '/foo', '/foo/*'.
* @param proxyTo the URL to proxy to.
* @param prefix the prefix that should be proxied.
*/
public void addTransparentProxy(String urlPattern, String proxyTo, String prefix) {
Preconditions.checkNotNull(urlPattern);
Preconditions.checkNotNull(proxyTo);
Preconditions.checkNotNull(prefix);
ServletHolder proxy = new ServletHolder(ProxyServlet.Transparent.class);
proxy.setInitParameter("proxyTo", proxyTo);
proxy.setInitParameter("prefix", prefix);
servletRegistry.add(Pair.of(urlPattern, proxy));
}