/** * Creates a {@link GeoServerRequestMatcher} object for the specified {@link RequestFilterChain} * * @param chain */ public GeoServerRequestMatcher matcherForChain(RequestFilterChain chain) { Set<HTTPMethod> methods = chain.getHttpMethods(); if (chain.isMatchHTTPMethod() == false) methods = null; List<String> tmp = chain.getPatterns(); if (tmp == null) return new GeoServerRequestMatcher(methods, (RequestMatcher[]) null); // resolve multiple patterns separated by a comma List<String> patterns = new ArrayList<String>(); for (String pattern : tmp) { String[] array = pattern.split(","); for (String singlePattern : array) patterns.add(singlePattern); } RequestMatcher[] matchers = new RequestMatcher[patterns.size()]; for (int i = 0; i < matchers.length; i++) { matchers[i] = new IncludeQueryStringAntPathRequestMatcher(patterns.get(i)); } return new GeoServerRequestMatcher(methods, matchers); }
requestChain.getHttpMethods().add(HTTPMethod.fromString(method));
writer.addAttribute( "matchHTTPMethod", Boolean.toString(requestChain.isMatchHTTPMethod())); if (requestChain.getHttpMethods() != null && requestChain.getHttpMethods().size() > 0) { writer.addAttribute( "httpMethods", StringUtils.collectionToCommaDelimitedString( requestChain.getHttpMethods()));
public Set<HTTPMethod> getHttpMethods() { return chain.getHttpMethods(); } public void setHttpMethods(Set<HTTPMethod> httpMethods) {
public void setOPTIONS(boolean oPTIONS) { if (oPTIONS) chain.getHttpMethods().add(HTTPMethod.OPTIONS); else chain.getHttpMethods().remove(HTTPMethod.OPTIONS); } public boolean isTRACE() {
public void setHEAD(boolean hEAD) { if (hEAD) chain.getHttpMethods().add(HTTPMethod.HEAD); else chain.getHttpMethods().remove(HTTPMethod.HEAD); }
public boolean isPUT() { return chain.getHttpMethods().contains(HTTPMethod.PUT); }
public boolean isPOST() { return chain.getHttpMethods().contains(HTTPMethod.POST); }
public void setDELETE(boolean dELETE) { if (dELETE) chain.getHttpMethods().add(HTTPMethod.DELETE); else chain.getHttpMethods().remove(HTTPMethod.DELETE); }
public void setDELETE(boolean dELETE) { if (dELETE) chain.getHttpMethods().add(HTTPMethod.DELETE); else chain.getHttpMethods().remove(HTTPMethod.DELETE); } public boolean isPOST() {
public void setPOST(boolean pOST) { if (pOST) chain.getHttpMethods().add(HTTPMethod.POST); else chain.getHttpMethods().remove(HTTPMethod.POST); } public boolean isOPTIONS() {
public void setTRACE(boolean tRACE) { if (tRACE) chain.getHttpMethods().add(HTTPMethod.TRACE); else chain.getHttpMethods().remove(HTTPMethod.TRACE); } public boolean isHEAD() {
public boolean isDELETE() { return chain.getHttpMethods().contains(HTTPMethod.DELETE); } public void setDELETE(boolean dELETE) {
public boolean isOPTIONS() { return chain.getHttpMethods().contains(HTTPMethod.OPTIONS); } public void setOPTIONS(boolean oPTIONS) {
public boolean isTRACE() { return chain.getHttpMethods().contains(HTTPMethod.TRACE); } public void setTRACE(boolean tRACE) {
public void setOPTIONS(boolean oPTIONS) { if (oPTIONS) chain.getHttpMethods().add(HTTPMethod.OPTIONS); else chain.getHttpMethods().remove(HTTPMethod.OPTIONS); }
public void setPUT(boolean pUT) { if (pUT) chain.getHttpMethods().add(HTTPMethod.PUT); else chain.getHttpMethods().remove(HTTPMethod.PUT); } public boolean isDELETE() {
@Override public Object getPropertyValue(RequestFilterChain item) { return StringUtils.collectionToCommaDelimitedString(item.getHttpMethods()); } };
public String getHttpMethodString() { if (chain.isMatchHTTPMethod()) return StringUtils.collectionToCommaDelimitedString(chain.getHttpMethods()); else return "*"; }
public String getHttpMethodString() { if (chain.isMatchHTTPMethod()) return StringUtils.collectionToCommaDelimitedString(chain.getHttpMethods()); else return "*"; }