{"id":16689597,"url":"https://github.com/sigpwned/httpmodel","last_synced_at":"2025-12-30T00:05:40.863Z","repository":{"id":63250966,"uuid":"492908696","full_name":"sigpwned/httpmodel","owner":"sigpwned","description":"A library-agnostic HTTP library for library-agnostic HTTP operations for Java 8+","archived":false,"fork":false,"pushed_at":"2024-04-01T06:10:24.000Z","size":293,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-20T14:53:17.844Z","etag":null,"topics":["http","http-client","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigpwned.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-16T16:09:00.000Z","updated_at":"2024-07-27T03:09:10.000Z","dependencies_parsed_at":"2024-11-19T12:05:35.343Z","dependency_job_id":"b2747c03-f9f8-4012-8105-047f97cbce15","html_url":"https://github.com/sigpwned/httpmodel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fhttpmodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fhttpmodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fhttpmodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fhttpmodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigpwned","download_url":"https://codeload.github.com/sigpwned/httpmodel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243467024,"owners_count":20295309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-client","java"],"created_at":"2024-10-12T15:48:42.994Z","updated_at":"2025-12-30T00:05:40.817Z","avatar_url":"https://github.com/sigpwned.png","language":"Java","readme":"# HTTPMODEL [![tests](https://github.com/sigpwned/httpmodel/actions/workflows/tests.yml/badge.svg)](https://github.com/sigpwned/httpmodel/actions/workflows/tests.yml) [![Maven Central](https://img.shields.io/maven-central/v/com.sigpwned/httpmodel)](https://search.maven.org/artifact/com.sigpwned/httpmodel)\n\n## Motivation\n\nMany HTTP operations, like signing requests, are library agnostic. Implementing these operations against multiple libraries is wasteful. The httpmodel library is designed to allow library writers to build library-agnostic models once, and then simply allow users to convert their models back and forth between the httpmodel object model.\n\nThe httpmodel library also offers a client SPI with interchangeable transport backends for those who prefer to do work using the model itself.\n\n## Goals\n\n* Define a library-agnostic model of HTTP primitive objects, like requests, headers, etc.\n* Provide conversion routines between the model and the most popular HTTP client and server libraries\n* Expose a simple HTTP client to use the model directly\n\n## Non-Goals\n\n* Build a new HTTP implementation\n* Support all HTTP libraries\n\n## Conversion Examples\n\n### Servlets\n\nUsers can convert back and forth between servlet objects like this:\n\n    public ModelHttpRequest convertToHttpModel(HttpServletRequest request) {\n        return ModelHttpServlets.fromRequest(request);\n    }\n\n    public HttpServletResponse populateServletResponse(HttpModelResponse response, HttpServletResponse s) {\n        return ModelHttpServlets.toResponse(s, response);\n    }\n\nThis requires the `httpmodel-servlet` module.\n\n### Java 11 Client\n\nUsers can convert back and forth between Java 11 `HttpClient` objects like this:\n\n    public HttpRequest\u003cbyte[]\u003e convertToHttpRequest(ModelHttpRequest request) {\n        return ModelHttpClients.toRequest(request);\n    }\n\n    public ModelHttpResponse convertFromHttpResponse(HttpResponse\u003cbyte[]\u003e response) {\n        return ModelHttpClients.fromResponse(response);\n    }\n\nThis requires the `httpmodel-core` module.\n\n### HttpURLConnection\n\nUsers can convert back and forth between `HttpURLConnection` objects like this:\n\n    public HttpURLConnection convertToHttpURLConnection(ModelHttpRequest request) {\n        return ModelHttpURLConnections.toRequest(request);\n    }\n\n    public ModelHttpResponse convertFromHttpURLConnection(HttpURLConnection connection) {\n        return ModelHttpURLConnections.fromResponse(connection);\n    }\n\nThis requires the `httpmodel-core` module.\n\n## HTTP Client Examples\n\nTo grab a copy of the Yahoo! frontpage, use this code:\n\n    try (ModelHttpClient client=new DefaultModelHttpClient(new UrlConnectionModelHttpConnector())) {\n        try (ModelHttpResponse response=client.send(ModelHttpRequest.builder()\n                .method(ModelHttpMethods.GET)\n                .url(URI.create(\"https://www.yahoo.com/\"))\n                .build())) {\n            System.out.println(response.getStatusCode());\n            System.out.println(response.toString(StandardCharsets.UTF_8));\n        }\n    }\n\nThis requires the `httpmodel-client` module.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigpwned%2Fhttpmodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigpwned%2Fhttpmodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigpwned%2Fhttpmodel/lists"}