http-endec

Http encoder/decoder for Java/Android

License

License

GroupId

GroupId

fr.bmartel
ArtifactId

ArtifactId

http-endec
Last Version

Last Version

1.04
Release Date

Release Date

Type

Type

jar
Description

Description

http-endec
Http encoder/decoder for Java/Android
Project URL

Project URL

https://github.com/bertrandmartel/http-endec
Source Code Management

Source Code Management

https://github.com/bertrandmartel/http-endec

Download http-endec

How to add to project

<!-- https://jarcasting.com/artifacts/fr.bmartel/http-endec/ -->
<dependency>
    <groupId>fr.bmartel</groupId>
    <artifactId>http-endec</artifactId>
    <version>1.04</version>
</dependency>
// https://jarcasting.com/artifacts/fr.bmartel/http-endec/
implementation 'fr.bmartel:http-endec:1.04'
// https://jarcasting.com/artifacts/fr.bmartel/http-endec/
implementation ("fr.bmartel:http-endec:1.04")
'fr.bmartel:http-endec:jar:1.04'
<dependency org="fr.bmartel" name="http-endec" rev="1.04">
  <artifact name="http-endec" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.bmartel', module='http-endec', version='1.04')
)
libraryDependencies += "fr.bmartel" % "http-endec" % "1.04"
[fr.bmartel/http-endec "1.04"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

http-endec

Build Status Download Maven Central Coverage Status License

Http encoder/decoder for Java/Android


  • This endec works with streaming data in a socket-blocking configuration.
  • It will block until the whole current HTTP frame is totally parsed.

Include in your project

  • with Gradle, from jcenter :
compile 'fr.bmartel:http-endec:1.03'

How to use ?

Build HTTP request

HttpFrame frameRequest = new HttpFrame(
							HttpMethod.POST_REQUEST      ,
							new HttpVersion(1, 1)        ,
							new HashMap<String, String>(),
							"/rest/help/todo"            ,
							new ListOfBytes("some body")
						);

Build HTTP response

HttpResponseFrame frameResponse = new HttpResponseFrame(
										new StatusCodeObject(200, "OK"),
										new HttpVersion(1, 1),
										new HashMap<String, String>(),
										""
									);

Parse HTTP inputstream

HttpFrame newFrame = new HttpFrame();

newFrame.parseHttp(inputstream);

You can access your result in sub methods :

Method Type description
getUri() String http uri
getHttpVersion() HttpVersion http version
getMethod() String http code
getQueryString() String http query string
getHost() String host
getBody() IByteList body content

Change your buffer size

In fr.bmartel.protocol.socket.DataBufferConst

Change the value :

public final static int DATA_BLOCK_SIZE_LIMIT = 4089;

JavaDoc

http://bertrandmartel.github.io/http-endec

Compatibility

JRE 1.7 compliant

Build

Gradle using IntelliJ IDEA or Eclipse

Specifications

Specification from RFC specified in https://www.ietf.org/rfc/rfc2616.txt

License

The MIT License (MIT) Copyright (c) 2016 Bertrand Martel

Versions

Version
1.04
1.03