
io.higgs.http.server.HttpRequestDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-s3 Show documentation
Show all versions of http-s3 Show documentation
Higgs HTTP S3 (Single Site Server)
The newest version!
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.higgs.http.server;
import io.higgs.http.server.protocol.HttpProtocolConfiguration;
import io.netty.handler.codec.http.HttpMessage;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpVersion;
public class HttpRequestDecoder extends io.netty.handler.codec.http.HttpRequestDecoder {
protected final HttpProtocolConfiguration config;
public HttpRequestDecoder(HttpProtocolConfiguration config) {
this.config = config;
}
@Override
protected HttpMessage createMessage(String[] initialLine) throws Exception {
return new HttpRequest(HttpVersion.valueOf(initialLine[2])
, HttpMethod.valueOf(initialLine[0])
, initialLine[1]
, config);
}
@Override
protected HttpMessage createInvalidMessage() {
return new HttpRequest(HttpVersion.HTTP_1_0, HttpMethod.GET, "/bad-request", config);
}
}