本文整理了Java中org.simpleframework.http.Request.getAddress
方法的一些代码示例,展示了Request.getAddress
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getAddress
方法的具体详情如下:
包路径:org.simpleframework.http.Request
类名称:Request
方法名:getAddress
暂无
代码示例来源:origin: jersey/jersey
private URI getBaseUri(final Request request) {
try {
final String hostHeader = request.getValue("Host");
if (hostHeader != null) {
final String scheme = request.isSecure() ? "https" : "http";
return new URI(scheme + "://" + hostHeader + "/");
} else {
final Address address = request.getAddress();
return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null,
null);
}
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: mpetazzoni/ttorrent
myRequestProcessor.process(request.getAddress().toString(), request.getClientAddress().getAddress().getHostAddress(),
getRequestHandler(response));
} else {
myMultiAnnounceRequestProcessor.process(request.getContent(), request.getAddress().toString(),
request.getClientAddress().getAddress().getHostAddress(), getRequestHandler(response));
代码示例来源:origin: org.simpleframework/simple
/**
* This is used to acquire the address from the request line.
* An address is the full URI including the scheme, domain, port
* and the query parts. This allows various parameters to be
* acquired without having to parse the raw request target URI.
*
* @return this returns the address of the request line
*/
public Address getAddress() {
return request.getAddress();
}
代码示例来源:origin: ngallagher/simpleframework
/**
* This is used to acquire the address from the request line.
* An address is the full URI including the scheme, domain, port
* and the query parts. This allows various parameters to be
* acquired without having to parse the raw request target URI.
*
* @return this returns the address of the request line
*/
public Address getAddress() {
return request.getAddress();
}
代码示例来源:origin: org.simpleframework/simple-http
/**
* This is used to acquire the address from the request line.
* An address is the full URI including the scheme, domain, port
* and the query parts. This allows various parameters to be
* acquired without having to parse the raw request target URI.
*
* @return this returns the address of the request line
*/
public Address getAddress() {
return request.getAddress();
}
代码示例来源:origin: miltonio/milton2
@Override
public String getFromAddress() {
Address add = baseRequest.getAddress();
if (add == null) {
return null;
}
return add.toString();
}
代码示例来源:origin: miltonio/milton2
@Override
public String toString() {
return request.getMethod() + " " + request.getAddress().toString();
}
代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server
private URI getBaseUri(Request request) {
try {
final Address address = request.getAddress();
return new URI(
address.getScheme(),
null,
address.getDomain(),
address.getPort(),
"/",
null, null);
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-simple-http
private URI getBaseUri(final Request request) {
try {
final String hostHeader = request.getValue("Host");
if (hostHeader != null) {
final String scheme = request.isSecure() ? "https" : "http";
return new URI(scheme + "://" + hostHeader + "/");
} else {
final Address address = request.getAddress();
return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null,
null);
}
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: miltonio/milton2
} else {
String host = baseRequest.getValue("Host");
Address a = baseRequest.getAddress();
if (host == null) {
host = a.getDomain();
代码示例来源:origin: kristofa/mock-http-server
public static FullHttpRequest convert(final Request request) {
byte[] data = null;
try {
final InputStream inputStream = request.getInputStream();
try {
data = IOUtils.toByteArray(inputStream);
} finally {
inputStream.close();
}
} catch (final IOException e) {
LOGGER.error("IOException when getting request content.", e);
}
final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
httpRequest.domain(request.getAddress().getDomain());
httpRequest.port(request.getAddress().getPort());
httpRequest.method(Method.valueOf(request.getMethod()));
httpRequest.path(request.getPath().getPath());
if (data.length > 0) {
httpRequest.content(data);
}
for (final String headerField : request.getNames()) {
for (final String headerFieldValue : request.getValues(headerField)) {
httpRequest.httpMessageHeader(headerField, headerFieldValue);
}
}
for (final Entry<String, String> entry : request.getQuery().entrySet()) {
httpRequest.queryParameter(entry.getKey(), entry.getValue());
}
return httpRequest;
}
代码示例来源:origin: org.kie.remote/kie-remote-client
public void handle( Request req, Response resp ) {
try {
PrintStream out = resp.getPrintStream(1024);
String address = req.getAddress().toString();
if( address.equals(DEFAULT_ENPOINT) ) {
String content = readInputStreamAsString(req.getInputStream());
JaxbCommandsRequest cmdsReq = (JaxbCommandsRequest) jaxbSerializationProvider.deserialize(content);
String [] headerNames = {
TEST_HEADER_NAME,
ANOTHER_TEST_HEADER_NAME,
NOT_SENT_HEADER_NAME
};
List<String> headerValues = new ArrayList<String>();
for( String headerName : headerNames ) {
String headerVal = req.getValue(headerName);
if( headerVal != null ) {
headerValues.add(headerVal);
}
}
String output = handleJaxbCommandsRequest(cmdsReq, headerValues);
resp.setCode(HttpURLConnection.HTTP_OK);
out.print(output);
} else {
resp.setCode(HttpURLConnection.HTTP_BAD_REQUEST);
}
out.close();
} catch( Exception e ) {
e.printStackTrace();
}
}
代码示例来源:origin: zanata/zanata-platform
@Override
public void handle(Request request, Response response) {
try {
PrintStream body = response.getPrintStream();
long time = System.currentTimeMillis();
response.setValue("Content-Type", "text/plain");
response.setContentType("application/xml;charset=utf-8");
response.setDate("Date", time);
response.setDate("Last-Modified", time);
String path = request.getAddress().getPath().getPath();
log.trace("request path is {}", path);
StatusAndContent statusAndContent = tryMatchPath(path);
Status status = statusAndContent.status;
response.setStatus(status);
String content = statusAndContent.content;
log.trace("mock container returning: status [{}], content [{}]",
status, content);
body.println(content);
body.close();
} catch (Exception e) {
e.printStackTrace();
response.setStatus(Status.INTERNAL_SERVER_ERROR);
try {
response.close();
} catch (IOException e1) {
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: org.kie.remote/kie-remote-client
logger.debug(headers[0] + ": " + user + "/" + pass);
String address = req.getAddress().toString();
if( address.equals(DEFAULT_ENDPOINT) ) {
resp.setValue(HttpHeaders.CONTENT_TYPE, "text/plain");
代码示例来源:origin: org.kie.remote/kie-remote-client
public void handle( Request req, Response resp ) {
try {
PrintStream out = resp.getPrintStream(1024);
String address = req.getAddress().toString();
if( address.equals(REDIRECT_PATH) ) {
resp.setValue(HttpHeaders.LOCATION, REAL_ENDPOINT_PATH);
内容来源于网络,如有侵权,请联系作者删除!