org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam Java Examples

The following examples show how to use org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MicroProfileClientProxyImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Parameter createClientHeaderParameter(ClientHeaderParam anno, Class<?> clientIntf) {
    Parameter p = new Parameter(ParameterType.HEADER, anno.name());
    String[] values = anno.value();
    String headerValue;
    if (values[0] != null && values[0].length() > 2 && values[0].startsWith("{") && values[0].endsWith("}")) {
        try {
            headerValue = invokeBestFitComputeMethod(clientIntf, anno);
        } catch (Throwable t) {
            if (anno.required()) {
                throwException(t);
            }
            return null;
        }
    } else {
        headerValue = HttpUtils.getHeaderString(Arrays.asList(values));
    }

    p.setDefaultValue(headerValue);
    return p;
}
 
Example #2
Source File: HeadersOnMethodClient.java    From cxf with Apache License 2.0 5 votes vote down vote up
@ClientHeaderParam(name = "MethodHeader1", value = "valueA")
@ClientHeaderParam(name = "MethodHeader2", value = {"valueB", "valueC"})
@ClientHeaderParam(name = "MethodHeader3", value = "{computeHeader}")
@ClientHeaderParam(name = "MethodHeader4",
    value = "{org.apache.cxf.microprofile.client.mock.HeaderGenerator.generateHeader}")
@DELETE
@Path("/")
String delete(String someValue);
 
Example #3
Source File: Validator.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static void checkForInvalidClientHeaderParams(Class<?> userType, Method[] methods) {
    ClientHeaderParam[] interfaceAnnotations = userType.getAnnotationsByType(ClientHeaderParam.class);
    checkClientHeaderParamAnnotation(interfaceAnnotations, userType, methods);
    for (Method method : methods) {
        ClientHeaderParam[] methodAnnotations = method.getAnnotationsByType(ClientHeaderParam.class);
        checkClientHeaderParamAnnotation(methodAnnotations, userType, methods);
    }
}
 
Example #4
Source File: InvalidComputeMethodSignature.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name="TestHeader", value="{invalidMethod}")
@GET
Response get();
 
Example #5
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "SomeHeader", value = "{computeMethod}")
@GET
Response get();
 
Example #6
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "SomeHeader",
    value = "{org.apache.cxf.microprofile.client.mock.HeaderGenerator.generateHeaderPrivate}")
@GET
Response get();
 
Example #7
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "SomeHeader", value = "{nonExistentComputeMethod}")
@GET
Response get();
 
Example #8
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "SomeHeader", value = "{nonDefaultComputeMethod}")
@GET
Response get();
 
Example #9
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "SomeHeader", value = "{missingComputeMethod}")
@GET
Response get();
 
Example #10
Source File: ValidatorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "", value = "something")
@GET
Response get();
 
Example #11
Source File: HeadersFactoryClient.java    From cxf with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name = "MethodHeader1", value = "def")
@GET
@Path("/")
String get(@HeaderParam("HeaderParam1") String someValue);
 
Example #12
Source File: HeaderConsumingClient.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@POST
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
@ClientHeaderParam(name = "ClientHeaderParam", value = "some header value")
Map<String, String> postWithHeader(@HeaderParam(HeaderConsumingResource.HEADER_NAME) String headerValue, String url);
 
Example #13
Source File: ClientHeadersFactoryClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@DELETE
@ClientHeaderParam(name="MethodHeader", value="methodValue")
JsonObject delete(@HeaderParam("ArgHeader") String argHeader);
 
Example #14
Source File: MultiValueClientHeaderWithComputeMethodOnMethod.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="TestHeader", value={"InitialValue", "{computeHeader}"})
Response get();
 
Example #15
Source File: WorldClockApiWithHeaders.java    From Hands-On-Enterprise-Java-Microservices-with-Eclipse-MicroProfile with MIT License 4 votes vote down vote up
@GET
@Path("/utc/now")
@Produces(MediaType.APPLICATION_JSON)
@ClientHeaderParam(name = "User-Agent", value = "{lookupUserAgent}")
Now utc();
 
Example #16
Source File: MissingHeaderComputeMethod.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name="TestHeader", value="{missingMethod}")
@GET
Response get();
 
Example #17
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="MultiValueInvokedFromAnotherClass",
                   value="{org.eclipse.microprofile.rest.client.tck.ext.HeaderGenerator.generateHeader}")
String methodComputeMultiValuedHeaderFromOtherClass();
 
Example #18
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="WillCauseFailure", value="{fail}")
String methodRequiredComputeMethodFails();
 
Example #19
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="OptionalMethodHeader", value="{fail}", required=false)
@ClientHeaderParam(name="MethodHeaderExplicit", value="SomeValue")
JsonObject methodOptionalMethodHeaderNotSentWhenComputeThrowsException();
 
Example #20
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="OverrideableComputed", value="{computeForMethod3}")
String methodClientHeaderParamOverridesInterfaceComputed();
 
Example #21
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="MethodHeaderComputed", value="{computeForMethod2}")
String headerParamOverridesMethodComputed(@HeaderParam("MethodHeaderComputed") String param);
 
Example #22
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="MethodHeaderComputed", value="{computeForMethod}")
String methodComputed();
 
Example #23
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="OverrideableExplicit", value="overriddenMethodExplicit")
String methodClientHeaderParamOverridesInterfaceExplicit();
 
Example #24
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="MethodHeaderExplicit", value="methodExplicit")
String headerParamOverridesMethodExplicit(@HeaderParam("MethodHeaderExplicit") String param);
 
Example #25
Source File: ClientHeaderParamClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@GET
@ClientHeaderParam(name="MethodHeaderExplicit", value="methodExplicit")
String methodExplicit();
 
Example #26
Source File: MultipleHeadersOnSameMethod.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@ClientHeaderParam(name="IdenticalHeader", value="{computeMethod}")
@ClientHeaderParam(name="IdenticalHeader", value="someValue")
@GET
Response get();
 
Example #27
Source File: CdiClientHeadersFactoryClient.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@DELETE
@ClientHeaderParam(name="MethodHeader", value="methodValue")
JsonObject delete(@HeaderParam("ArgHeader") String argHeader);
 
Example #28
Source File: UserManagementApplicationClient.java    From blog-tutorials with MIT License 4 votes vote down vote up
@POST
@ClientHeaderParam(name = "Authorization", value = "{generateAuthHeader}")
Response createUser(JsonObject user);