All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.roskart.dropwizard.jaxws.example.ws.JavaFirstServiceImpl Maven / Gradle / Ivy

There is a newer version: 1.2.3
Show newest version
package com.roskart.dropwizard.jaxws.example.ws;

import com.codahale.metrics.annotation.ExceptionMetered;
import com.codahale.metrics.annotation.Metered;

import javax.annotation.Resource;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
import java.security.Principal;

@WebService(name="JavaFirstService",
        serviceName="JavaFirstService",
        portName="JavaFirstService",
        targetNamespace="http://com.roskart.dropwizard.example/JavaFirstService",
        endpointInterface= "com.roskart.dropwizard.jaxws.example.ws.JavaFirstService")
public class JavaFirstServiceImpl implements JavaFirstService {

    @Resource
    WebServiceContext wsContext;

    @Override
    @Metered
    @ExceptionMetered
    public String echo(String in) throws JavaFirstServiceException {
        if (in == null || in.trim().length() == 0) {
            throw new JavaFirstServiceException("Invalid parameter");
        }

        Principal user = (Principal)wsContext.getMessageContext().get("dropwizard.jaxws.principal");
        return in + "; principal: " + user.getName();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy