本文整理了Java中org.eclipse.jetty.server.Request.getHttpURI
方法的一些代码示例,展示了Request.getHttpURI
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getHttpURI
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getHttpURI
暂无
代码示例来源:origin: gocd/gocd
@Override
public String getUriPath() {
return request.getHttpURI().getPath();
}
代码示例来源:origin: gocd/gocd
@Override
public void setRequestURI(String uri) {
request.getHttpURI().setPath(uri);
}
代码示例来源:origin: gocd/gocd
@Override
public String getUriAsString() {
return request.getHttpURI().getPathQuery();
}
代码示例来源:origin: AsyncHttpClient/async-http-client
public void handle(String s, org.eclipse.jetty.server.Request r, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
if ("GET".equalsIgnoreCase(request.getMethod())) {
response.addHeader("target", r.getHttpURI().getPath());
response.setStatus(HttpServletResponse.SC_OK);
} else {
// this handler is to handle POST request
response.sendError(HttpServletResponse.SC_FORBIDDEN);
}
r.setHandled(true);
}
}
代码示例来源:origin: gocd/gocd
@Before
public void setUp() throws Exception {
initMocks(this);
jetty9Request = new Jetty9Request(request);
when(request.getHttpURI()).thenReturn(new HttpURI("foo/bar/baz"));
when(request.getRootURL()).thenReturn(new StringBuilder("http://junk/"));
}
代码示例来源:origin: apache/nifi
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
baseRequest.setHandled(true);
if ("Get".equalsIgnoreCase(request.getMethod())) {
response.setStatus(200);
String proxyPath = baseRequest.getHttpURI().toString();
response.setContentLength(proxyPath.length());
response.setContentType("text/plain");
try (PrintWriter writer = response.getWriter()) {
writer.print(proxyPath);
writer.flush();
}
} else {
response.setStatus(404);
response.setContentType("text/plain");
response.setContentLength(0);
}
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void log(Request request, Response response)
{
if (logger.isDebugEnabled()) {
logger.debug(
"%s %s %s %s",
request.getRemoteAddr(),
request.getMethod(),
request.getHttpURI().toString(),
request.getProtocol()
);
}
}
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldSetRequestUri() {
HttpURI requestUri = new HttpURI("foo/bar/baz");
when(request.getHttpURI()).thenReturn(requestUri);
jetty9Request.setRequestURI("foo/junk?a=b&c=d");
assertThat(requestUri.getPath(), is("foo/junk?a=b&c=d"));
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public String toString()
{
return String.format("%s@%x{r=%s,c=%b,a=%s,uri=%s}",
getClass().getSimpleName(),
hashCode(),
_requests,
_committed.get(),
_state.getState(),
_request.getHttpURI());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public String toString()
{
return String.format("%s%s%s %s%s@%x",
getClass().getSimpleName(),
_handled ? "[" : "(",
getMethod(),
getHttpURI(),
_handled ? "]" : ")",
hashCode());
}
代码示例来源:origin: jenkinsci/winstone
@Override
public String toString()
{
return String.format("%s%s%s %s%s@%x",
getClass().getSimpleName(),
_handled ? "[" : "(",
getMethod(),
getHttpURI(),
_handled ? "]" : ")",
hashCode());
}
代码示例来源:origin: jenkinsci/winstone
@Override
public String toString()
{
long timeStamp = _request.getTimeStamp();
return String.format("%s@%x{r=%s,c=%b,a=%s,uri=%s,age=%d}",
getClass().getSimpleName(),
hashCode(),
_requests,
_committed.get(),
_state.getState(),
_request.getHttpURI(),
timeStamp == 0 ? 0 : System.currentTimeMillis() - timeStamp);
}
代码示例来源:origin: labsai/EDDI
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpservletRequest = (HttpServletRequest) servletRequest;
URL requestURL = URI.create(httpservletRequest.getRequestURL().toString()).toURL();
String currentResourceURI = ((Request) httpservletRequest).getHttpURI().getPathQuery();
ThreadContext.put("currentResourceURI", currentResourceURI);
ThreadContext.put("currentURLProtocol", requestURL.getProtocol());
ThreadContext.put("currentURLHost", requestURL.getHost());
ThreadContext.put("currentURLPort", requestURL.getPort());
filterChain.doFilter(servletRequest, servletResponse);
ThreadContext.remove();
}
代码示例来源:origin: javaee/grizzly-ahc
public void handle(String s, Request r, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
if ("GET".equalsIgnoreCase(request.getMethod())) {
response.addHeader("target", r.getHttpURI().getPath());
response.setStatus(HttpServletResponse.SC_OK);
} else { // this handler is to handle POST request
response.sendError(HttpServletResponse.SC_FORBIDDEN);
}
r.setHandled(true);
}
}
代码示例来源:origin: javaee/grizzly-ahc
@Override
public void handle(String pathInContext, org.eclipse.jetty.server.Request request, HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException, ServletException {
String authorization = httpRequest.getHeader("Authorization");
String proxyAuthorization = httpRequest.getHeader("Proxy-Authorization");
if (proxyAuthorization == null) {
httpResponse.setStatus(HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED);
httpResponse.setHeader("Proxy-Authenticate", "Basic realm=\"Fake Realm\"");
} else if (proxyAuthorization
.equals("Basic am9obmRvZTpwYXNz") && authorization != null && authorization.equals("Basic dXNlcjpwYXNzd2Q=")) {
httpResponse.addHeader("target", request.getHttpURI().getPath());
httpResponse.setStatus(HttpServletResponse.SC_OK);
} else {
httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
httpResponse.setHeader("www-authenticate", "Basic realm=\"Fake Realm\"");
}
httpResponse.getOutputStream().flush();
httpResponse.getOutputStream().close();
request.setHandled(true);
}
}
代码示例来源:origin: javaee/grizzly-ahc
@Override
public void handle(String pathInContext, org.eclipse.jetty.server.Request request, HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException, ServletException {
String authorization = httpRequest.getHeader("Authorization");
if (authorization != null && authorization.equals("Basic dXNlcjpwYXNzd2Q="))
{
httpResponse.addHeader("target", request.getHttpURI().getPath());
target.handle(pathInContext, request, httpRequest, httpResponse);
}
else
{
httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
httpResponse.setHeader("www-authenticate", "Basic realm=\"Fake Realm\"");
httpResponse.getOutputStream().flush();
httpResponse.getOutputStream().close();
request.setHandled(true);
}
}
}
代码示例来源:origin: org.apache.druid/druid-server
@Override
public void log(Request request, Response response)
{
if (logger.isDebugEnabled()) {
logger.debug(
"%s %s %s %s",
request.getRemoteAddr(),
request.getMethod(),
request.getHttpURI().toString(),
request.getProtocol()
);
}
}
}
代码示例来源:origin: io.druid/druid-server
@Override
public void log(Request request, Response response)
{
if (logger.isDebugEnabled()) {
logger.debug(
"%s %s %s %s",
request.getRemoteAddr(),
request.getMethod(),
request.getHttpURI().toString(),
request.getProtocol()
);
}
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
{
if (request.getHttpURI().getScheme()==null)
request.setScheme(HttpScheme.HTTPS.asString());
SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request);
}
if (HttpScheme.HTTPS.is(request.getScheme()))
customizeSecure(request);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
/**
* <p>Pushes a secondary resource identified by this dispatcher.</p>
*
* @param request the primary request
* @deprecated Use {@link Request#getPushBuilder()} instead
*/
@Deprecated
public void push(ServletRequest request)
{
Request baseRequest = Request.getBaseRequest(request);
HttpFields fields = new HttpFields(baseRequest.getHttpFields());
String query=baseRequest.getQueryString();
if (_uri.hasQuery())
{
if (query==null)
query=_uri.getQuery();
else
query=query+"&"+_uri.getQuery(); // TODO is this correct semantic?
}
HttpURI uri = HttpURI.createHttpURI(request.getScheme(),request.getServerName(),request.getServerPort(),_uri.getPath(),baseRequest.getHttpURI().getParam(),query,null);
MetaData.Request push = new MetaData.Request(HttpMethod.GET.asString(),uri,baseRequest.getHttpVersion(),fields);
baseRequest.getHttpChannel().getHttpTransport().push(push);
}
内容来源于网络,如有侵权,请联系作者删除!