- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
最终编辑
所以在研究了这个之后,因为我所看到的答案并不完全正确,我发现 Spring 在扩展匹配方面做了一些奇怪的事情。如果我提交这样的请求 byNameOrAtlName/myStringHere.1
或 byNameOrAtlName/myStringHere.12
一切都很好,但是 byNameOrAtlName/myStringHere.123
导致它像 byNameOrAtlName/myStringHere.com
一样中断,但 byNameOrAtlName/myStringHere.co
可以,但 byNameOrAtlName/myStringHere.c
不行.
总之,我不知道 spring 使用什么逻辑来确定扩展内容,但对于某些扩展, {varName:.+}
可以作为一种解决方法,但它看起来像您需要完全禁用点文件后缀才能真正绕过它。
使用 Spring 4.1.6
Spring 抛出以下异常 org.springframework.web.HttpMediaTypeNotAcceptableException: 找不到可接受的表示形式
我有以下代码,除非字符串(名称)中有句点,否则一切正常。
@RestController
@RequestMapping(value = "/foo/")
public class Testing{
@RequestMapping(value = "byNameOrAltName/{name:.+}", method = RequestMethod.GET)
@Transactional(readOnly = true)
public Collection<MyDTO> getByNameOrAltNAme(@PathVariable("name") String name) {
return myRepo.getMyDTOsByNameOrAtlName(name);
}
}
所以这行得通。 http://localhost:8080/data/foo/byNameOrAtlName/myStringHere
,但如果我这样做会失败 http://localhost:8080/data/foo/byNameOrAtlName/myStringHere.fluffy
我阅读了有关此异常的其他答案,但似乎都不适用于我的情况。起初我认为这是 Spring 不喜欢周期在路径中的问题,我之前使用正则表达式 .+
修复了这个问题,但我尝试了使用和不使用正则表达式和我得到同样的错误。
关于 Spring 为什么会抛出这个的任何想法?
编辑
这是我的调试日志:
21:32:09,118 DEBUG work.orm.jpa.support.OpenEntityManagerInViewFilter: 161 - Opening JPA EntityManager in OpenEntityManagerInViewFilter
21:32:09,118 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/r2d2/**'
21:32:09,118 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 1 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
21:32:09,118 DEBUG y.web.context.HttpSessionSecurityContextRepository: 192 - Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT: 'org.springframework.security.core.context.SecurityContextImpl@3eda7134: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@3eda7134: REDACTED
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 2 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'
21:32:09,122 DEBUG ework.security.web.header.writers.HstsHeaderWriter: 128 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@518864fd
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 4 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
21:32:09,122 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/logout'
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 5 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
21:32:09,122 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 131 - Request 'GET /data/restaurant/supplier/bynameoraltname/quill.com' doesn't match 'POST /login
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
21:32:09,122 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
21:32:09,122 DEBUG y.web.authentication.AnonymousAuthenticationFilter: 106 - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.authentication.UsernamePasswordAuthenticationToken@3eda7134: REDACTED
21:32:09,123 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
21:32:09,123 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
21:32:09,123 DEBUG org.springframework.security.web.FilterChainProxy: 324 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/login.html'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/index.html'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/*/css/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/*/fonts/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/*/img/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/*/lib/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/*/vendor/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/sales/**'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/registration/termsofservice.html'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/registration/privacypolicy.html'
21:32:09,123 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/restaurantui/useractivation.html**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/restaurantui/index.html'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/basicuseractivation/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/orderconfirmation/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/supplieruseractivation/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/restaurantuseractivation/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/useractivation/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/user/passwordresetrequest'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/user/changepasswordfortoken/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/user/checkpasswordtokenvalidity/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/signup/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/downloads/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/unsubscribe.html'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/restaurant/emailsubscriptions/unsubscribe/**'
21:32:09,124 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/adminui/**'
21:32:09,125 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/admin*'
21:32:09,125 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/confirm/**'
21:32:09,125 DEBUG rk.security.web.util.matcher.AntPathRequestMatcher: 151 - Checking match of request : '/data/restaurant/supplier/bynameoraltname/quill.com'; against '/data/**'
21:32:09,125 DEBUG ity.web.access.intercept.FilterSecurityInterceptor: 218 - Secure object: FilterInvocation: URL: /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116; Attributes: [isAuthenticated()]
21:32:09,125 DEBUG ity.web.access.intercept.FilterSecurityInterceptor: 347 - Previously Authenticated: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@3eda7134: REDACTED
21:32:09,126 DEBUG ingframework.security.access.vote.AffirmativeBased: 65 - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@3b97d645, returned: 1
21:32:09,126 DEBUG ity.web.access.intercept.FilterSecurityInterceptor: 242 - Authorization successful
21:32:09,126 DEBUG ity.web.access.intercept.FilterSecurityInterceptor: 255 - RunAsManager did not change Authentication object
21:32:09,126 DEBUG org.springframework.security.web.FilterChainProxy: 309 - /data/restaurant/supplier/byNameOrAltName/quill.com?_=1434072729116 reached end of additional filter chain; proceeding with original chain
21:32:09,126 DEBUG org.springframework.web.servlet.DispatcherServlet: 861 - DispatcherServlet with name 'Spring MVC Servlet' processing GET request for [/data/restaurant/supplier/byNameOrAltName/quill.com]
21:32:09,126 DEBUG mvc.method.annotation.RequestMappingHandlerMapping: 294 - Looking up handler method for path /restaurant/supplier/byNameOrAltName/quill.com
21:32:09,127 DEBUG mvc.method.annotation.RequestMappingHandlerMapping: 299 - Returning handler method [public java.util.Collection<com.siftit.webservices.personae.restaurant.dtos.SupplierDTO> com.siftit.webservices.personae.restaurant.RestaurantSupplierWebService.getByNameOrAltNAme(java.lang.String)]
21:32:09,128 DEBUG k.beans.factory.support.DefaultListableBeanFactory: 248 - Returning cached instance of singleton bean 'restaurantSupplierWebService'
21:32:09,128 DEBUG org.springframework.web.servlet.DispatcherServlet: 947 - Last-Modified value for [/data/restaurant/supplier/byNameOrAltName/quill.com] is: -1
21:32:09,128 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,128 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 367 - Creating new transaction with name [com.siftit.webservices.security.WebServiceInterceptor.preHandle]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
21:32:09,128 DEBUG rg.springframework.jdbc.datasource.DataSourceUtils: 153 - Setting JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@624e4a40] read-only
21:32:09,128 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 403 - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@6d32e04]
21:32:09,128 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,129 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,129 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,129 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,140 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 755 - Initiating transaction commit
21:32:09,140 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 512 - Committing JPA transaction on EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356]
21:32:09,141 DEBUG rg.springframework.jdbc.datasource.DataSourceUtils: 222 - Resetting read-only flag of JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@624e4a40]
21:32:09,141 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 605 - Not closing pre-bound JPA EntityManager after transaction
21:32:09,142 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,142 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 367 - Creating new transaction with name [com.siftit.webservices.personae.restaurant.RestaurantSupplierWebService.getByNameOrAltNAme]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
21:32:09,142 DEBUG rg.springframework.jdbc.datasource.DataSourceUtils: 153 - Setting JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@624e4a40] read-only
21:32:09,142 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 403 - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@32689afc]
21:32:09,143 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,143 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,143 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,143 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,144 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,144 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,144 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 334 - Found thread-bound EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356] for JPA transaction
21:32:09,144 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 472 - Participating in existing transaction
21:32:09,146 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 755 - Initiating transaction commit
21:32:09,146 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 512 - Committing JPA transaction on EntityManager [org.hibernate.jpa.internal.EntityManagerImpl@1d65b356]
21:32:09,146 DEBUG rg.springframework.jdbc.datasource.DataSourceUtils: 222 - Resetting read-only flag of JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@624e4a40]
21:32:09,147 DEBUG org.springframework.orm.jpa.JpaTransactionManager: 605 - Not closing pre-bound JPA EntityManager after transaction
21:32:09,147 DEBUG ethod.annotation.ExceptionHandlerExceptionResolver: 134 - Resolving exception from handler [public java.util.Collection<com.siftit.webservices.personae.restaurant.dtos.SupplierDTO> com.siftit.webservices.personae.restaurant.RestaurantSupplierWebService.getByNameOrAltNAme(java.lang.String)]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
21:32:09,147 DEBUG k.beans.factory.support.DefaultListableBeanFactory: 248 - Returning cached instance of singleton bean 'globalWebServiceExceptionHandler'
21:32:09,147 DEBUG ethod.annotation.ExceptionHandlerExceptionResolver: 360 - Invoking @ExceptionHandler method: public java.lang.Object com.siftit.webservices.GlobalWebServiceExceptionHandler.defaultErrorHandler(javax.servlet.http.HttpServletRequest,java.lang.Exception) throws java.lang.Exception
21:32:09,155 DEBUG thod.annotation.RequestResponseBodyMethodProcessor: 163 - Written [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation] as "application/x-msdownload" using [org.springframework.http.converter.StringHttpMessageConverter@214c8f9d]
21:32:09,155 DEBUG org.springframework.web.servlet.DispatcherServlet:1034 - Null ModelAndView returned to DispatcherServlet with name 'Spring MVC Servlet': assuming HandlerAdapter completed request handling
21:32:09,155 DEBUG org.springframework.web.servlet.DispatcherServlet: 996 - Successfully completed request
21:32:09,155 DEBUG ork.security.web.access.ExceptionTranslationFilter: 116 - Chain processed normally
21:32:09,155 DEBUG urity.web.context.SecurityContextPersistenceFilter: 105 - SecurityContextHolder now cleared, as request processing completed
21:32:09,155 DEBUG work.orm.jpa.support.OpenEntityManagerInViewFilter: 186 - Closing JPA EntityManager in OpenEntityManagerInViewFilter
21:32:09,156 DEBUG .springframework.orm.jpa.EntityManagerFactoryUtils: 432 - Closing JPA EntityManager
这是我的请求 header :
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:JSESSIONID=BLABLABLABLA; subscriptionType=PREMIUM; userType=ROLE_ADMIN
DNT:1
Host:localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/restaurantui/
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
最佳答案
Spring 将点之后的部分视为文件后缀,以尝试确定您真正想要的响应类型。 Here是一篇不错的关于 Spring 内容协商的文章。
所以发生的情况是 Spring 试图将结果呈现为它无法找到转换器的内容类型。
要解决这个问题,你需要告诉 spring 关闭基于后缀的内容协商:
@Configuration
public class ContentNegotiationConfig extends WebMvcConfigurerAdapter {
@Override
void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {
// Turn off suffix-based content negotiation
configurer.favorPathExtension(false);
}
}
更新:
我已经挖得更深了,我想我可以解释发生了什么。
默认配置忽略未知路径后缀,所以要解释这一点,我们需要知道 Spring 如何确定路径后缀是未知的,归结为 PathExtensionContentNegotiationStrategy
中的这段代码:
@Override
protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
throws HttpMediaTypeNotAcceptableException {
if (this.useJaf) {
MediaType jafMediaType = JafMediaTypeFactory.getMediaType("file." + extension);
if (jafMediaType != null && !MediaType.APPLICATION_OCTET_STREAM.equals(jafMediaType)) {
return jafMediaType;
}
}
if (!this.ignoreUnknownExtensions) {
throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes());
}
return null;
}
所以发生的情况很可能是 Java 激活框架正在识别您的一些后缀并为它们返回一个媒体类型 - .c 扩展可能返回 text/x-c因为这会导致异常。
关于java - Spring 抛出 HttpMediaTypeNotAcceptableException : Could not find acceptable representation due to dot in url path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30793717/
我有一个 Python 字典 dict。想象一下这个简单的例子。字典: bin1:{apple,apple,cherry,cherry,cherry,banana,banana,avocado} bi
我在Google上搜索了规范表示的含义,然后发现文件太含糊了。谁能提供规范表示的快速解释,以及网站中典型表示攻击的一些典型漏洞是什么? 最佳答案 规范化是您接受输入(例如文件名或字符串)并将其转换为标
本文整理了Java中org.restlet.representation.WriterRepresentation类的一些代码示例,展示了WriterRepresentation类的具体用法。这些代码
这个问题已经有答案了: How to convert number to words in java (32 个回答) 已关闭10 年前。 我有一个列表 Integer从 1 到 100。如果我循环遍
我正在使用 Coin-or Linear Programming图书馆。我想构建一个 ClpPlusMinusOneMatrix .它的构造函数是: ClpPlusMinusOneMatrix (in
免责声明:我完全知道表示日期/时间的最佳方式是 Unix 时间戳或 PHP 的 DateTime 类和 Oracle 的DATE 数据类型。 顺便说一句,我想知道最适合存储时间 数据的数据类型是什么(
我已经编写了我的代码,但就我个人所知,我想知道如何对其进行建模。 我们开始吧:一个用户可以拥有多个配置文件,每个配置文件都与一个且唯一的应用程序相关联。配置文件定义了用户在应用程序中的权限:同一用户可
我想了解 Representable 的含义在 Haskell 中代表。定义 Representable endofunctors over the category of Haskell types
如何构建一个 API,其中相同的数据可以以不同的格式(RESTful 格式)请求。例如。 GET /person/ //get the details of resource 现在,根据客户端(浏
这是这个问题的更具体的变体:Mutate only focus of Store Comonad? ,这样做的好处是不要一次提出多个问题。 是否有兼容 Control.Lens 的镜头它允许我与 co
我一直在为 iOS 开发一个日历应用程序,这让我遇到了很多问题。 我正在使用本地通知进行提醒。存储事件日期、警报日期或其他内容的最佳方式是什么?我的意思是,问题是由时区差异等引起的。我将事件存储在核心
我正在构建一个网络 CMS,用户可以在其中为某些网站元素选择颜色。我想将所有颜色值转换为十六进制以避免任何进一步的格式化麻烦(“rgb(x,y,z)”或命名颜色)。我为此找到了一个很好的 JS 库。
我有像这个例子这样的简单代码: int main() { double i_3 = 4.1; // 8 bytes return 0; } 让我们用 -S 选项编译这个示例: g++ -S -
我正在尝试执行 POST 操作: 我的 Controller 是: @RestController @RequestMapping({"/contacts"}) public class Contac
我需要一个数据表,以便在由一些生成的数据增强的 WPF 数据网格中显示数据。但我还需要将数据从数据库加载到本地 C# 对象,因为表示数据的类会进行很多计算。 那什么更好呢?仅依赖于数据表?或者对象和数
我正在开发一个 Java Spring Boot 应用程序,我使用的是版本 2.1.5 RELEASE。就我而言,我还使用 DozerBeanMapper (5.4.0) 和 Lombok 以防万一这
我正在使用 Postgresql 和 PHP 5.3.x with PDO 来访问数据库。 我有这个 SQL 查询(精简版),需要填写一个 PDO 占位符: INSERT INTO t_article
根据 C11 WG14 draft version N1570 : The header declares several functions useful for classifying and
我正在构建一个网络 CMS,用户可以在其中为某些网站元素选择颜色。我想将所有颜色值转换为十六进制以避免任何进一步的格式化麻烦(“rgb(x,y,z)”或命名颜色)。我为此找到了一个很好的 JS 库。
在golang中,如何将字符串转换为二进制字符串?示例:'CC' 变为 10000111000011 最佳答案 这是一个简单的方法: func stringToBin(s string) (binSt
我是一名优秀的程序员,十分优秀!