示例#1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private javax.ws.rs.core.Response batchProcessAndStream(final javax.ws.rs.core.UriInfo uriInfo, final javax.ws.rs.core.HttpHeaders httpHeaders, final javax.servlet.http.HttpServletRequest req, final java.io.InputStream body)
        private Response BatchProcessAndStream(UriInfo uriInfo, HttpHeaders httpHeaders, HttpServletRequest req, Stream body)
        {
            try
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.ws.rs.core.StreamingOutput stream = output ->
                StreamingOutput stream = _output =>
                {
                    try
                    {
                        ServletOutputStream servletOutputStream = new ServletOutputStreamAnonymousInnerClass(this);
                        (new StreamingBatchOperations(_webServer)).readAndExecuteOperations(uriInfo, httpHeaders, req, body, servletOutputStream);
                        _representationWriteHandler.onRepresentationWritten();
                    }
                    catch (Exception e)
                    {
                        _logger.warn("Error executing batch request ", e);
                    }
                    finally
                    {
                        _representationWriteHandler.onRepresentationFinal();
                    }
                };
                return(Response.ok(stream).type(HttpHeaderUtils.mediaTypeWithCharsetUtf8(MediaType.APPLICATION_JSON_TYPE)).build());
            }
            catch (Exception e)
            {
                return(_output.serverError(e));
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @POST @Path(PATH_GRAPHDB_EXTENSION_METHOD) public javax.ws.rs.core.Response invokeGraphDatabaseExtension(@PathParam("name") String name, @PathParam("method") String method, String data)
        public virtual Response InvokeGraphDatabaseExtension(string name, string method, string data)
        {
            try
            {
                return(_output.ok(this.InvokeGraphDatabaseExtension(name, method, _input.readParameterList(data))));
            }
            catch (BadInputException e)
            {
                return(_output.badRequest(e));
            }
            catch (PluginLookupException e)
            {
                return(_output.notFound(e));
            }
            catch (BadPluginInvocationException e)
            {
                return(_output.badRequest(e.InnerException));
            }
            catch (SyntaxException e)
            {
                return(_output.badRequest(e.InnerException));
            }
            catch (PluginInvocationFailureException e)
            {
                return(_output.serverError(e.InnerException));
            }
            catch (Exception e)
            {
                return(_output.serverError(e));
            }
        }