标签:
@Provider public class FormDataFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { if (requestContext instanceof ContainerRequest) { ContainerRequest request = (ContainerRequest) requestContext; if ( requestContext.hasEntity() && MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE,request.getMediaType())) { request.bufferEntity(); Form f = request.readEntity(Form.class); } } } }
目前找到的最好的答案。
之后就很简单了。
value = f.asMap().get("key").get(0)
jersey 中filter使用ContainerRequestContext接受form参数
标签:
原文地址:http://www.cnblogs.com/-Doraemon/p/4947160.html