/** * Is the specified method allowed ? * * @param method The method to check. * @return true if the specified method is allowed. * @since 1.0 */ public boolean isAllowed(String method) { checkUsed(); return methodsAllowed.contains(method); }
/** * <p> * This implementation will parse the <tt>Allow</tt> header to obtain * the set of methods supported by the resource identified by the Request-URI. * </p> * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @see #readResponse * @see #readResponseHeaders * @since 2.0 */ protected void processResponseHeaders(HttpState state, HttpConnection conn) { LOG.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)"); Header allowHeader = getResponseHeader("allow"); if (allowHeader != null) { String allowHeaderValue = allowHeader.getValue(); StringTokenizer tokenizer = new StringTokenizer(allowHeaderValue, ","); while (tokenizer.hasMoreElements()) { String methodAllowed = tokenizer.nextToken().trim().toUpperCase(); methodsAllowed.addElement(methodAllowed); } } }
httpMethod = new DeleteMethod(); } else if (method == HttpMethod.OPTIONS) { httpMethod = new OptionsMethod(); } else if (method == HttpMethod.TRACE) { return new TraceMethod(uri.getEscapedURI());
public static Enumeration getAllowedMethods() { Enumeration e = new OptionsMethod().getAllowedMethods(); return e; }
Enumeration options = optionsMethod.getAllowedMethods(); if (options != null)
protected HttpMethod createOptionsMethod(MuleMessage message) throws Exception { URI uri = getURI(message); return new OptionsMethod(uri.toString()); }
public static Enumeration getAllowedMethods() { Enumeration e = new OptionsMethod().getAllowedMethods(); return e; }
Enumeration options = optionsMethod.getAllowedMethods(); if (options != null)
private HttpMethod resolveMethod(String method, String uri) throws AuthenticationException { if (method.equalsIgnoreCase("get")) { return new GetMethod(uri); } else if (method.equalsIgnoreCase("post")) { return new PostMethod(uri); } else if (method.equalsIgnoreCase("put")) { return new PutMethod(uri); } else if (method.equalsIgnoreCase("delete")) { return new DeleteMethod(uri); } else if (method.equalsIgnoreCase("head")) { return new HeadMethod(uri); } else if (method.equalsIgnoreCase("options")) { return new OptionsMethod(uri); } else { // throw new AuthenticationException("unsupported http method : " + method); return new MethodHelper.ExtensionMethod(method, uri); } }
/** * Get a list of allowed methods. * @return An enumeration of all the allowed methods. * * @since 1.0 */ public Enumeration getAllowedMethods() { checkUsed(); return methodsAllowed.elements(); }
/** * <p> * This implementation will parse the <tt>Allow</tt> header to obtain * the set of methods supported by the resource identified by the Request-URI. * </p> * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @see #readResponse * @see #readResponseHeaders * @since 2.0 */ protected void processResponseHeaders(HttpState state, HttpConnection conn) { LOG.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)"); Header allowHeader = getResponseHeader("allow"); if (allowHeader != null) { String allowHeaderValue = allowHeader.getValue(); StringTokenizer tokenizer = new StringTokenizer(allowHeaderValue, ","); while (tokenizer.hasMoreElements()) { String methodAllowed = tokenizer.nextToken().trim().toUpperCase(); methodsAllowed.addElement(methodAllowed); } } }
private HttpMethod getHttpMethod(ClientRequest cr) { final String strMethod = cr.getMethod(); final String uri = cr.getURI().toString(); if (strMethod.equals("GET")) { return new GetMethod(uri); } else if (strMethod.equals("POST")) { return new PostMethod(uri); } else if (strMethod.equals("PUT")) { return new PutMethod(uri); } else if (strMethod.equals("DELETE")) { return new CustomMethod("DELETE", uri); } else if (strMethod.equals("HEAD")) { return new HeadMethod(uri); } else if (strMethod.equals("OPTIONS")) { return new OptionsMethod(uri); } else { return new CustomMethod(strMethod, uri); } }
/** * Is the specified method allowed ? * * @param method The method to check. * @return true if the specified method is allowed. * @since 1.0 */ public boolean isAllowed(String method) { checkUsed(); return methodsAllowed.contains(method); }
/** * <p> * This implementation will parse the <tt>Allow</tt> header to obtain * the set of methods supported by the resource identified by the Request-URI. * </p> * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @see #readResponse * @see #readResponseHeaders * @since 2.0 */ protected void processResponseHeaders(HttpState state, HttpConnection conn) { LOG.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)"); Header allowHeader = getResponseHeader("allow"); if (allowHeader != null) { String allowHeaderValue = allowHeader.getValue(); StringTokenizer tokenizer = new StringTokenizer(allowHeaderValue, ","); while (tokenizer.hasMoreElements()) { String methodAllowed = tokenizer.nextToken().trim().toUpperCase(); methodsAllowed.addElement(methodAllowed); } } }
public static HttpMethodBase createMethod(URL url, int type) { HttpMethodBase request = null; switch( type ) { case GET: request = new GetMethod(url.toString()); break; case POST: request = new PostMethod(url.toString()); break; case HEAD: request = new HeadMethod(url.toString()); break; case OPTIONS: request = new OptionsMethod(url.toString()); break; case PUT: request = new PutMethod(url.toString()); break; case DELETE: request = new DeleteMethod(url.toString()); break; case TRACE: request = new TraceMethod(url.toString()); break; } return request; } }
/** * Is the specified method allowed ? * * @param method The method to check. * @return true if the specified method is allowed. * @since 1.0 */ public boolean isAllowed(String method) { checkUsed(); return methodsAllowed.contains(method); }
/** * <p> * This implementation will parse the <tt>Allow</tt> header to obtain * the set of methods supported by the resource identified by the Request-URI. * </p> * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @see #readResponse * @see #readResponseHeaders * @since 2.0 */ protected void processResponseHeaders(HttpState state, HttpConnection conn) { LOG.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)"); Header allowHeader = getResponseHeader("allow"); if (allowHeader != null) { String allowHeaderValue = allowHeader.getValue(); StringTokenizer tokenizer = new StringTokenizer(allowHeaderValue, ","); while (tokenizer.hasMoreElements()) { String methodAllowed = tokenizer.nextToken().trim().toUpperCase(); methodsAllowed.addElement(methodAllowed); } } }
httpMethod = new TraceMethod(urlStr); } else if (method.equals(OPTIONS)) { httpMethod = new OptionsMethod(urlStr); } else if (method.equals(DELETE)) { httpMethod = new DeleteMethod(urlStr);
/** * Is the specified method allowed ? * * @param method The method to check. * @return true if the specified method is allowed. * @since 1.0 */ public boolean isAllowed(String method) { checkUsed(); return methodsAllowed.contains(method); }
/** * <p> * This implementation will parse the <tt>Allow</tt> header to obtain * the set of methods supported by the resource identified by the Request-URI. * </p> * * @param state the {@link HttpState state} information associated with this method * @param conn the {@link HttpConnection connection} used to execute * this HTTP method * * @see #readResponse * @see #readResponseHeaders * @since 2.0 */ protected void processResponseHeaders(HttpState state, HttpConnection conn) { LOG.trace("enter OptionsMethod.processResponseHeaders(HttpState, HttpConnection)"); Header allowHeader = getResponseHeader("allow"); if (allowHeader != null) { String allowHeaderValue = allowHeader.getValue(); StringTokenizer tokenizer = new StringTokenizer(allowHeaderValue, ","); while (tokenizer.hasMoreElements()) { String methodAllowed = tokenizer.nextToken().trim().toUpperCase(); methodsAllowed.addElement(methodAllowed); } } }