本文整理了Java中org.eclipse.jetty.server.Request.getQueryString
方法的一些代码示例,展示了Request.getQueryString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getQueryString
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getQueryString
暂无
代码示例来源:origin: jphp-group/jphp
@Signature
public String query() {
return request.getQueryString();
}
代码示例来源:origin: jersey/jersey
private URI getRequestUri(final Request request, final URI baseUri) {
try {
final String serverAddress = getServerAddress(baseUri);
String uri = request.getRequestURI();
final String queryString = request.getQueryString();
if (queryString != null) {
uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString);
}
return new URI(serverAddress + uri);
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
@Override
public String getURI() {
StringBuffer buf = request.getRequestURL();
if (request.getQueryString() != null) {
buf.append('?').append(request.getQueryString());
}
return buf.toString();
}
代码示例来源:origin: org.eclipse.jetty/jetty-security
int port = httpConfig.getSecurePort();
String url = URIUtil.newURI(scheme, request.getServerName(), port,request.getRequestURI(),request.getQueryString());
response.setContentLength(0);
response.sendRedirect(url);
代码示例来源:origin: org.keycloak/keycloak-jetty-adapter-spi
@Override
public String getURI() {
StringBuffer buf = request.getRequestURL();
if (request.getQueryString() != null) {
buf.append('?').append(request.getQueryString());
}
return buf.toString();
}
代码示例来源:origin: com.opentable.components/otj-logging-jetty
protected String fullUrl(Request request) {
final String result;
if (StringUtils.isNotEmpty(request.getQueryString())) {
result = request.getRequestURI() + '?' + request.getQueryString();
} else {
result = request.getRequestURI();
}
return result;
}
代码示例来源:origin: org.keycloak/keycloak-jetty-adapter-spi
@Override
public String getQueryParamValue(String paramName) {
if (queryParameters == null) {
queryParameters = UriUtils.decodeQueryString(request.getQueryString());
}
return queryParameters.getFirst(paramName);
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
@Override
public String getQueryParamValue(String paramName) {
if (queryParameters == null) {
queryParameters = UriUtils.decodeQueryString(request.getQueryString());
}
return queryParameters.getFirst(paramName);
}
代码示例来源:origin: org.eclipse.jetty/jetty-rewrite
@Override
public void applyURI(Request request, String oldURI, String newURI) throws IOException
{
if (_query==null)
{
request.setURIPathQuery(newURI);
}
else
{
String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
if (!_queryGroup && request.getQueryString()!=null)
query=request.getQueryString()+"&"+query;
request.setURIPathQuery(newURI);
request.setQueryString(query);
}
}
代码示例来源:origin: org.keycloak/keycloak-jetty94-adapter
public void saveRequest() {
// remember the current URI
HttpSession session = myRequest.getSession();
synchronized (session) {
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(FormAuthenticator.__J_URI) == null) {
StringBuffer buf = myRequest.getRequestURL();
if (myRequest.getQueryString() != null)
buf.append("?").append(myRequest.getQueryString());
session.setAttribute(FormAuthenticator.__J_URI, buf.toString());
session.setAttribute(JettyHttpFacade.__J_METHOD, myRequest.getMethod());
if ("application/x-www-form-urlencoded".equals(myRequest.getContentType()) && "POST".equalsIgnoreCase(myRequest.getMethod())) {
MultiMap<String> formParameters = extractFormParameters(myRequest);
MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
for (String key : formParameters.keySet()) {
for (Object value : formParameters.getValues(key)) {
map.add(key, (String) value);
}
}
session.setAttribute(CACHED_FORM_PARAMETERS, map);
}
}
}
}
代码示例来源:origin: org.keycloak/keycloak-saml-jetty93-adapter
public void saveRequest() {
// remember the current URI
HttpSession session = myRequest.getSession();
synchronized (session) {
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(FormAuthenticator.__J_URI) == null) {
StringBuffer buf = myRequest.getRequestURL();
if (myRequest.getQueryString() != null)
buf.append("?").append(myRequest.getQueryString());
session.setAttribute(FormAuthenticator.__J_URI, buf.toString());
session.setAttribute(JettyHttpFacade.__J_METHOD, myRequest.getMethod());
if ("application/x-www-form-urlencoded".equals(myRequest.getContentType()) && "POST".equalsIgnoreCase(myRequest.getMethod())) {
MultiMap<String> formParameters = extractFormParameters(myRequest);
MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
for (String key : formParameters.keySet()) {
for (Object value : formParameters.getValues(key)) {
map.add(key, (String) value);
}
}
session.setAttribute(CACHED_FORM_PARAMETERS, map);
}
}
}
}
代码示例来源:origin: org.keycloak/keycloak-saml-jetty81-adapter
public void saveRequest() {
// remember the current URI
HttpSession session = myRequest.getSession();
synchronized (session) {
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(FormAuthenticator.__J_URI) == null) {
StringBuffer buf = myRequest.getRequestURL();
if (myRequest.getQueryString() != null)
buf.append("?").append(myRequest.getQueryString());
session.setAttribute(FormAuthenticator.__J_URI, buf.toString());
session.setAttribute(JettyHttpFacade.__J_METHOD, myRequest.getMethod());
if ("application/x-www-form-urlencoded".equals(myRequest.getContentType()) && "POST".equalsIgnoreCase(myRequest.getMethod())) {
MultiMap<String> formParameters = extractFormParameters(myRequest);
MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
for (String key : formParameters.keySet()) {
for (Object value : formParameters.getValues(key)) {
map.add(key, (String) value);
}
}
session.setAttribute(CACHED_FORM_PARAMETERS, map);
}
}
}
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
public void saveRequest() {
// remember the current URI
HttpSession session = myRequest.getSession();
synchronized (session) {
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(FormAuthenticator.__J_URI) == null) {
StringBuffer buf = myRequest.getRequestURL();
if (myRequest.getQueryString() != null)
buf.append("?").append(myRequest.getQueryString());
session.setAttribute(FormAuthenticator.__J_URI, buf.toString());
session.setAttribute(JettyHttpFacade.__J_METHOD, myRequest.getMethod());
if ("application/x-www-form-urlencoded".equals(myRequest.getContentType()) && "POST".equalsIgnoreCase(myRequest.getMethod())) {
MultiMap<String> formParameters = extractFormParameters(myRequest);
MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
for (String key : formParameters.keySet()) {
for (Object value : formParameters.getValues(key)) {
map.add(key, (String) value);
}
}
session.setAttribute(CACHED_FORM_PARAMETERS, map);
}
}
}
}
代码示例来源:origin: org.keycloak/keycloak-saml-jetty91-adapter
public void saveRequest() {
// remember the current URI
HttpSession session = myRequest.getSession();
synchronized (session) {
// But only if it is not set already, or we save every uri that leads to a login form redirect
if (session.getAttribute(FormAuthenticator.__J_URI) == null) {
StringBuffer buf = myRequest.getRequestURL();
if (myRequest.getQueryString() != null)
buf.append("?").append(myRequest.getQueryString());
session.setAttribute(FormAuthenticator.__J_URI, buf.toString());
session.setAttribute(JettyHttpFacade.__J_METHOD, myRequest.getMethod());
if ("application/x-www-form-urlencoded".equals(myRequest.getContentType()) && "POST".equalsIgnoreCase(myRequest.getMethod())) {
MultiMap<String> formParameters = extractFormParameters(myRequest);
MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
for (String key : formParameters.keySet()) {
for (Object value : formParameters.getValues(key)) {
map.add(key, (String) value);
}
}
session.setAttribute(CACHED_FORM_PARAMETERS, map);
}
}
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
if (_query==null)
{
request.setRequestURI(newTarget);
}
else
{
String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
if (!_queryGroup && request.getQueryString()!=null)
query=request.getQueryString()+"&"+query;
HttpURI uri=new HttpURI(newTarget+"?"+query);
request.setUri(uri);
request.setRequestURI(newTarget);
request.setQueryString(query);
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
if (_query==null)
{
request.setRequestURI(newTarget);
}
else
{
String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
if (!_queryGroup && request.getQueryString()!=null)
query=request.getQueryString()+"&"+query;
HttpURI uri=new HttpURI(newTarget+"?"+query);
request.setUri(uri);
request.setRequestURI(newTarget);
request.setQueryString(query);
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
if (_query==null)
{
request.setRequestURI(newTarget);
}
else
{
String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
if (!_queryGroup && request.getQueryString()!=null)
query=request.getQueryString()+"&"+query;
HttpURI uri=new HttpURI(newTarget+"?"+query);
request.setUri(uri);
request.setRequestURI(newTarget);
request.setQueryString(query);
}
}
代码示例来源:origin: com.nesscomputing.components/ness-httpserver
@Test
public void testLog4jLoggerWorks()
{
Request req = createNiceMock(Request.class);
Response resp = createNiceMock(Response.class);
expect(req.getRemoteAddr()).andReturn("1.2.3.4").anyTimes();
Cookie[] cookies = {new Cookie("trumpet-JSON-api-AUTHORIZATION", "omgwtfbbq")};
expect(req.getCookies()).andReturn(cookies).anyTimes();
expect(req.getMethod()).andReturn("GET").anyTimes();
expect(req.getRequestURL()).andReturn(new StringBuffer("foo")).anyTimes();
expect(req.getQueryString()).andReturn("?bar").anyTimes();
expect(req.getContentLength()).andReturn(42).anyTimes();
expect(req.getTimeStamp()).andReturn(10000L).anyTimes();
expect(resp.getStatus()).andReturn(201).anyTimes();
replayAll();
final Config config = Config.getFixedConfig("ness.httpserver.request-log.log4j.enabled", "true");
final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new Log4jRequestLogModule(config));
inj.injectMembers(this);
Assert.assertNotNull(log);
log.log(req, resp);
verifyAll();
}
代码示例来源:origin: com.nesscomputing.components/ness-httpserver
@Test
public void testNullCookies() {
final Config config = Config.getFixedConfig("ness.httpserver.request-log.file.enabled", "true",
"ness.httpserver.request-log.file.fields", "remoteAddr,cookie:trumpet-json-api-authorization,method,requestUri,query,responseCode,responseHeader:Content-Length");
final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new FileRequestLogModule(config));
inj.injectMembers(this);
Assert.assertNotNull(fileRequestLog);
StringWriter buffer = new StringWriter();
fileRequestLog.setWriter(new PrintWriter(buffer));
Request req = createMock(Request.class);
Response resp = createMock(Response.class);
expect(req.getRemoteAddr()).andReturn("1.2.3.4").anyTimes();
expect(req.getCookies()).andReturn(null).anyTimes();
expect(req.getMethod()).andReturn("GET").anyTimes();
expect(req.getRequestURL()).andReturn(new StringBuffer("foo")).anyTimes();
expect(req.getRequestURI()).andReturn("foo").anyTimes();
expect(req.getQueryString()).andReturn("?bar").anyTimes();
expect(resp.getStatus()).andReturn(201).anyTimes();
expect(resp.getHeader("Content-Length")).andReturn("42").anyTimes();
replayAll();
fileRequestLog.log(req, resp);
assertEquals("1.2.3.4\t\tGET\tfoo\t?bar\t201\t42\n", buffer.getBuffer().toString());
verifyAll();
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!