List of usage examples for io.netty.handler.codec.http HttpMethod GET
HttpMethod GET
To view the source code for io.netty.handler.codec.http HttpMethod GET.
Click Source Link
From source file:org.ballerinalang.net.grpc.MessageUtils.java
License:Open Source License
public static HttpCarbonMessage createHttpCarbonMessage(boolean isRequest) { HttpCarbonMessage httpCarbonMessage; if (isRequest) { httpCarbonMessage = new HttpCarbonMessage( new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "")); } else {/*from w ww. j a va 2 s . com*/ httpCarbonMessage = new HttpCarbonMessage( new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)); } return httpCarbonMessage; }
From source file:org.ballerinalang.net.http.HttpUtil.java
License:Open Source License
public static HTTPCarbonMessage createHttpCarbonMessage(boolean isRequest) { HTTPCarbonMessage httpCarbonMessage; if (isRequest) { httpCarbonMessage = new HTTPCarbonMessage( new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "")); httpCarbonMessage.setEndOfMsgAdded(true); } else {/* ww w . ja v a2 s. c om*/ httpCarbonMessage = new HTTPCarbonMessage( new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)); httpCarbonMessage.setEndOfMsgAdded(true); } return httpCarbonMessage; }
From source file:org.ballerinalang.stdlib.utils.HTTPTestRequest.java
License:Open Source License
public HTTPTestRequest() { super(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "")); testHttpResponseStatusFuture = new TestHttpResponseStatusFuture(); }
From source file:org.ballerinalang.test.agent.server.WebServer.java
License:Open Source License
/** * Adds a GET route.// ww w .j av a 2 s . co m * * @param path The URL path. * @param handler The request handler. * @return This WebServer. */ public WebServer get(final String path, final BHandler handler) { this.routeTable.addRoute(new Route(HttpMethod.GET, path, handler)); return this; }
From source file:org.ballerinalang.test.services.testutils.HTTPTestRequest.java
License:Open Source License
public HTTPTestRequest() { super(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "")); }
From source file:org.ballerinalang.test.util.client.HttpClient.java
License:Open Source License
/** * Get a full http request./* w w w. j a v a 2 s .c om*/ * * @param path Represents request path * @param requestId A header value to identify the request * @return A full http request */ private FullHttpRequest getFullHttpRequest(String path, String requestId) { FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); request.headers().set(HttpHeaderNames.HOST, host + ":" + port); request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); request.headers().set("message-id", requestId); return request; }
From source file:org.bridje.http.impl.HttpBridletRequestImpl.java
License:Apache License
@Override public boolean isGet() { return getMethod().equals(HttpMethod.GET.name()); }
From source file:org.caratarse.auth.services.controller.UserAuthorizationController.java
License:Apache License
public UserAuthorization addAuthorizationToUser(Request request, Response response) { String userUuid = request.getHeader(Constants.Url.USER_UUID, "No User UUID supplied"); String authorizationName = request.getHeader(Constants.Url.AUTHORIZATION_NAME, "No Authorization Name supplied"); UserAuthorization userAuthorizationPermissions = request.getBodyAs(UserAuthorization.class, "UserAuthorization with permissions details not provided"); validateAndThrow(userUuid, authorizationName); UserAuthorization userAuthorization = userAuthorizationBo.addAuthorizationToUser(userUuid, authorizationName, userAuthorizationPermissions.getPermissions()); // Construct the response for create... response.setResponseCreated();//from w ww.j a va 2 s . co m TokenResolver resolver = HyperExpress.bind(Constants.Url.USER_UUID, userUuid) .bind(Constants.Url.AUTHORIZATION_NAME, authorizationName); // Include the Location header... String locationPattern = request.getNamedUrl(HttpMethod.GET, Constants.Routes.USER_READ_ROUTE); response.addLocationHeader(LOCATION_BUILDER.build(locationPattern, resolver)); // Return the newly-created item... return userAuthorization; }
From source file:org.caratarse.auth.services.controller.UserController.java
License:Apache License
public User create(Request request, Response response) { User user = request.getBodyAs(User.class, "User details not provided"); ValidationEngine.validateAndThrow(user); userBo.store(user);// ww w . j av a 2 s . co m // Construct the response for create... response.setResponseCreated(); TokenResolver resolver = HyperExpress.bind(Constants.Url.USER_UUID, user.getUuid()); // Include the Location header... String locationPattern = request.getNamedUrl(HttpMethod.GET, Constants.Routes.USER_READ_ROUTE); response.addLocationHeader(LOCATION_BUILDER.build(locationPattern, resolver)); // Return the newly-created item... return user; }
From source file:org.caratarse.auth.services.Routes.java
License:Apache License
public static void define(Configuration config, RestExpress server) { //TODO: Your routes here... server.uri("/populates.{format}", config.getPopulateController()).action("readAll", HttpMethod.GET) .action("deleteAll", HttpMethod.DELETE).name(Constants.Routes.POPULATE_COLLECTION); server.uri("/users/{userUuid}.{format}", config.getUserController()) .method(HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE).name(Constants.Routes.USER_READ_ROUTE); server.uri("/users.{format}", config.getUserController()).action("readAll", HttpMethod.GET) .method(HttpMethod.POST).name(Constants.Routes.USER_COLLECTION_READ_ROUTE); server.uri("/users/{userUuid}/authorizations.{format}", config.getUserAuthorizationController()) .action("readAll", HttpMethod.GET).name(Constants.Routes.USER_AUTHORIZATIONS_ROUTE); server.uri("/users/{userUuid}/authorizations/{authorizationName}.{format}", config.getUserAuthorizationController()).method(HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE) .action("addAuthorizationToUser", HttpMethod.POST).name(Constants.Routes.USER_AUTHORIZATION_ROUTE); //// or...// w w w . ja v a 2s . c om // server.regex("/some.regex", config.getRouteController()); }