org.apache.http.MethodNotSupportedException Java Examples
The following examples show how to use
org.apache.http.MethodNotSupportedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Context.java From v20-java with MIT License | 6 votes |
private HttpUriRequest newHttpRequest(String method, URI uri) throws MethodNotSupportedException { if (method == "GET") return new HttpGet(uri); if (method == "POST") return new HttpPost(uri); if (method == "PUT") return new HttpPut(uri); if (method == "DELETE") return new HttpDelete(uri); if (method == "PATCH") return new HttpPatch(uri); throw new MethodNotSupportedException( "Invalid method \"" + method + "\"" ); }
Example #2
Source File: ModInternationalization.java From spydroid-ipcamera with GNU General Public License v3.0 | 6 votes |
public void handle( final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException { final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH); if (!method.equals("GET") && !method.equals("HEAD")) { throw new MethodNotSupportedException(method + " method not supported"); } final EntityTemplate body = new EntityTemplate(new ContentProducer() { public void writeTo(final OutputStream outstream) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8"); writer.write(mJSON); writer.flush(); } }); response.setStatusCode(HttpStatus.SC_OK); body.setContentType("text/json; charset=UTF-8"); response.setEntity(body); }
Example #3
Source File: UpnpHttpRequestFactory.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public HttpRequest newHttpRequest(final String method, final String uri) throws MethodNotSupportedException { if (isOneOf(BASIC, method)) { return new BasicHttpRequest(method, uri); } else if (isOneOf(WITH_ENTITY, method)) { return new BasicHttpEntityEnclosingRequest(method, uri); } else { return super.newHttpRequest(method, uri); } }
Example #4
Source File: StreamClientImpl.java From openhab1-addons with Eclipse Public License 2.0 | 5 votes |
protected HttpUriRequest createHttpRequest(UpnpMessage upnpMessage, UpnpRequest upnpRequestOperation) throws MethodNotSupportedException { switch (upnpRequestOperation.getMethod()) { case GET: return new HttpGet(upnpRequestOperation.getURI()); case SUBSCRIBE: return new HttpGet(upnpRequestOperation.getURI()) { @Override public String getMethod() { return UpnpRequest.Method.SUBSCRIBE.getHttpName(); } }; case UNSUBSCRIBE: return new HttpGet(upnpRequestOperation.getURI()) { @Override public String getMethod() { return UpnpRequest.Method.UNSUBSCRIBE.getHttpName(); } }; case POST: HttpEntityEnclosingRequest post = new HttpPost(upnpRequestOperation.getURI()); post.setEntity(createHttpRequestEntity(upnpMessage)); return (HttpUriRequest) post; // Fantastic API case NOTIFY: HttpEntityEnclosingRequest notify = new HttpPost(upnpRequestOperation.getURI()) { @Override public String getMethod() { return UpnpRequest.Method.NOTIFY.getHttpName(); } }; notify.setEntity(createHttpRequestEntity(upnpMessage)); return (HttpUriRequest) notify; // Fantastic API default: throw new MethodNotSupportedException(upnpRequestOperation.getHttpMethodName()); } }
Example #5
Source File: DispatchRequestFactory.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public HttpRequest newHttpRequest(RequestLine requestLine) throws MethodNotSupportedException { String method = requestLine.getMethod(); String uri = requestLine.getUri(); return this.newHttpRequest(method, uri); }
Example #6
Source File: NewGridFeature.java From geoar-app with Apache License 2.0 | 5 votes |
@Override public void setColor(float[] colorArray) { try { throw new MethodNotSupportedException( "Setting Color array is not supported atm"); } catch (MethodNotSupportedException e) { // Lol... LOG.debug("setColor array is not supported atm"); e.printStackTrace(); } }
Example #7
Source File: LocalWebServerHttpRequestHandler.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { try { String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH); if (METHOD_GET.equals(method) || METHOD_HEAD.equals(method)) { handleRequest(request, response, METHOD_HEAD.equals(method)); } else if (METHOD_POST.equals(method)) { handleRequest(request, response, METHOD_HEAD.equals(method)); } else { throw new MethodNotSupportedException(MessageFormat.format( Messages.LocalWebServerHttpRequestHandler_UNSUPPORTED_METHOD, method)); } } catch (Exception e) { IdeLog.logError(WebServerCorePlugin.getDefault(), e); response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); response.setEntity(createTextEntity(Messages.LocalWebServerHttpRequestHandler_INTERNAL_SERVER_ERROR)); } }
Example #8
Source File: UpnpHttpRequestFactory.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public HttpRequest newHttpRequest(final String method, final String uri) throws MethodNotSupportedException { if (isOneOf(BASIC, method)) { return new BasicHttpRequest(method, uri); } else if (isOneOf(WITH_ENTITY, method)) { return new BasicHttpEntityEnclosingRequest(method, uri); } else { return super.newHttpRequest(method, uri); } }
Example #9
Source File: UpnpHttpRequestFactory.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public HttpRequest newHttpRequest(final RequestLine requestline) throws MethodNotSupportedException { if (requestline == null) { throw new IllegalArgumentException("Request line may not be null"); } String method = requestline.getMethod(); String uri = requestline.getUri(); return newHttpRequest(method, uri); }
Example #10
Source File: UpnpHttpRequestFactory.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public HttpRequest newHttpRequest(final RequestLine requestline) throws MethodNotSupportedException { if (requestline == null) { throw new IllegalArgumentException("Request line may not be null"); } String method = requestline.getMethod(); String uri = requestline.getUri(); return newHttpRequest(method, uri); }
Example #11
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public void clear() { throw new RuntimeException(new MethodNotSupportedException("clear")); }
Example #12
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public boolean dependsOn(Graph arg0) { throw new RuntimeException(new MethodNotSupportedException("dependsOn")); }
Example #13
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public BulkUpdateHandler getBulkUpdateHandler() { throw new RuntimeException(new MethodNotSupportedException("getBulUpdate")); }
Example #14
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public GraphStatisticsHandler getStatisticsHandler() { throw new RuntimeException(new MethodNotSupportedException("getStatsHandler")); }
Example #15
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public TransactionHandler getTransactionHandler() { throw new RuntimeException(new MethodNotSupportedException("getTransactionHandler")); }
Example #16
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public boolean isIsomorphicWith(Graph arg0) { throw new RuntimeException(new MethodNotSupportedException("isIsomorphic")); }
Example #17
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public void remove(Node arg0, Node arg1, Node arg2) { throw new RuntimeException(new MethodNotSupportedException("remove")); }
Example #18
Source File: NeoGraph.java From neo4jena with Apache License 2.0 | 4 votes |
@Override public int size() { throw new RuntimeException(new MethodNotSupportedException("size")); }
Example #19
Source File: HttpRequestBuilder.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
public HttpRequest newHttpRequest(RequestLine requestLine) throws MethodNotSupportedException { String method = requestLine.getMethod(); String uri = requestLine.getUri(); return newHttpRequest(method, uri); }