Tabnine Logo
QueryStringDecoder.getPath
Code IndexAdd Tabnine to your IDE (free)

How to use
getPath
method
in
org.jboss.netty.handler.codec.http.QueryStringDecoder

Best Java code snippets using org.jboss.netty.handler.codec.http.QueryStringDecoder.getPath (Showing top 4 results out of 315)

origin: io.netty/netty

/**
 * Returns the decoded key-value parameter pairs of the URI.
 */
public Map<String, List<String>> getParameters() {
  if (params == null) {
    if (hasPath) {
      int pathLength = getPath().length();
      if (uri.length() == pathLength) {
        return Collections.emptyMap();
      }
      decodeParams(uri.substring(pathLength + 1));
    } else {
      if (uri.length() == 0) {
        return Collections.emptyMap();
      }
      decodeParams(uri);
    }
  }
  return params;
}
origin: cgbystrom/netty-tools

protected String sanitizeUri(String uri) throws URISyntaxException {
  // Decode the path.
  try {
    uri = URLDecoder.decode(uri, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    try {
      uri = URLDecoder.decode(uri, "ISO-8859-1");
    } catch (UnsupportedEncodingException e1) {
      throw new Error();
    }
  }
  // Convert file separators.
  uri = uri.replace(File.separatorChar, '/');
  // Simplistic dumb security check.
  // You will have to do something serious in the production environment.
  if (uri.contains(File.separator + ".") ||
    uri.contains("." + File.separator) ||
    uri.startsWith(".") || uri.endsWith(".")) {
    return null;
  }
  QueryStringDecoder decoder = new QueryStringDecoder(uri);
  uri = decoder.getPath();
  if (uri.endsWith("/")) {
    uri += "index.html";
  }
  return uri;
}
origin: cgbystrom/sockjs-netty

request.setUri(request.getUri().replaceFirst(service.getUrl(), ""));
QueryStringDecoder qsd = new QueryStringDecoder(request.getUri());
String path = qsd.getPath();
origin: cgbystrom/sockjs-netty

public void handle(HttpRequest request, HttpResponse response) {
  QueryStringDecoder qsd = new QueryStringDecoder(request.getUri());
  String path = qsd.getPath();
  if (!path.matches(".*/iframe[0-9-.a-z_]*.html")) {
    response.setStatus(HttpResponseStatus.NOT_FOUND);
    response.setContent(ChannelBuffers.copiedBuffer("Not found", CharsetUtil.UTF_8));
    return;
  }
  response.setHeader(HttpHeaders.Names.SET_COOKIE, "JSESSIONID=dummy; path=/");
  if (request.containsHeader(HttpHeaders.Names.IF_NONE_MATCH)) {
    response.setStatus(HttpResponseStatus.NOT_MODIFIED);
    response.removeHeader(HttpHeaders.Names.CONTENT_TYPE);
  } else {
    response.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/html; charset=UTF-8");
    response.setHeader(HttpHeaders.Names.CACHE_CONTROL, "max-age=31536000, public");
    response.setHeader(HttpHeaders.Names.EXPIRES, "FIXME"); // FIXME: Fix this
    response.removeHeader(HttpHeaders.Names.SET_COOKIE);
    response.setContent(content);
  }
  response.setHeader(HttpHeaders.Names.ETAG, etag);
}
 
org.jboss.netty.handler.codec.httpQueryStringDecodergetPath

Javadoc

Returns the decoded path string of the URI.

Popular methods of QueryStringDecoder

  • <init>
    Creates a new decoder that decodes the specified URI encoded in the specified charset.
  • getParameters
    Returns the decoded key-value parameter pairs of the URI.
  • addParam
  • decodeComponent
    Decodes a bit of an URL encoded by a browser. The string is expected to be encoded as per RFC 3986,
  • decodeHexNibble
    Helper to decode half of a hexadecimal number from a string.
  • decodeParams

Popular in Java

  • Creating JSON documents from java classes using gson
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now