@POST public Response createSessionWithAutomaticId(@Context UriInfo uriInfo, @Context HttpHeaders headers) { Session s; try { s = sessionManager.createSession(); } catch (SessionLimitException e) { throw new WebApplicationException(e, FORBIDDEN); } String uri = uriInfo.getRequestUri().toString(); while (uri.endsWith("/")) uri = uri.substring(0, uri.length() - 1); uri += "/" + s.getID(); ResponseBuilder rb = Response.created(URI.create(uri)); // addCORSOrigin(servletContext, rb, headers); return rb.build(); }
/** * Used to create an OntoNet session with a specified identifier. * * @param sessionId * the identifier of the session to be created. * @param uriInfo * @param headers * @return {@link Status#OK} if the creation was successful, or {@link Status#CONFLICT} if a session with * that ID already exists. */ @PUT public Response createSession(@PathParam("id") String sessionId, // @Context UriInfo uriInfo, @Context HttpHeaders headers) { try { session = sesMgr.createSession(sessionId); } catch (DuplicateSessionIDException e) { throw new WebApplicationException(e, CONFLICT); } catch (SessionLimitException e) { throw new WebApplicationException(e, FORBIDDEN); } ResponseBuilder rb = Response.created(uriInfo.getRequestUri()); // addCORSOrigin(servletContext, rb, headers); return rb.build(); }
session = sessionManager.createSession(); } catch (SessionLimitException e1) { throw new EngineException(