Added as POST and Consume JSON

This commit is contained in:
Francesco Mangiacrapa 2021-04-07 15:04:17 +02:00
parent c2ff9db3a6
commit 93434b1f0c
1 changed files with 8 additions and 2 deletions

View File

@ -11,10 +11,14 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
@ -30,7 +34,7 @@ import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/** /**
* The Class WekeoResolver. * The Class WekeoResolver.
* *
@ -57,8 +61,10 @@ public class WekeoResolver {
* @return the token * @return the token
* @throws WebApplicationException the web application exception * @throws WebApplicationException the web application exception
*/ */
@GET @POST
@Path("/gettoken") @Path("/gettoken")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
public Response getToken(@Context HttpServletRequest req) throws WebApplicationException{ public Response getToken(@Context HttpServletRequest req) throws WebApplicationException{
logger.info(this.getClass().getSimpleName()+" getToken starts..."); logger.info(this.getClass().getSimpleName()+" getToken starts...");