@Test(expected = InvalidParseOperationException.class) public void testHeaders() throws InvalidParseOperationException { final MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); final HttpHeaders headers = new HttpHeaders() { @Override public MultivaluedMap<String, String> getRequestHeaders() { return map; } @Override public List<String> getRequestHeader(String name) { return map.get(name); } @Override public MediaType getMediaType() { return null; } @Override public int getLength() { return 0; } @Override public Locale getLanguage() { return null; } @Override public String getHeaderString(String name) { return map.get(name).get(0); } @Override public Date getDate() { return null; } @Override public Map<String, Cookie> getCookies() { return null; } @Override public List<MediaType> getAcceptableMediaTypes() { return null; } @Override public List<Locale> getAcceptableLanguages() { return null; } }; map.add("test", "ok"); try { SanityChecker.checkHeaders(headers); } catch (final InvalidParseOperationException e) { fail("Should not raized an exception"); } final String bad = "aa<![CDATA[bb"; map.add("test", bad); SanityChecker.checkHeaders(headers); }
public static final void checkHeaders(final HttpHeaders headers) throws InvalidParseOperationException { if (headers == null) { return; } checkHeadersMap(headers.getRequestHeaders()); }
SanityChecker { public static final void checkHeaders(final HttpHeaders headers) throws InvalidParseOperationException { if (headers == null) { return; } checkHeadersMap(headers.getRequestHeaders()); } }
SanityChecker { public static final void checkHeaders(final HttpHeaders headers) throws InvalidParseOperationException { if (headers == null) { return; } checkHeadersMap(headers.getRequestHeaders()); } private  SanityChecker(); }
SanityChecker { public static final void checkHeaders(final HttpHeaders headers) throws InvalidParseOperationException { if (headers == null) { return; } checkHeadersMap(headers.getRequestHeaders()); } private  SanityChecker(); static boolean isValidFileName(String value); static final void checkXmlAll(File xmlFile); static final String sanitizeJson(JsonNode json); static final void checkJsonAll(JsonNode json); static final void checkJsonAll(String json); static final void checkParameter(String... params); static final void checkHTMLFile(File file); static final void checkHeaders(final HttpHeaders headers); static final void checkHeadersMap(MultivaluedMap<String, String> requestHeaders); static final void checkUriParametersMap(MultivaluedMap<String, String> uriParameters); static final long getLimitFileSize(); static final void setLimitFileSize(long limitFileSize); static final long getLimitJsonSize(); static final void setLimitJsonSize(long limitJsonSize); static final int getLimitFieldSize(); static final void setLimitFieldSize(int limitFieldSize); static final int getLimitParamSize(); static final void setLimitParamSize(int limitParamSize); }
SanityChecker { public static final void checkHeaders(final HttpHeaders headers) throws InvalidParseOperationException { if (headers == null) { return; } checkHeadersMap(headers.getRequestHeaders()); } private  SanityChecker(); static boolean isValidFileName(String value); static final void checkXmlAll(File xmlFile); static final String sanitizeJson(JsonNode json); static final void checkJsonAll(JsonNode json); static final void checkJsonAll(String json); static final void checkParameter(String... params); static final void checkHTMLFile(File file); static final void checkHeaders(final HttpHeaders headers); static final void checkHeadersMap(MultivaluedMap<String, String> requestHeaders); static final void checkUriParametersMap(MultivaluedMap<String, String> uriParameters); static final long getLimitFileSize(); static final void setLimitFileSize(long limitFileSize); static final long getLimitJsonSize(); static final void setLimitJsonSize(long limitJsonSize); static final int getLimitFieldSize(); static final void setLimitFieldSize(int limitFieldSize); static final int getLimitParamSize(); static final void setLimitParamSize(int limitParamSize); static final String HTTP_PARAMETER_VALUE; }