org.simpleframework.http.Request.getContentType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(270)

本文整理了Java中org.simpleframework.http.Request.getContentType方法的一些代码示例,展示了Request.getContentType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getContentType方法的具体详情如下:
包路径:org.simpleframework.http.Request
类名称:Request
方法名:getContentType

Request.getContentType介绍

暂无

代码示例

代码示例来源:origin: org.simpleframework/simple

  1. /**
  2. * This is a convenience method that can be used to determine the
  3. * content type of the message body. This will determine whether
  4. * there is a <code>Content-Type</code> header, if there is then
  5. * this will parse that header and represent it as a typed object
  6. * which will expose the various parts of the HTTP header.
  7. *
  8. * @return this returns the content type value if it exists
  9. */
  10. public ContentType getContentType() {
  11. return request.getContentType();
  12. }

代码示例来源:origin: org.simpleframework/simple-http

  1. /**
  2. * This is a convenience method that can be used to determine the
  3. * content type of the message body. This will determine whether
  4. * there is a <code>Content-Type</code> header, if there is then
  5. * this will parse that header and represent it as a typed object
  6. * which will expose the various parts of the HTTP header.
  7. *
  8. * @return this returns the content type value if it exists
  9. */
  10. public ContentType getContentType() {
  11. return request.getContentType();
  12. }

代码示例来源:origin: ngallagher/simpleframework

  1. /**
  2. * This is a convenience method that can be used to determine the
  3. * content type of the message body. This will determine whether
  4. * there is a <code>Content-Type</code> header, if there is then
  5. * this will parse that header and represent it as a typed object
  6. * which will expose the various parts of the HTTP header.
  7. *
  8. * @return this returns the content type value if it exists
  9. */
  10. public ContentType getContentType() {
  11. return request.getContentType();
  12. }

代码示例来源:origin: io.restx/restx-server-simple

  1. @Override
  2. public String getContentType() {
  3. return request.getContentType().getType();
  4. }

代码示例来源:origin: restx/restx

  1. @Override
  2. public String getContentType() {
  3. return request.getContentType().getType();
  4. }

代码示例来源:origin: lantunes/fixd

  1. public String getContentType() {
  2. return request.getContentType().getType();
  3. }

代码示例来源:origin: org.simpleframework/simple-http

  1. /**
  2. * This is used to determine if the content type is a form POST
  3. * of type application/x-www-form-urlencoded. Such a type is
  4. * used when a HTML form is used to post data to the server.
  5. *
  6. * @return this returns true if content type is a form post
  7. */
  8. private boolean isFormPost() {
  9. ContentType type = request.getContentType();
  10. if(type == null) {
  11. return false;
  12. }
  13. return isFormPost(type);
  14. }

代码示例来源:origin: CodeStory/fluent-http

  1. @Override
  2. public String contentType() {
  3. return request.getContentType().getType();
  4. }

代码示例来源:origin: org.simpleframework/simple

  1. /**
  2. * This is used to determine if the content type is a form POST
  3. * of type application/x-www-form-urlencoded. Such a type is
  4. * used when a HTML form is used to post data to the server.
  5. *
  6. * @return this returns true if content type is a form post
  7. */
  8. private boolean isFormPost() {
  9. ContentType type = request.getContentType();
  10. if(type == null) {
  11. return false;
  12. }
  13. return isFormPost(type);
  14. }

代码示例来源:origin: ngallagher/simpleframework

  1. /**
  2. * This is used to determine if the content type is a form POST
  3. * of type application/x-www-form-urlencoded. Such a type is
  4. * used when a HTML form is used to post data to the server.
  5. *
  6. * @return this returns true if content type is a form post
  7. */
  8. private boolean isFormPost() {
  9. ContentType type = request.getContentType();
  10. if(type == null) {
  11. return false;
  12. }
  13. return isFormPost(type);
  14. }

代码示例来源:origin: lantunes/fixd

  1. public ResolvedRequest resolve(Request request) {
  2. ResolvedRequest resolved = new ResolvedRequest();
  3. String method = request.getMethod();
  4. String path = RequestUtils.getUndecodedPath(request);
  5. ContentType requestContentType = request.getContentType();
  6. /* get the route and the handler for this request */
  7. Route route = router.route(path);
  8. if (route == null) {
  9. logger.error("could not find a route for " + path);
  10. resolved.errorStatus = Status.NOT_FOUND;
  11. return resolved;
  12. }
  13. String contentType = requestContentType != null ?
  14. requestContentType.getType() : null;
  15. HandlerKey key = new HandlerKey(method, route, contentType);
  16. RequestHandlerImpl handler = handlerMap.get(key);
  17. if (handler == null) {
  18. logger.error("could not find a handler for " +
  19. method + " - " + path + " - " + contentType);
  20. resolved.errorStatus = Status.METHOD_NOT_ALLOWED;
  21. return resolved;
  22. }
  23. resolved.handler = handler;
  24. resolved.route = route;
  25. resolved.key = key;
  26. return resolved;
  27. }

相关文章