Package org.apache.wookie.exceptions

Examples of org.apache.wookie.exceptions.ResourceNotFoundException


   */
  @Override
  protected void show(String resourceId, HttpServletRequest request, HttpServletResponse response) throws ResourceNotFoundException, UnauthorizedAccessException, IOException {
     IWidgetInstance instance = WidgetInstancesController.getLocalizedWidgetInstance(request);
     if (instance == null){
       throw new ResourceNotFoundException();
     } else {
       // Check the API key matches
       String apiKey = request.getParameter("api_key");
       if (!instance.getApiKey().equals(apiKey)) throw new UnauthorizedAccessException();
       // Return the response XML
View Full Code Here


   
    //
    // If there is no resource part of the requested path, or the request is not for a ".wgt" file, return a 404 immediately
    //
    if (resourceId == null || resourceId.trim().length() == 0 || !resourceId.endsWith(".wgt")) {
      throw new ResourceNotFoundException();
    }
   
    //
    // Get the file path for the requested item
    //
    String requestedPackageFilePath = request.getSession().getServletContext().getRealPath(FlatpackFactory.DEFAULT_FLATPACK_FOLDER+"/"+resourceId);
   
    //
    // Get the widget package corresponding to the path, and throw a 404 if it doesn't exist
    //
    File widgetPackage = new File(requestedPackageFilePath);
    if (!widgetPackage.exists()){
      throw new ResourceNotFoundException();
    }
   
    //
    // Log the download and the IP used
    //
View Full Code Here

   */
  @Override
  protected void show(String resourceId, HttpServletRequest request, HttpServletResponse response) throws ResourceNotFoundException, UnauthorizedAccessException, IOException {
    IWidgetInstance instance = WidgetInstancesController.getLocalizedWidgetInstance(request);
    if (instance == null){
      throw new ResourceNotFoundException();
    } else {
      //
      // Check the API key matches
      //
      String apiKey = request.getParameter("api_key");
View Full Code Here

    if(userId==null || sharedDataKey==null || (serviceType==null && widgetId==null)){
      throw new InvalidParametersException();
    }
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if(instance==null){
      throw new ResourceNotFoundException();
    }
    else{
      WidgetInstanceFactory.destroy(instance);
      return true;
    }       
View Full Code Here

  // Implementation
 
  @Override
  public void show(String resourceId,HttpServletRequest request, HttpServletResponse response) throws UnauthorizedAccessException,ResourceNotFoundException, IOException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new ResourceNotFoundException();
    IParticipant[] participants = new SharedContext(instance).getParticipants();
    switch (format(request)) {
       case XML: returnXml(ParticipantHelper.createXMLParticipantsDocument(participants),response);break;
       case JSON: returnJson(ParticipantHelper.createJSONParticipantsDocument(participants),response);break;
       default: returnXml(ParticipantHelper.createXMLParticipantsDocument(participants),response);break;
View Full Code Here

    String participantId = request.getParameter("participant_id"); //$NON-NLS-1$
    if(new SharedContext(instance).removeParticipant(participantId)){
      Notifier.notifyWidgets(session, instance, Notifier.PARTICIPANTS_UPDATED);
      return true;
    }else{
      throw new ResourceNotFoundException();       
    }
  }
View Full Code Here

      UnauthorizedAccessException, IOException {
    // attempt to get specific widget by id; note that this is the internal
    // widget integer ID and not the widget URI
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
    if (widget == null) throw new ResourceNotFoundException();
    // redirect to the UDD
    if (widget.getUpdateLocation() ==  null) throw new ResourceNotFoundException();
    response.sendRedirect(widget.getUpdateLocation());
  }
View Full Code Here

      throws ResourceNotFoundException, InvalidParametersException,
      UnauthorizedAccessException {
      // attempt to get specific widget by id
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
      if (widget == null) throw new ResourceNotFoundException();
      // FIXME localize error messages
      try {
        W3CWidgetFactory factory  = getFactory(request.getSession().getServletContext());
        installUpdate(factory, widget, false);
      } catch (IOException e) {
View Full Code Here

   * @return true if successfully deleted
   * @throws ResourceNotFoundException
   */
  public static boolean remove(String resourceId) throws ResourceNotFoundException {
    IWidgetService service = getWidgetService(resourceId);
    if (service == null) throw new ResourceNotFoundException();
    String serviceName = service.getServiceName();
   
    // if exists, remove from widget default table
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetDefault[] widgetDefaults = persistenceManager.findByValue(IWidgetDefault.class, "widgetContext", serviceName);
View Full Code Here

  protected void update(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,InvalidParametersException {
    String name = request.getParameter("name");
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws = getWidgetService(resourceId);
    if (ws == null) throw new ResourceNotFoundException();
    ws.setServiceName(name);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(ws);
  }
View Full Code Here

TOP

Related Classes of org.apache.wookie.exceptions.ResourceNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.