Skip to content

Commit 0caea39

Browse files
authored
Update Java Worker (#3142)
1 parent b8273ee commit 0caea39

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

sample/HttpTrigger-Java/Function.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
*/
1616
public class Function {
1717
/**
18-
* This function listens at endpoint "/api/hello". Two ways to invoke it using "curl" command in bash:
19-
* 1. curl -d "HTTP Body" {your host}/api/hello
18+
* This function listens at endpoint "/api/HttpTrigger-Java". Two ways to invoke it using "curl" command in bash:
19+
* 1. curl -d "HTTP Body" {your host}/api/HttpTrigger-Java
2020
* 2. curl {your host}/api/HttpTrigger-Java?name=HTTP%20Query
2121
*/
2222
@FunctionName("HttpTrigger-Java")
23-
public HttpResponseMessage<String> HttpTriggerJava(
24-
@HttpTrigger(name = "req", methods = {"get", "post"}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
23+
public HttpResponseMessage HttpTriggerJava(
24+
@HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
2525
final ExecutionContext context) {
2626
context.getLogger().info("Java HTTP trigger processed a request.");
2727

@@ -30,9 +30,9 @@ public HttpResponseMessage<String> HttpTriggerJava(
3030
String name = request.getBody().orElse(query);
3131

3232
if (name == null) {
33-
return request.createResponse(400, "Please pass a name on the query string or in the request body");
33+
return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
3434
} else {
35-
return request.createResponse(200, "Hello " + name);
35+
return request.createResponseBuilder(HttpStatus.OK).body("Hello, " + name).build();
3636
}
3737
}
3838
}
307 Bytes
Binary file not shown.

src/WebJobs.Script/WebJobs.Script.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<NoWarn>NU1701</NoWarn>
3232
</PackageReference>
3333
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.5350001-beta-fc119b98" />
34-
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.1.0-beta7" />
34+
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.1.0-beta8" />
3535
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="1.0.0-beta3" />
3636
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta7-11351" />
3737
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta7-10629" />

test/WebJobs.Script.Tests.Integration/WebJobs.Script.Tests.Integration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.0" />
2929
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="1.9.1" />
3030
<PackageReference Include="Microsoft.Azure.EventHubs" Version="1.0.3" />
31-
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.1.0-beta7" />
31+
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.1.0-beta8" />
3232
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="1.0.0-beta3" />
3333
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
3434
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="2.0.0" />

0 commit comments

Comments
 (0)