Esempio n. 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));
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @GET @Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON) public javax.ws.rs.core.Response getRelationshipTypes(@QueryParam("in_use") @DefaultValue("true") boolean inUse)
        public virtual Response GetRelationshipTypes(bool inUse)
        {
            try
            {
                GraphDatabaseAPI db = _database.Graph;
                IEnumerable <RelationshipType> relationshipTypes = inUse ? Db.AllRelationshipTypesInUse : Db.AllRelationshipTypes;
                return(Response.ok().type(MediaType.APPLICATION_JSON).entity(GenerateJsonRepresentation(relationshipTypes)).build());
            }
            finally
            {
                _representationWriteHandler.onRepresentationFinal();
            }
        }
Esempio n. 3
0
 public virtual Response NotFound()
 {
     _representationWriteHandler.onRepresentationFinal();
     return(Response.status(Response.Status.NOT_FOUND).build());
 }