Java Code Examples for javax.ws.rs.QueryParam

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project EasySOA, under directory /easysoa-registry/easysoa-registry-rest/src/main/java/org/easysoa/rest/.

Source file: DiscoveryRest.java

  22 
vote

@GET @Path("/service/jsonp") @Produces("application/javascript") public Object doGetServiceJSONP(@Context HttpContext httpContext,@Context HttpServletRequest request,@QueryParam("callback") String callback) throws Exception {
  EasySOAApiSession api=EasySOALocalApiFactory.createLocalApi(SessionFactory.getSession(request));
  Map<String,String> params=getFirstValues2(httpContext.getRequest().getQueryParameters());
  try {
    EasySOADocument doc=api.notifyService(params);
    result.put("documentId",doc.getId());
  }
 catch (  Exception e) {
    appendError(e.getMessage());
  }
  return getFormattedResult(callback);
}
 

Example 2

From project rhevm-api, under directory /powershell/jaxrs/src/test/java/com/redhat/rhevm/api/powershell/resource/.

Source file: BasePowerShellResourceTest.java

  21 
vote

protected QueryParam getQueryParam(){
  return new QueryParam(){
    public String value(){
      return QUERY;
    }
    @Override public Class<? extends Annotation> annotationType(){
      return null;
    }
  }
;
}
 

Example 3

From project smart-cms, under directory /webservice-modules/webservice-resources/src/main/java/com/smartitengineering/cms/ws/resources/content/searcher/.

Source file: ContentSearcherResource.java

  21 
vote

@GET @Produces(MediaType.APPLICATION_ATOM_XML) public Response getResultFeed(@QueryParam(TYPE_ID) List<String> contentTypeId,@QueryParam(SEARCH_TERMS) String searchTerms,@QueryParam(STATUS) List<String> statuses,@QueryParam(WORKSPACE_ID) String workspaceId,@QueryParam(FIELD) List<String> fieldQuery,@QueryParam(CREATION_DATE) String creationDate,@QueryParam(LAST_MODIFIED_DATE) String lastModifiedDate,@QueryParam(INCLUDE_FRIENDLIES) @DefaultValue("true") boolean includeFriendlies,@QueryParam(START) int start,@QueryParam(COUNT) @DefaultValue("5") int count,@QueryParam(DISJUNCTION) boolean disJunction){
  initParams(contentTypeId,searchTerms,statuses,workspaceId,fieldQuery,creationDate,lastModifiedDate,start,count,disJunction,includeFriendlies);
  ResponseBuilder responseBuilder;
  Filter filter=getFilter();
  final com.smartitengineering.cms.api.common.SearchResult result=SmartContentAPI.getInstance().getContentLoader().search(filter);
  final Collection<Content> searchContent=result.getResult();
  Feed feed=getFeed("search","Content Search Result",new Date());
  feed.addLink(getLink(getUriInfo().getRequestUri().toASCIIString(),Link.REL_ALTERNATE,MediaType.APPLICATION_JSON));
  feed.addLink(getLink(new StringBuilder(getUriInfo().getBaseUri().toASCIIString()).append(getUriInfo().getPath()).toString(),"search",com.smartitengineering.util.opensearch.jaxrs.MediaType.APPLICATION_OPENSEARCHDESCRIPTION_XML));
  Query query=feed.<Query>addExtension(OpenSearchConstants.QUERY);
  query.setRole(Query.Role.REQUEST);
  query.setCount(count);
  query.setStartIndex(start);
  query.setSearchTerms(searchTerms);
  IntegerElement countElem=feed.<IntegerElement>addExtension(OpenSearchConstants.ITEMS_PER_PAGE);
  countElem.setValue(count);
  IntegerElement startIndexElem=feed.<IntegerElement>addExtension(OpenSearchConstants.START_INDEX);
  startIndexElem.setValue(start);
  IntegerElement totalResultsElem=feed.<IntegerElement>addExtension(OpenSearchConstants.TOTAL_RESULTS);
  totalResultsElem.setValue(Long.valueOf(result.getTotalResultsCount()).intValue());
  if (searchContent != null && !searchContent.isEmpty()) {
    feed.addLink(getLink(getNextPage().toASCIIString(),Link.REL_NEXT,MediaType.APPLICATION_ATOM_XML));
    if (getPreviousPage() != null) {
      feed.addLink(getLink(getPreviousPage().toASCIIString(),Link.REL_PREVIOUS,MediaType.APPLICATION_ATOM_XML));
    }
    for (    Content content : searchContent) {
      final URI contentUri=ContentResource.getContentUri(getRelativeURIBuilder(),content.getContentId());
      Entry entry=getEntry(content.getContentId().toString(),new StringBuilder("Content ").append(content.getContentId().toString()).toString(),content.getLastModifiedDate(),getLink(contentUri,Link.REL_ALTERNATE,MediaType.APPLICATION_ATOM_XML),getLink(contentUri,Link.REL_ALTERNATE,MediaType.APPLICATION_JSON));
      feed.addEntry(entry);
    }
  }
  responseBuilder=Response.ok(feed);
  return responseBuilder.build();
}
 

Example 4

From project gmc, under directory /src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/.

Source file: TasksResource.java

  20 
vote

@DELETE @Path("/{" + PATH_PARAM_TASK_ID + "}") @Produces(MediaType.APPLICATION_XML) public Response clearTask(@PathParam(PATH_PARAM_CLUSTER_NAME) String clusterName,@PathParam(PATH_PARAM_TASK_ID) String taskId,@QueryParam(FORM_PARAM_OPERATION) String taskOperation){
  Task task=getTask(clusterName,taskId);
  if (task == null) {
    return notFoundResponse("Requested task not found!");
  }
  if (clusterName == null || clusterName.isEmpty()) {
    return badRequestResponse("Parameter [" + PATH_PARAM_CLUSTER_NAME + "] is missing in request!");
  }
  if (taskOperation == null || taskOperation.isEmpty()) {
    int taskStatus=task.getTaskInfo().getStatus().getCode();
    if (taskStatus == Status.STATUS_CODE_SUCCESS || taskStatus == Status.STATUS_CODE_FAILURE || taskStatus == Status.STATUS_CODE_ERROR) {
      taskOperation=RESTConstants.TASK_DELETE;
    }
 else {
      taskOperation=RESTConstants.TASK_STOP;
    }
  }
  if (!taskOperation.equals(RESTConstants.TASK_STOP) && !taskOperation.equals(RESTConstants.TASK_DELETE)) {
    return badRequestResponse("Invalid value [" + taskOperation + "] for parameter ["+ FORM_PARAM_OPERATION+ "]");
  }
  try {
    if (taskOperation.equals(RESTConstants.TASK_STOP)) {
      task.stop();
      taskOperation=RESTConstants.TASK_DELETE;
    }
    if (taskOperation.equals(RESTConstants.TASK_DELETE)) {
      removeTask(clusterName,task);
    }
    return noContentResponse();
  }
 catch (  Exception e) {
    return errorResponse(e.getMessage());
  }
}
 

Example 5

From project hcatalog, under directory /webhcat/svr/src/main/java/org/apache/hcatalog/templeton/.

Source file: Server.java

  20 
vote

/** 
 * List all the tables in an hcat database.
 */
@GET @Path("ddl/database/{db}/table") @Produces(MediaType.APPLICATION_JSON) public Response listTables(@PathParam("db") String db,@QueryParam("like") String tablePattern) throws HcatException, NotAuthorizedException, BusyException, BadParam, ExecuteException, IOException {
  verifyUser();
  verifyDdlParam(db,":db");
  HcatDelegator d=new HcatDelegator(appConf,execService);
  if (!TempletonUtils.isset(tablePattern))   tablePattern="*";
  return d.listTables(getUser(),db,tablePattern);
}
 

Example 6

From project action-core, under directory /src/main/java/com/ning/metrics/action/endpoint/.

Source file: HdfsBrowser.java

  19 
vote

/** 
 * Build a Viewable to browse HDFS.
 * @param path      path in HDFS to render (directory listing or file), defaults to /
 * @param raw       optional, whether to try to deserialize
 * @param recursive optional, whether to crawl all files under a directory
 * @return Viewable to render the jsp
 * @throws IOException HDFS crawling error
 */
@GET @Path("/hdfs") @Produces({"text/html","text/plain"}) @Timed public Viewable getListing(@QueryParam("path") String path,@QueryParam("raw") final boolean raw,@QueryParam("recursive") final boolean recursive) throws IOException {
  log.debug(String.format("Got request for path=[%s], raw=[%s] and recursive=[%s]",path,raw,recursive));
  if (path == null) {
    path="/";
  }
  if (hdfsReader.isDir(path) && !recursive) {
    return new Viewable("/rest/listing.jsp",hdfsReader.getListing(path));
  }
 else {
    if (raw) {
      return new Viewable("/rest/contentRaw.jsp",hdfsReader.getListing(path,raw,recursive));
    }
 else {
      return new Viewable("/rest/content.jsp",hdfsReader.getListing(path,raw,recursive));
    }
  }
}
 

Example 7

From project ANNIS, under directory /annis-service/src/main/java/annis/service/internal/.

Source file: AnnisWebService.java

  19 
vote

@GET @Path("search/count") @Produces("plain/text") public Response count(@QueryParam("q") String query,@QueryParam("corpora") String rawCorpusNames){
  requiredParameter(query,"q","AnnisQL query");
  requiredParameter(rawCorpusNames,"corpora","comma separated list of corpus names");
  QueryData data=queryDataFromParameters(query,rawCorpusNames);
  long start=new Date().getTime();
  int count=annisDao.count(data);
  long end=new Date().getTime();
  logQuery("COUNT",query,splitCorpusNamesFromRaw(rawCorpusNames),end - start);
  return Response.ok("" + count).type(MediaType.TEXT_PLAIN).build();
}
 

Example 8

From project Arecibo, under directory /collector/src/main/java/com/ning/arecibo/collector/resources/.

Source file: HostDataResource.java

  19 
vote

@GET @Path("/hosts") @Produces(MediaType.APPLICATION_JSON) @TimedResource public StreamingOutput getHosts(@QueryParam("pretty") @DefaultValue("false") final boolean pretty){
  try {
    final BiMap<Integer,String> hosts=dao.getHosts();
    return streamResponse(hosts.values(),pretty);
  }
 catch (  CacheLoader.InvalidCacheLoadException e) {
    throw new WebApplicationException(e,Response.Status.NOT_FOUND);
  }
catch (  RuntimeException e) {
    throw new WebApplicationException(e,buildServiceUnavailableResponse());
  }
}
 

Example 9

From project bam, under directory /samples/jbossas/slamonitor/monitor/src/main/java/org/overlord/bam/samples/jbossas/slamonitor/monitor/.

Source file: SLAMonitor.java

  19 
vote

/** 
 * This method returns the list of response times.
 * @param serviceType The optional service type
 * @param operation The optional operation
 * @param fault The optional fault
 * @return The response times
 */
@GET @Path("/responseTimes") @Produces("application/json") public java.util.List<ResponseTime> getResponseTimes(@QueryParam("serviceType") String serviceType,@QueryParam("operation") String operation,@QueryParam("fault") String fault){
  java.util.List<ResponseTime> ret=new java.util.ArrayList<ResponseTime>();
  ActiveList list=getResponseTimeList(serviceType,operation,fault);
  for (  Object obj : list) {
    if (obj instanceof ResponseTime) {
      ret.add((ResponseTime)obj);
    }
  }
  return (ret);
}
 

Example 10

From project candlepin, under directory /src/main/java/org/candlepin/resource/.

Source file: ActivationKeyResource.java

  19 
vote

/** 
 * @return a Pool
 * @httpcode 400
 * @httpcode 200
 */
@POST @Path("{activation_key_id}/pools/{pool_id}") @Produces(MediaType.APPLICATION_JSON) public Pool addPoolToKey(@PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId,@PathParam("pool_id") @Verify(value=Pool.class,require=Access.READ_POOLS) String poolId,@QueryParam("quantity") @DefaultValue("1") long quantity){
  if (quantity < 1) {
    throw new BadRequestException(i18n.tr("The quantity must be greater than 0"));
  }
  ActivationKey key=findKey(activationKeyId);
  Pool pool=findPool(poolId);
  if (pool.getAttributeValue("requires_consumer_type") != null && pool.getAttributeValue("requires_consumer_type").equals("person") || pool.getProductAttribute("requires_consumer_type") != null && pool.getProductAttribute("requires_consumer_type").getValue().equals("person")) {
    throw new BadRequestException(i18n.tr("Cannot add pools restricted to " + "consumer type 'person' to activation keys."));
  }
  if (quantity > 1) {
    ProductPoolAttribute ppa=pool.getProductAttribute("multi-entitlement");
    if (ppa == null || !ppa.getValue().equalsIgnoreCase("yes")) {
      throw new BadRequestException(i18n.tr("Error: Only pools with multi-entitlement product" + " subscriptions can be added to the activation key with" + " a quantity greater than one."));
    }
  }
  if ((!pool.isUnlimited()) && (quantity > pool.getQuantity())) {
    throw new BadRequestException(i18n.tr("The quantity must not be greater than the total " + "allowed for the pool"));
  }
  key.addPool(pool,quantity);
  activationKeyCurator.update(key);
  return pool;
}
 

Example 11

From project chukwa, under directory /src/main/java/org/apache/hadoop/chukwa/datacollection/agent/rest/.

Source file: AdaptorController.java

  19 
vote

/** 
 * Adds an adaptor to the agent and returns the adaptor info.
 * @param context servletContext
 * @param viewType type of view to return (text|xml)
 * @param postBody JSON post body
 * @return Response object
 */
@POST @Consumes("application/json") @Produces({"text/xml","text/plain"}) public Response addAdaptor(@Context ServletContext context,@QueryParam("viewType") String viewType,String postBody){
  ChukwaAgent agent=(ChukwaAgent)context.getAttribute("ChukwaAgent");
  if (postBody == null)   return badRequestResponse("Empty POST body.");
  StringBuilder addCommand=new StringBuilder("add ");
  try {
    JSONObject reqJson=new JSONObject(postBody);
    String dataType=reqJson.getString("DataType");
    String adaptorClass=reqJson.getString("AdaptorClass");
    String adaptorParams=fetchOptionalString(reqJson,"AdaptorParams");
    long offset=fetchOptionalLong(reqJson,"Offset",0);
    addCommand.append(adaptorClass).append(' ');
    addCommand.append(dataType);
    if (adaptorParams != null)     addCommand.append(' ').append(adaptorParams);
    addCommand.append(' ').append(offset);
  }
 catch (  JSONException e) {
    return badRequestResponse("Invalid JSON passed: '" + postBody + "', error: "+ e.getMessage());
  }
  try {
    String adaptorId=agent.processAddCommandE(addCommand.toString());
    return doGetAdaptor(agent,adaptorId,viewType);
  }
 catch (  AdaptorException e) {
    return badRequestResponse("Could not add adaptor for postBody: '" + postBody + "', error: "+ e.getMessage());
  }
}
 

Example 12

From project collector, under directory /src/main/java/com/ning/metrics/collector/jaxrs/.

Source file: AsyncEventResource.java

  19 
vote

@Path("/event") @GET @Produces({APPLICATION_JSON,APPLICATION_JSONP}) public SuspendResponse subscribe(@PathParam("type") @DefaultValue(EventListenerDispatcher.NO_FILTER_KEY) final Broadcaster feed,@QueryParam("type") @DefaultValue(EventListenerDispatcher.NO_FILTER_KEY) final String eventType){
  Broadcaster broadcaster=feed;
  if (feed == null || feed.getAtmosphereResources().size() == 0) {
    broadcaster=BroadcasterFactory.getDefault().lookup(JerseySimpleBroadcaster.class,eventType);
    if (broadcaster == null) {
      broadcaster=BroadcasterFactory.getDefault().lookup(JerseySimpleBroadcaster.class,eventType,true);
      final NewEventListener listener=new NewEventListener(config,broadcaster);
      dispatcher.addListener(eventType,listener);
    }
  }
  return new SuspendResponse.SuspendResponseBuilder<String>().broadcaster(broadcaster).resumeOnBroadcast(false).outputComments(true).build();
}
 

Example 13

From project crest, under directory /integration/server/src/main/java/org/codegist/crest/server/stubs/handler/.

Source file: RetryHandlersStub.java

  19 
vote

@GET @Path("retry") public Response retry(@QueryParam("value") String value){
  if (++count != failFor) {
    return Response.status(418).build();
  }
 else {
    return Response.ok(value).build();
  }
}
 

Example 14

From project data-access, under directory /src/org/pentaho/platform/dataaccess/datasource/wizard/service/impl/.

Source file: MetadataDatasourceService.java

  19 
vote

@PUT @Path("/storeDomain") @Consumes({MediaType.APPLICATION_OCTET_STREAM,TEXT_PLAIN}) @Produces("text/plain") public Response storeDomain(InputStream metadataFile,@QueryParam("domainId") String domainId) throws PentahoAccessControlException {
  try {
    validateAccess();
    PentahoMetadataDomainRepository metadataImporter=new PentahoMetadataDomainRepository(PentahoSystem.get(IUnifiedRepository.class));
    metadataImporter.storeDomain(metadataFile,domainId,true);
    return Response.ok("SUCCESS").type(MediaType.TEXT_PLAIN).build();
  }
 catch (  PentahoAccessControlException e) {
    return Response.serverError().entity(e.toString()).build();
  }
catch (  Exception e) {
    return Response.serverError().entity(Messages.getString("MetadataDatasourceService.ERROR_001_METADATA_DATASOURCE_ERROR")).build();
  }
}
 

Example 15

From project HMS, under directory /controller/src/main/java/org/apache/hms/controller/rest/.

Source file: ClusterManager.java

  19 
vote

@GET @Path("node/status") public MachineState checkNodeStatus(@QueryParam("node") String nodeId){
  try {
    return Controller.getInstance().getClientHandler().checkNodeStatus(nodeId);
  }
 catch (  IOException e) {
    LOG.warn(ExceptionUtil.getStackTrace(e));
    throw new WebApplicationException(e);
  }
}
 

Example 16

From project hoop, under directory /hoop-server/src/main/java/com/cloudera/hoop/.

Source file: Hoop.java

  19 
vote

/** 
 * Binding to handle all DELETE requests.
 * @param user principal making the request.
 * @param path path for the DELETE request.
 * @param recursive indicates if the delete is recursive, default is <code>false</code>
 * @param doAs user being impersonated, defualt value is none. It can be usedonly if the current user is a Hoop proxyuser.
 * @return the request response.
 * @throws IOException thrown if an IO error occurred. Thrown exceptions arehandled by  {@link HoopExceptionProvider}.
 * @throws HadoopException thrwon if a Hadoop releated error occurred. Thrownexceptions are handled by  {@link HoopExceptionProvider}.
 */
@DELETE @Path("{path:.*}") @Produces(MediaType.APPLICATION_JSON) public Response delete(@Context Principal user,@PathParam("path") FsPathParam path,@QueryParam(DeleteRecursiveParam.NAME) @DefaultValue(DeleteRecursiveParam.DEFAULT) DeleteRecursiveParam recursive,@QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT) DoAsParam doAs) throws IOException, HadoopException {
  path.makeAbsolute();
  MDC.put("op","DELETE");
  AUDIT_LOG.info("[{}] recursive [{}]",path,recursive);
  FSDelete command=new FSDelete(path.value(),recursive.value());
  JSONObject json=fsExecute(user,doAs.value(),command);
  return Response.ok(json).type(MediaType.APPLICATION_JSON).build();
}
 

Example 17

From project iserve, under directory /iserve-parent/iserve-sal-rest/src/main/java/uk/ac/open/kmi/iserve/sal/rest/auth/oauth/.

Source file: AuthorizeResource.java

  19 
vote

@GET @Produces(MediaType.TEXT_HTML) public Response authorize(@QueryParam("oauth_token") String oauthToken,@Context HttpServletRequest request) throws MessageException, DiscoveryException, AssociationException {
  if (oauthToken == null) {
    System.out.println("oauthToken == null");
  }
  if (request.getSession().getAttribute("openid-disc") == null) {
    return Response.ok().entity(loginHtml.replaceAll("<<<oauth_token>>>",oauthToken)).build();
  }
 else {
    ParameterList response=new ParameterList(request.getParameterMap());
    DiscoveryInformation discovered=(DiscoveryInformation)request.getSession().getAttribute("openid-disc");
    StringBuffer receivingURL=request.getRequestURL();
    String queryString=request.getQueryString();
    if (queryString != null && queryString.length() > 0) {
      receivingURL.append("?").append(queryString);
    }
    VerificationResult verification=manager.verify(receivingURL.toString(),response,discovered);
    Identifier verified=verification.getVerifiedId();
    if (verified != null) {
      HttpSession session=request.getSession();
      session.setAttribute("logged-in",verified.toString());
      session.removeAttribute("openid-disc");
      RequestToken requestToken=keyManager.findRequestToken(oauthToken);
      String entityString=authHtml.replaceAll("<<<customer_key>>>",requestToken.getConsumer().toString()).replaceAll("<<<openid>>>",verified.toString()).replace("<<<oauth_token>>>",oauthToken);
      return Response.ok().entity(entityString).build();
    }
 else {
      return Response.status(400).entity("error").build();
    }
  }
}
 

Example 18

From project Ivory, under directory /prism/src/main/java/org/apache/ivory/resource/channel/.

Source file: HTTPChannel.java

  19 
vote

private String pathValue(Method method,Object... args) throws IvoryException {
  Path pathParam=method.getAnnotation(Path.class);
  if (pathParam == null) {
    throw new IvoryException("No path param mentioned for " + method);
  }
  String pathValue=pathParam.value();
  Annotation[][] paramAnnotations=method.getParameterAnnotations();
  StringBuilder queryString=new StringBuilder("?");
  for (int index=0; index < args.length; index++) {
    if (args[index] instanceof String) {
      String arg=(String)args[index];
      for (int annotation=0; annotation < paramAnnotations[index].length; annotation++) {
        Annotation paramAnnotation=paramAnnotations[index][annotation];
        String annotationClass=paramAnnotation.annotationType().getName();
        if (annotationClass.equals(QueryParam.class.getName())) {
          queryString.append(getAnnotationValue(paramAnnotation,"value")).append('=').append(arg).append("&");
        }
 else         if (annotationClass.equals(PathParam.class.getName())) {
          pathValue=pathValue.replace("{" + getAnnotationValue(paramAnnotation,"value") + "}",arg);
        }
      }
    }
  }
  return pathValue + queryString.toString();
}
 

Example 19

From project javaee-tutorial, under directory /jaxrs/server/src/main/java/org/jboss/ee/tutorial/jaxrs/server/.

Source file: Library.java

  19 
vote

@PUT @Path("/book/{isbn}") public Book addBook(@PathParam("isbn") String id,@QueryParam("title") String title){
  Book book=new Book(id,title);
  log.infof("addBook: %s",book);
  books.put(id,book);
  return book;
}
 

Example 20

From project jbpm-form-builder, under directory /jbpm-gwt-form-builder/src/main/java/org/jbpm/formbuilder/server/.

Source file: RESTFileService.java

  19 
vote

@GET @Path("/package/{pkgName}/") public Response getFiles(@Context HttpServletRequest request,@PathParam("pkgName") String packageName,@QueryParam("type") String[] fileTypes){
  setContext(request.getSession().getServletContext());
  try {
    List<String> allFiles=new ArrayList<String>();
    for (    String fileType : fileTypes) {
      allFiles.addAll(fileService.loadFilesByType(packageName,fileType));
    }
    Collections.sort(allFiles);
    FileListDTO dto=new FileListDTO(allFiles);
    return Response.ok(dto,MediaType.APPLICATION_XML).build();
  }
 catch (  FileException e) {
    return error("Problem loading file names",e);
  }
}
 

Example 21

From project jetty-project, under directory /jetty-jmx-ws/src/main/java/org/mortbay/jetty/jmx/ws/web/mbean/.

Source file: MBeansObjectName.java

  19 
vote

@GET @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) public MBeanJaxBean getOperations(@PathParam("objectName") String objectName,@QueryParam("nodes") String nodes){
  Collection<JMXNode> jmxNodes=FilterNodesUtils.getNodesToAggregate(nodes);
  MBeanAttributeJaxBeans mBeanAttributesJaxBean;
  MBeanOperationJaxBeans mBeanOperationsJaxBean;
  try {
    mBeanAttributesJaxBean=aggregateService.getAttributesMetaData(uriInfo,jmxNodes,objectName);
    mBeanOperationsJaxBean=aggregateService.getOperationsMetaData(uriInfo,jmxNodes,objectName);
  }
 catch (  InstanceNotFoundException e) {
    LOG.info("getOperations: ",e);
    return MBeanJaxBean.EMPTY_MBEAN_JAX_BEAN;
  }
  return new MBeanJaxBean(objectName,mBeanOperationsJaxBean,mBeanAttributesJaxBean);
}
 

Example 22

From project jira-hudson-integration, under directory /jira-hudson-plugin/src/main/java/com/marvelution/jira/plugins/hudson/rest/.

Source file: HudsonChartsRestResource.java

  19 
vote

/** 
 * Endpoint method to generate a given chart for a server and jobname specified
 * @param type the type of Chart to generate (This is used to select the {@link HudsonChartGenerator} implementation
 * @param serverId the Id of the Hudson Server that was configured using the <a href="http://docs.marvelution.com/display/MARVJIRAHUDSON/Manage%20Hudson%20Servers">Manage Hudson Servers</a> feature
 * @param jobname the job name of the job to get the data for
 * @return the {@link Chart} object with all the information related to the chart
 * @throws IOException in case of errors
 * @throws ClientException in case of {@link HudsonClient} communication issues
 */
@GET @Path("generate/{type}") public Chart getChart(@PathParam("type") String type,@QueryParam("serverId") int serverId,@QueryParam("jobName") String jobname) throws IOException, ClientException {
  if (serverManager.hasServer(serverId)) {
    final HudsonServer server=serverManager.getServer(serverId);
    final HudsonClient client=clientFactory.create(server);
    final Job job=client.find(JobQuery.createForJobByName(jobname,true));
    if (job != null && StringUtils.isNotBlank(job.getName())) {
      ChartHelper chartHelper=null;
      if (charts.containsKey(type)) {
        try {
          HudsonChartGenerator chartGenerator=charts.get(type).newInstance();
          chartGenerator.setData(server,job);
          chartHelper=chartGenerator.generateChart();
        }
 catch (        InstantiationException e) {
          throw new RuntimeException("Failed to instantiate the Chart Generator: " + type,e);
        }
catch (        IllegalAccessException e) {
          throw new RuntimeException("Illegal access attempt",e);
        }
      }
 else {
        throw new NoSuchChartException(type);
      }
      chartHelper.generate(CHART_WIDTH,CHART_HEIGHT);
      return new Chart(chartHelper,job.getName());
    }
 else {
      throw new NoSuchJobException(jobname);
    }
  }
 else {
    throw new NoSuchServerException(serverId);
  }
}
 

Example 23

From project koshinuke.java, under directory /src/java/org/koshinuke/jgit/server/.

Source file: GitHttpdService.java

  19 
vote

@GET @Path(Constants.INFO_REFS) public Response infoRefs(@Context KoshinukePrincipal principal,@PathParam("project") String project,@PathParam("repository") String repository,@QueryParam("service") String service) throws IOException {
  InfoRefsAction action=this.actions.get(service);
  if (action != null) {
    return action.execute(principal,project,repository);
  }
  return this.buildResponse(project,repository,new Function<Repository,Response>(){
    @Override public Response apply(    Repository input){
      return noCache(new EachRefPack(input)).type(MediaType.TEXT_PLAIN).build();
    }
  }
);
}
 

Example 24

From project lyo.rio, under directory /OSLC4JChangeManagement/src/org/eclipse/lyo/oslc4j/changemanagement/resources/.

Source file: ChangeRequestResource.java

  19 
vote

@OslcDialogs({@OslcDialog(title="Change Request Selection Dialog",label="Change Request Selection Dialog",uri="",hintWidth="1000px",hintHeight="600px",resourceTypes={Constants.TYPE_CHANGE_REQUEST},usages={OslcConstants.OSLC_USAGE_DEFAULT}),@OslcDialog(title="Change Request List Dialog",label="Change Request List Dialog",uri="UI/changeRequests/list.jsp",hintWidth="1000px",hintHeight="600px",resourceTypes={Constants.TYPE_CHANGE_REQUEST},usages={Constants.USAGE_LIST})}) @OslcQueryCapability(title="Change Request Query Capability",label="Change Request Catalog Query",resourceShape=OslcConstants.PATH_RESOURCE_SHAPES + "/" + Constants.PATH_CHANGE_REQUEST,resourceTypes={Constants.TYPE_CHANGE_REQUEST},usages={OslcConstants.OSLC_USAGE_DEFAULT}) @GET @Produces({OslcMediaType.APPLICATION_RDF_XML,OslcMediaType.APPLICATION_XML,OslcMediaType.APPLICATION_JSON}) public ChangeRequest[] getChangeRequests(@QueryParam("oslc.where") final String where){
  final List<ChangeRequest> results=new ArrayList<ChangeRequest>();
  final ChangeRequest[] changeRequests=Persistence.getChangeRequests();
  for (  final ChangeRequest changeRequest : changeRequests) {
    changeRequest.setServiceProvider(ServiceProviderSingleton.getServiceProviderURI());
    results.add(changeRequest);
  }
  return results.toArray(new ChangeRequest[results.size()]);
}
 

Example 25

From project lyo.server, under directory /org.eclipse.lyo.samples.excel/src/main/java/org/eclipse/lyo/samples/excel/changerequest/.

Source file: ChangeRequestCompactService.java

  19 
vote

@GET public StreamingOutput doGet(@QueryParam("uri") String uri,@QueryParam("projectId") String projectId,@QueryParam("id") String id,@Context UriInfo uriInfo){
  String baseUrl=uriInfo.getBaseUri().toString() + IConstants.SERVICE_SERVICES;
  ResourceAdapter adapter=AdapterRegistry.getAdapter(baseUrl);
  String query="PREFIX dcterms:<http://purl.org/dc/elements/1.1/>\n" + "SELECT ?uri ?title ?identifier ?created\n" + "WHERE {\n"+ "  ?uri dcterms:title ?title.\n"+ "  ?uri dcterms:identifier ?identifier.\n"+ "  ?uri dcterms:created ?created.\n"+ "  ?uri dcterms:identifier \"" + id + "\"\n"+ "}\n";
  ResultSet resultSet=adapter.executeSparql(projectId,query);
  final String html=buildHtml(resultSet);
  return new StreamingOutput(){
    public void write(    OutputStream output) throws IOException, WebApplicationException {
      byte[] out=html.getBytes();
      output.write(out);
    }
  }
;
}
 

Example 26

From project meteo, under directory /core/src/main/java/com/ning/metrics/meteo/server/resources/.

Source file: StreamResource.java

  19 
vote

/** 
 * Get the data points associated with a field in an Esper query. For this to work, you need to add ResourceListener as a publisher and configure it in a stream: { "name": "Jansky", "type": "com.ning.metrics.meteo.publishers.ResourceListener", "@class": "com.ning.metrics.meteo.publishers.ResourcePublisherConfig" }
 * @param callback  Javascript callback
 * @param stream Stream name
 * @param attribute the SQL alias of an Esper query
 * @return jsonp representation of the data points in memory
 */
@GET @Path("/{stream}/{attribute}") @Produces(MediaType.APPLICATION_JSON) public Response getSamplesByRoute(@QueryParam("callback") @DefaultValue("callback") final String callback,@PathParam("stream") final String stream,@PathParam("attribute") final String attribute){
  Cache<Object,Object> samplesCache=null;
  final ResourceListener resourceListener=(ResourceListener)compiler.getPublisherInstances().get(stream);
  if (resourceListener != null) {
    final Map<String,Cache<Object,Object>> samples=resourceListener.getSamplesCache();
    samplesCache=samples.get(attribute);
  }
  return buildJsonpResponse(attribute,samplesCache,callback);
}
 

Example 27

From project multilane, under directory /demo/portal/src/main/java/demo/resource/.

Source file: ApiResource.java

  19 
vote

@GET @Path("/weather") public String weather(@QueryParam("area") String area) throws Exception {
  Thread.sleep(300L);
  if (area.equals("Tokyo")) {
    return "<li>Sunshine. Highs in the mid 80s and lows in the low 70s.</li>" + time();
  }
 else   if (area.equals("Kyoto")) {
    return "<li>Times of sun and clouds. Highs in the low 80s and lows in the mid 60s.</li>" + time();
  }
 else {
    return "<li>Unknown</li>" + time();
  }
}
 

Example 28

From project nuxeo-dam, under directory /nuxeo-dam-importer/nuxeo-dam-importer-jaxrs/src/main/java/org/nuxeo/dam/importer/jaxrs/.

Source file: HttpDamImporterExecutor.java

  19 
vote

@GET @Path("run") @Produces("text/plain; charset=UTF-8") public String run(@QueryParam("inputPath") String inputPath,@QueryParam("importFolderTitle") String importFolderTitle,@QueryParam("importFolderPath") String importFolderPath,@QueryParam("importSetTitle") String importSetTitle,@QueryParam("batchSize") Integer batchSize,@QueryParam("nbThreads") Integer nbThreads,@QueryParam("interactive") Boolean interactive) throws Exception {
  File srcFile=new File(inputPath);
  SourceNode source=new FileWithMetadataSourceNode(srcFile);
  DamService damService=Framework.getLocalService(DamService.class);
  ImporterRunnerConfiguration configuration=new ImporterRunnerConfiguration.Builder(source,damService.getAssetLibraryPath(),getLogger()).batchSize(batchSize).nbThreads(nbThreads).build();
  DamMultiThreadedImporter runner;
  if (importFolderPath != null) {
    runner=DamMultiThreadedImporter.createWithImportFolderPath(configuration,importFolderPath,importSetTitle);
  }
 else {
    runner=DamMultiThreadedImporter.createWithImportFolderTitle(configuration,importFolderTitle,importSetTitle);
  }
  runner.setFactory(new FileManagerDocumentModelFactory());
  ImporterFilter filter=new EventServiceConfiguratorFilter(false,false,false,true);
  runner.addFilter(filter);
  runner.addFilter(new DamImporterFilter());
  runner.addImportingDocumentFilters(new DamImportingDocumentFilter());
  return doRun(runner,interactive);
}
 

Example 29

From project nuxeo-opensocial, under directory /nuxeo-opensocial-container-webapp/src/main/java/org/nuxeo/opensocial/container/server/rest/.

Source file: FolderWebObject.java

  19 
vote

@GET @Produces("text/json") @Path("gadgetChildren") public Object doGetGadgetChildrenInParentWs(@QueryParam("type") String type) throws ClientException {
  final String logPrefix="<doGetGadgetChildrenInParentWs>";
  CoreSession session=ctx.getCoreSession();
  DocumentModel parentWorkspace=getParentWorkspace(doc);
  log.debug(logPrefix + doc);
  DocumentModelList list=session.getChildren(parentWorkspace.getRef(),type);
  Gson gson=new Gson();
  String response=gson.toJson(new FoldersListGson(list,session));
  return response;
}
 

Example 30

From project nuxeo-rss-reader, under directory /nuxeo-rss-reader-ui/src/main/java/org/nuxeo/rss/reader/webengine/.

Source file: RssReaderModuleRoot.java

  19 
vote

@GET @Path("/item") public Object getItemContent(@QueryParam("i") String id,@QueryParam("language") String language) throws Exception {
  WebEngine.getActiveContext().setLocale(new Locale(language));
  RSSFeedService rssFeedService=Framework.getLocalService(RSSFeedService.class);
  List<String> urls=rssFeedService.getCurrentUserRssFeedAddresses(ctx.getCoreSession());
  return getView("item").args(FeedHelper.searchFeedEntry(urls.toArray(new String[urls.size()]),id));
}
 

Example 31

From project nuxeo-webengine, under directory /nuxeo-webengine-ui/src/main/java/org/nuxeo/ecm/webengine/ui/.

Source file: Test.java

  19 
vote

@GET @Path("tree") public Response getContent(@QueryParam("root") String root) throws Exception {
  UserSession us=UserSession.getCurrentSession(ctx.getRequest());
  DocumentTree tree=(DocumentTree)us.get("TREE");
  if (tree == null) {
    DocumentModel rootDoc=ctx.getCoreSession().getDocument(new PathRef("/default-domain"));
    tree=new DocumentTree(ctx,rootDoc);
    us.put("TREE",tree);
  }
  String result="";
  if (root == null || "source".equals(root)) {
    tree.enter(ctx,"/");
    result=tree.getTreeAsJSONArray(ctx);
  }
 else {
    result=tree.enter(ctx,root);
  }
  return Response.ok().entity(result).build();
}
 

Example 32

From project odata4j, under directory /odata4j-core/src/main/java/org/odata4j/producer/resources/.

Source file: LinksRequestResource.java

  19 
vote

@GET public Response getLinks(@Context HttpHeaders httpHeaders,@Context UriInfo uriInfo,@Context ContextResolver<ODataProducer> producerResolver,@QueryParam("$format") String format,@QueryParam("$callback") String callback){
  log.info(String.format("getLinks(%s,%s,%s,%s)",sourceEntity.getEntitySetName(),sourceEntity.getEntityKey(),targetNavProp,targetEntityKey));
  ODataProducer producer=producerResolver.getContext(ODataProducer.class);
  EntityIdResponse response=producer.getLinks(sourceEntity,targetNavProp);
  StringWriter sw=new StringWriter();
  String serviceRootUri=uriInfo.getBaseUri().toString();
  String contentType;
  if (response.getMultiplicity() == EdmMultiplicity.MANY) {
    SingleLinks links=SingleLinks.create(serviceRootUri,response.getEntities());
    FormatWriter<SingleLinks> fw=FormatWriterFactory.getFormatWriter(SingleLinks.class,httpHeaders.getAcceptableMediaTypes(),format,callback);
    fw.write(uriInfo,sw,links);
    contentType=fw.getContentType();
  }
 else {
    OEntityId entityId=Enumerable.create(response.getEntities()).firstOrNull();
    if (entityId == null)     throw new NotFoundException();
    SingleLink link=SingleLinks.create(serviceRootUri,entityId);
    FormatWriter<SingleLink> fw=FormatWriterFactory.getFormatWriter(SingleLink.class,httpHeaders.getAcceptableMediaTypes(),format,callback);
    fw.write(uriInfo,sw,link);
    contentType=fw.getContentType();
  }
  String entity=sw.toString();
  return Response.ok(entity,contentType).header(ODataConstants.Headers.DATA_SERVICE_VERSION,ODataConstants.DATA_SERVICE_VERSION_HEADER).build();
}
 

Example 33

From project onebusaway-nyc, under directory /onebusaway-nyc-admin-webapp/src/main/java/org/onebusaway/nyc/admin/service/api/.

Source file: BarcodeResource.java

  19 
vote

@Path("/getByStopId/{stopId}") @GET @Produces("image/jpeg") public Response proxy(@PathParam("stopId") String stopId,@DefaultValue("99") @QueryParam("img-dimension") String imgDimension){
  String uri=getTDMURL() + "/api/barcode/getByStopId/" + stopId;
  uri=uri + "?" + "img-dimension="+ imgDimension;
  Response response=Response.ok(proxyRequest(uri)).build();
  return response;
}
 

Example 34

From project Openbravo-POS-iPhone-App, under directory /OpenbravoPOS_PDA/src-pda/com/openbravo/pos/pda/restresources/.

Source file: TicketResource.java

  19 
vote

@GET @Path("ticket") @Produces("application/json") public TicketInfo getTicket(@QueryParam("place") String placeId){
  System.out.println("Place-ID: " + placeId);
  TicketInfo ticket=manager.findTicket(placeId);
  if (ticket != null) {
    ticket.setCustomer(null);
    ticket.setTaxes(null);
  }
 else {
    manager.initTicket(placeId);
    ticket=manager.findTicket(placeId);
    ticket.setCustomer(null);
    ticket.setTaxes(null);
  }
  return ticket;
}
 

Example 35

From project OpenTripPlanner, under directory /opentripplanner-api-webapp/src/main/java/org/opentripplanner/api/ws/analyst/.

Source file: Raster.java

  19 
vote

@GET @Produces("image/*") public Response getRaster(@QueryParam("x") Float x,@QueryParam("y") Float y,@QueryParam("width") Integer width,@QueryParam("height") Integer height,@QueryParam("resolution") Double resolution,@QueryParam("time") GregorianCalendar time,@QueryParam("format") @DefaultValue("image/geotiff") MIMEImageFormat format,@QueryParam("crs") @DefaultValue("EPSG:4326") CoordinateReferenceSystem crs) throws Exception {
  Envelope2D bbox=new Envelope2D(index.getBoundingBox(crs));
  if (resolution != null) {
    width=(int)Math.ceil(bbox.width / resolution);
    height=(int)Math.ceil(bbox.height / resolution);
  }
  TileRequest tileRequest=new TileRequest(bbox,width,height);
  SPTRequest sptRequest=new SPTRequest(x,y,time);
  RenderRequest renderRequest=new RenderRequest(format,Layer.TRAVELTIME,Style.GRAY,false);
  return null;
}
 

Example 36

From project platform_1, under directory /samples/gadgets-sample/service/src/main/java/org/exoplatform/platform/gadget/services/favorite/.

Source file: FavoriteRESTService.java

  19 
vote

@GET @Path("/all/{repoName}/{workspaceName}/{userName}") public Response getFavoriteByUser(@PathParam("repoName") String repoName,@PathParam("workspaceName") String wsName,@PathParam("userName") String userName,@QueryParam("showItems") String showItems) throws Exception {
  List<FavoriteNode> listFavorites=new ArrayList<FavoriteNode>();
  if (showItems == null || showItems.trim().length() == 0)   showItems=String.valueOf(NO_PER_PAGE);
  try {
    NodeHierarchyCreator nodeHierarchyCreator=(NodeHierarchyCreator)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(NodeHierarchyCreator.class);
    SessionProviderService sessionProviderService=(SessionProviderService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(SessionProviderService.class);
    Node userNode=nodeHierarchyCreator.getUserNode(sessionProviderService.getSystemSessionProvider(null),userName);
    List<Node> listNodes=getAllFavoritesByUser(wsName,repoName,userNode);
    Collections.sort(listNodes,new PropertyValueComparator(DATE_MODIFIED,PropertyValueComparator.DESCENDING_ORDER));
    FavoriteNode favoriteNode;
    for (    Node favorite : listNodes) {
      favoriteNode=new FavoriteNode();
      favoriteNode.setName(favorite.getName());
      favoriteNode.setTitle(getTitle(favorite));
      favoriteNode.setDateAddFavorite(getDateFormat(favorite.getProperty(DATE_MODIFIED).getDate()));
      favoriteNode.setNodePath(favorite.getPath());
      String linkImage="Icon16x16 default16x16Icon" + getNodeTypeIcon(favorite,"16x16Icon");
      favoriteNode.setLinkImage(linkImage);
      if (favoriteNode != null) {
        if (listFavorites.size() < Integer.valueOf(showItems))         listFavorites.add(favoriteNode);
      }
    }
  }
 catch (  ItemNotFoundException e) {
    LOG.error(e.getMessage(),e);
  }
catch (  RepositoryException e) {
    LOG.error(e.getMessage(),e);
  }
catch (  Exception e) {
    LOG.error(e.getMessage(),e);
    return Response.serverError().build();
  }
  ListResultNode listResultNode=new ListResultNode();
  listResultNode.setListFavorite(listFavorites);
  DateFormat dateFormat=new SimpleDateFormat(IF_MODIFIED_SINCE_DATE_FORMAT);
  return Response.ok(listResultNode,new MediaType("application","json")).header(LAST_MODIFIED_PROPERTY,dateFormat.format(new Date())).build();
}
 

Example 37

From project platform_2, under directory /src/eu/cassandra/server/api/.

Source file: Appliances.java

  19 
vote

/** 
 * Gets the appliances under an installation
 * @param message contains the inst_id to search the related installation
 * @return
 */
@GET public String getAppliances(@QueryParam("inst_id") String inst_id,@QueryParam("scn_id") String scn_id,@QueryParam("actmod_id") String actmod_id,@QueryParam("count") boolean count,@QueryParam("pertype") boolean pertype,@Context HttpHeaders httpHeaders){
  if (actmod_id != null) {
    return PrettyJSONPrinter.prettyPrint(new MongoAppliances().getApplianceFromActivityModel(httpHeaders,actmod_id));
  }
 else   if (scn_id != null && (pertype || count))   return PrettyJSONPrinter.prettyPrint(new MongoAppliances().getAppliances(httpHeaders,inst_id,scn_id,count,pertype));
 else   return PrettyJSONPrinter.prettyPrint(new MongoAppliances().getAppliances(httpHeaders,inst_id,null,count,pertype));
}
 

Example 38

From project rest-support, under directory /hudson-rest-api/src/main/java/org/hudsonci/rest/api/build/.

Source file: BuildResource.java

  19 
vote

@GET @Path("keep") public Response keepBuild(final @PathParam("projectName") String projectName,final @PathParam("buildNumber") int buildNumber,final @QueryParam("release") @DefaultValue("false") boolean release){
  log.debug("{} build: {} #{}",new Object[]{release ? "Releasing" : "Keeping",projectName,buildNumber});
  AbstractProject<?,?> project=support.getProject(projectName);
  buildService.keepBuild(project,buildNumber,release);
  return Response.noContent().build();
}
 

Example 39

From project s-ramp, under directory /s-ramp-atom/src/main/java/org/overlord/sramp/atom/services/.

Source file: QueryResource.java

  19 
vote

/** 
 * Do an s-ramp query from a GET style request.
 * @param uri
 * @param query
 * @param page
 * @param pageSize
 * @param orderBy
 * @param asc
 * @throws SrampAtomException
 */
@GET @Produces(MediaType.APPLICATION_ATOM_XML_FEED) public Feed queryFromGet(@Context UriInfo uri,@QueryParam("query") String query,@QueryParam("page") Integer page,@QueryParam("pageSize") Integer pageSize,@QueryParam("orderBy") String orderBy,@QueryParam("ascending") Boolean asc,@QueryParam("propertyName") Set<String> propNames) throws SrampAtomException {
  try {
    return query(query,page,pageSize,orderBy,asc,propNames);
  }
 catch (  Throwable e) {
    throw new SrampAtomException(e);
  }
}
 

Example 40

From project saiku, under directory /saiku-bi-platform-plugin/src/main/java/org/saiku/plugin/resources/.

Source file: PentahoRepositoryResource.java

  19 
vote

/** 
 * Load a query.
 * @param queryName - The name of the query to load.
 * @return A Saiku Query Object.
 */
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/{name}") public SavedQuery loadQuery(@PathParam("name") String name,@QueryParam("solution") String solution,@QueryParam("path") String path,@QueryParam("action") String action){
  try {
    if (!action.endsWith(".saiku")) {
      action+=".saiku";
    }
    System.out.println("load solution:" + solution + " path:"+ path+ " action:"+ action);
    String fullPath=ActionInfo.buildSolutionPath(solution,path,action);
    IPentahoSession userSession=PentahoSessionHolder.getSession();
    ISolutionRepository repository=PentahoSystem.get(ISolutionRepository.class,userSession);
    if (repository.resourceExists(fullPath)) {
      String doc=repository.getResourceAsString(fullPath,ISolutionRepository.ACTION_EXECUTE);
      if (doc == null) {
        log.error("Error retrieving saiku document from solution repository");
        throw new NullPointerException("Error retrieving saiku document from solution repository");
      }
      SavedQuery sq=new SavedQuery(name,null,doc);
      return sq;
    }
  }
 catch (  Exception e) {
    log.error("Cannot load query (" + name + ")",e);
  }
  return null;
}
 

Example 41

From project saiku-adhoc, under directory /saiku-adhoc-core/src/main/java/org/saiku/adhoc/rest/.

Source file: PentahoRepositoryResource.java

  19 
vote

/** 
 * Load a query.
 * @param queryName - The name of the query to load.
 * @return A Saiku Query Object.
 */
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/query/{name}") public SavedQuery loadQuery(@PathParam("name") String name,@QueryParam("solution") String solution,@QueryParam("path") String path,@QueryParam("action") String action){
  if (log.isDebugEnabled()) {
    log.debug("REST:GET loadQuery name=" + name + " solution="+ solution+ " path="+ path+ " action="+ action);
  }
  try {
    String doc=repository.loadFile(solution,path,action);
    SavedQuery sq=new SavedQuery(action,null,doc);
    return sq;
  }
 catch (  Exception e) {
    log.error("Cannot load query (" + action + ")",e);
  }
  return null;
}
 

Example 42

From project service-discovery, under directory /server/src/main/java/com/nesscomputing/service/discovery/server/resources/.

Source file: ServiceLookupResource.java

  19 
vote

@GET @Produces(MediaType.TEXT_PLAIN) public Response getURI(@QueryParam("uri") ServiceURI uri) throws URISyntaxException, IOException {
  if (uri != null) {
    return Response.ok(serviceUriConverter.convertServiceURI(uri).toString()).build();
  }
 else {
    return Response.status(Status.BAD_REQUEST).build();
  }
}