2013-07-30 2 views
0

Здравствуйте, я пытаюсь разработать мое веб-приложение с помощью jsp. У меня есть 6 страниц jsp. Страницы are register.jsp, login.jsp, r1.jsp, welcome.jsp, createroom.jsp и lounge.jsp уважительно. Моя цель состоит в том, что при входе в систему на странице входа страница должна перенаправляться на сервере openmeeting. Для этого я создал webservice, например omRestService. Для вызова этой службы я создал два класса java класса omGateWay и OmPluginSettings. Все работает нормально, но ошибка возникает в ompluginSetting class.error, упомянутом ниже.Как решить Импорт com.atlassian не может быть разрешен?

import com.atlassian.sal.api.pluginsettings.PluginSettings; 
import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; 
(The import com.atlassian cannot be resolved) 

Здесь я предоставляю вам свой файл OmPluginSeeting.java с ошибкой. В PluginSettingsFactory много ошибок.

 package restService; 

    import com.atlassian.sal.api.pluginsettings.PluginSettings; 
    import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory; 
    import org.slf4j.Logger; 
    import org.slf4j.LoggerFactory; 

    public class OmPluginSettings 
    { 
private static final Logger log = (Logger) LoggerFactory.getLogger(OmPluginSettings.class); 
    final PluginSettingsFactory pluginSettingsFactory; 

    public OmPluginSettings(PluginSettingsFactory pluginSettingsFactory) 
    { 
    this.pluginSettingsFactory = pluginSettingsFactory; 
    } 

    public void storeSomeInfo(String key, String value) 
    { 
    this.pluginSettingsFactory.createGlobalSettings().put("openmeetings:" + key, value); 
    } 

    public Object getSomeInfo(String key) 
     { 
    return this.pluginSettingsFactory.createGlobalSettings().get("openmeetings:" + key); 
     } 

    public void storeSomeInfo(String projectKey, String key, String value) 
    { 
    this.pluginSettingsFactory.createSettingsForKey(projectKey).put("openmeetings:" + key, 
    value); 
    } 

    public Object getSomeInfo(String projectKey, String key) { 
    return this.pluginSettingsFactory.createSettingsForKey(projectKey).get("openmeetings:" 
    + key); 
    } 
    } 

Я также предоставляю услуги по ремонту, которые предоставляются ниже и абсолютно без ошибок.

package restService; 
      import java.io.BufferedReader; 
      import java.io.ByteArrayInputStream; 
      import java.io.IOException; 
      import java.io.InputStream; 
      import java.io.InputStreamReader; 
      import java.io.UnsupportedEncodingException; 
      import java.net.MalformedURLException; 
      import java.net.URI; 
      import java.net.URL; 
      import java.util.Iterator; 
      import java.util.LinkedHashMap; 
     import javax.ws.rs.core.UriBuilder; 
      import org.apache.commons.httpclient.HttpClient; 
      import org.apache.commons.httpclient.HttpException; 
      import org.apache.commons.httpclient.methods.GetMethod; 
      import org.dom4j.Document; 
      import org.dom4j.DocumentException; 
      import org.dom4j.Element; 
      import org.dom4j.io.SAXReader; 
      import org.slf4j.Logger; 
      import org.slf4j.LoggerFactory; 

      public class omRestService 
      { 
      private static final Logger log = (Logger) 
      LoggerFactory.getLogger(omRestService.class); 

       private URI getURI(String url) { 
       return UriBuilder.fromUri(
       url).build(new Object[0]); 
       } 

       private String getEncodetURI(String url) throws MalformedURLException 
       { 
       return new URL(url).toString().replaceAll(" ", "%20"); 
       } 

       public LinkedHashMap<String, Element> call(String request, Object param) 
       throws Exception 
       { 
       HttpClient client = new HttpClient(); 
       GetMethod method = null; 
       try 
       { 
       method = new GetMethod(getEncodetURI(request).toString()); 
       } 
       catch (MalformedURLException e) { 
       e.printStackTrace(); 
       } 
       int statusCode = 0; 
       try { 
       statusCode = client.executeMethod(method); 
       } 
       catch (HttpException e) 
       { 
       throw new Exception("Connection to OpenMeetings refused. Please check your 
       OpenMeetings configuration."); 
       } 
       catch (IOException e) 
       { 
       throw new Exception("Connection to OpenMeetings refused. Please check your 
       OpenMeetings configuration."); 
       } 

       switch (statusCode) 
       { 
       case 200: 
       break; 
       case 400: 
       throw new Exception("Bad request. The parameters passed to the service did 
       not match 
       as expected. The Message should tell you what was missing or incorrect."); 
       case 403: 
       throw new Exception("Forbidden. You do not have permission to access this 
       resource, or 
       are over your rate limit."); 
       case 503: 
       throw new Exception("Service unavailable. An internal problem prevented us 
        from 
       returning data to you."); 
       default: 
       throw new Exception("Your call to OpenMeetings! Web Services returned an 
       unexpected 
       HTTP status of: " + statusCode); 
       } 

      InputStream rstream = null; 
       try 
       { 
       rstream = method.getResponseBodyAsStream(); 
       } 
       catch (IOException e) { 
       e.printStackTrace(); 
       throw new Exception("No Response Body"); 
       } 

      BufferedReader br = new BufferedReader(new InputStreamReader(rstream)); 

      SAXReader reader = new SAXReader(); 

      Document document = null; 
       String line; 
       try 
       { 
       // String line; 
       while ((line = br.readLine()) != null) 
        { 
        // String line; 
       document = reader.read(new ByteArrayInputStream(line.getBytes("UTF-8"))); 
        } 

       } 
       catch (UnsupportedEncodingException e) 
       { 
       e.printStackTrace(); 
       throw new Exception("UnsupportedEncodingException by SAXReader"); 
       } 
       catch (IOException e) { 
       e.printStackTrace(); 
       throw new Exception("IOException by SAXReader in REST Service"); 
       } 
       catch (DocumentException e) { 
       e.printStackTrace(); 
       throw new Exception("DocumentException by SAXReader in REST Service"); 
       } finally { 
       br.close(); 
       } 

      Element root = document.getRootElement(); 

      LinkedHashMap elementMap = new LinkedHashMap(); 

      for (Iterator i = root.elementIterator(); i.hasNext();) 
       { 
       Element item = (Element)i.next(); 

       if (item.getNamespacePrefix() == "soapenv") { 
       throw new Exception(item.getData().toString()); 
        } 
       String nodeVal = item.getName(); 
       elementMap.put(nodeVal, item); 
       } 

      return elementMap; 
       } 
      } 

После этого RestService я есть сделать класс OmGateWay, который имеет много метод интеграции с openmeetings. который приводится ниже:

  package org.openmeetings.jira.plugin.gateway; 

      import java.util.LinkedHashMap; 
      import org.dom j.Element; 
      import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings; 
      import org.slf j.Logger; 
      import org.slf j.LoggerFactory; 

      public class OmGateway 
      { 
        private static final Logger log =  
      LoggerFactory.getLogger(OmGateway.class); 
      private OmRestService omRestService; 
      private OmPluginSettings omPluginSettings; 
      private String sessionId; 

      public OmGateway(OmRestService omRestService, OmPluginSettings omPluginSettings) 
      { 
        this.omRestService = omRestService; 
        this.omPluginSettings = omPluginSettings; 
      } 

      public Boolean loginUser() throws Exception 
      { 
        LinkedHashMap result = null; 

        String url = (String)this.omPluginSettings.getSomeInfo("url"); 
        String port = (String)this.omPluginSettings.getSomeInfo("port"); 
        String userpass = (String)this.omPluginSettings.getSomeInfo("userpass"); 
        String omusername = 
        (String)this.omPluginSettings.getSomeInfo("username"); 

        String sessionURL = "http://" + url + ":" + port + "/openmeetings 
        /services/  
        UserService/getSession"; 

        LinkedHashMap elementMap = this.omRestService.call(sessionURL, null); 

        Element item = (Element)elementMap.get("return"); 

        setSessionId(item.elementText("session_id")); 

        log.info(item.elementText("session_id")); 

        result = this.omRestService.call("http://" + url + ":" + port + 
        "/openmeetings/ 
        services/UserService/loginUser?SID=" + getSessionId() + "&username=" + 
        omusername 
        + "&userpass=" + userpass, null); 
        if 

     (Integer.valueOf(((Element)result.get("return")).getStringValue()).intValue() >  
    ) { 
         return Boolean.valueOf(true); 
       } 
        return Boolean.valueOf(false); 
      } 

      public Long addRoomWithModerationExternalTypeAndTopBarOption(Boolean 
      isAllowedRecording, 
      Boolean isAudioOnly, Boolean isModeratedRoom, String name, Long 
      numberOfParticipent, Long 
      roomType, String externalRoomType) 
       throws Exception 
      { 
        String url = (String)this.omPluginSettings.getSomeInfo("url"); 
        String port = (String)this.omPluginSettings.getSomeInfo("port"); 

        String roomId = ""; 

        String restURL = "http://" + url + ":" + port + "/openmeetings/services/ 
        RoomService/addRoomWithModerationExternalTypeAndTopBarOption?" + 
         "SID=" + getSessionId() + 
         "&name=" + name + 
         "&roomtypes_id=" + roomType.toString() + 
         "&comment=jira" + 
         "&numberOfPartizipants=" + numberOfParticipent.toString() + 
         "&ispublic=false" + 
         "&appointment=false" + 
         "&isDemoRoom=false" + 
         "&demoTime=" + 
         "&isModeratedRoom=" + isModeratedRoom.toString() + 
         "&externalRoomType=" + externalRoomType + 
         "&allowUserQuestions=" + 
         "&isAudioOnly=" + isAudioOnly.toString() + 
         "&waitForRecording=false" + 
        "&allowRecording=" + isAllowedRecording.toString() + 
        "&hideTopBar=false"; 

        LinkedHashMap result = this.omRestService.call(restURL, null); 

        roomId = ((Element)result.get("return")).getStringValue(); 
        return Long.valueOf(roomId); 
      } 

      public Long updateRoomWithModerationAndQuestions(Boolean isAllowedRecording, 
      Boolean 
      isAudioOnly, Boolean isModeratedRoom, String roomname, Long 
      numberOfParticipent, Long 
      roomType, Long roomId) 
       throws Exception 
      { 
        String url = (String)this.omPluginSettings.getSomeInfo("url"); 
        String port = (String)this.omPluginSettings.getSomeInfo("port"); 
        String updateRoomId = ""; 

        String restURL = "http://" + url + ":" + port + "/openmeetings/services 
       /RoomService/ 
        updateRoomWithModerationAndQuestions?" + 
        "SID=" + getSessionId() + 
        "&room_id=" + roomId.toString() + 
        "&name=" + roomname.toString() + 
        "&roomtypes_id=" + roomType.toString() + 
        "&comment=" + 
        "&numberOfPartizipants=" + numberOfParticipent.toString() + 
        "&ispublic=false" + 
        "&appointment=false" + 
        "&isDemoRoom=false" + 
        "&demoTime=" + 
        "&isModeratedRoom=" + isModeratedRoom.toString() + 
        "&allowUserQuestions="; 

        LinkedHashMap result = this.omRestService.call(restURL, null); 

        log.info("addRoomWithModerationExternalTypeAndTopBarOption with ID: ", 
        ((Element)result.get("return")).getStringValue()); 

        updateRoomId = ((Element)result.get("return")).getStringValue(); 

        return Long.valueOf(updateRoomId); 
      } 

      public String setUserObjectAndGenerateRoomHash(String username, String 
      firstname, String 
      lastname, String profilePictureUrl, String email, String externalUserId, String 
       externalUserType, Long room_id, int becomeModeratorAsInt, int 
      showAudioVideoTestAsInt) 
       throws Exception 
      { 
        String url = (String)this.omPluginSettings.getSomeInfo("url"); 
        String port = (String)this.omPluginSettings.getSomeInfo("port"); 
        String roomHash = null; 

        String restURL = "http://" + url + ":" + port + "/openmeetings/services 
       /UserService/ 
        setUserObjectAndGenerateRoomHash?" + 
        "SID=" + getSessionId() + 
        "&username=" + username + 
        "&firstname=" + firstname + 
        "&lastname=" + lastname + 
        "&profilePictureUrl=" + profilePictureUrl + 
        "&email=" + email + 
        "&externalUserId=" + externalUserId + 
        "&externalUserType=" + externalUserType + 
        "&room_id=" + room_id + 
        "&becomeModeratorAsInt=" + becomeModeratorAsInt + 
        "&showAudioVideoTestAsInt=" + showAudioVideoTestAsInt; 

        LinkedHashMap result = this.omRestService.call(restURL, null); 

        roomHash = ((Element)result.get("return")).getStringValue(); 

        return roomHash; 
      } 

      public String getSessionId() { 
        return this.sessionId; 
      } 

      public void setSessionId(String sessionId) { 
        this.sessionId = sessionId; 
      } 
      } 

Я хочу назвать loginuser метод из OmGateway класса на Jsp Button Click Event. Пожалуйста, помогите мне решить эту ошибку. И помощь в перенаправлении и интеграции в openmeetings. Заранее спасибо.

+0

Вы импортировали необходимые библиотеки в свой проект? – Abubakkar

+0

какая библиотека нужна ??? – Kapil

+0

@Rajan Если он говорит, что 'com.atlassian не может быть разрешен', вам нужно включить библиотеку. Добавьте библиотеку в сборку или узел сборки, если вы развертываете приложение на сервере приложений. – q99

ответ