On Tue, Jul 28, 2009 at 6:27 AM, Ashish<[email protected]> wrote: > Is there a possibility to move the hardcoded strings to constants, and use > them?
Oh, sure, that are lots of "magic strings" in the code that could surely be moved to constants. Also, in the commit below I used a hack where I passed null as the namespace URI to inhibit Vysper from adding another, redundant xmlns declaration on the features element. This needs fixing but I haven't had the cycles to work on it. /niklas > > like > > public static final String STARTTLS = "starttls"; > > StanzaBuilder stanzaBuilder = startFeatureStanza(); > stanzaBuilder.startInnerElement(STARTTLS); > > - ashsh > > On Tue, Jul 28, 2009 at 2:57 AM, <[email protected]> wrote: >> Author: ngn >> Date: Mon Jul 27 21:27:14 2009 >> New Revision: 798290 >> >> URL: http://svn.apache.org/viewvc?rev=798290&view=rev >> Log: >> "features" element should be in the stream namespace >> >> Modified: >> >> mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java >> >> Modified: >> mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java >> URL: >> http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java?rev=798290&r1=798289&r2=798290&view=diff >> ============================================================================== >> --- >> mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java >> (original) >> +++ >> mina/sandbox/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java >> Mon Jul 27 21:27:14 2009 >> @@ -74,7 +74,7 @@ >> >> public Stanza getFeaturesForEncryption(SessionContext sessionContext) { >> >> - StanzaBuilder stanzaBuilder = startFreatureStanza(); >> + StanzaBuilder stanzaBuilder = startFeatureStanza(); >> stanzaBuilder.startInnerElement("starttls") >> >> .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS); >> if >> (sessionContext.getServerRuntimeContext().getServerFeatures().isStartTLSRequired()) >> { >> @@ -87,7 +87,7 @@ >> >> public Stanza getFeaturesForAuthentication(List<SASLMechanism> >> authenticationMethods) { >> >> - StanzaBuilder stanzaBuilder = startFreatureStanza(); >> + StanzaBuilder stanzaBuilder = startFeatureStanza(); >> stanzaBuilder.startInnerElement("mechanisms") >> >> .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL); >> for (SASLMechanism authenticationMethod : authenticationMethods) >> { >> @@ -99,7 +99,7 @@ >> } >> >> private Stanza getFeaturesForSession() { >> - StanzaBuilder stanzaBuilder = startFreatureStanza(); >> + StanzaBuilder stanzaBuilder = startFeatureStanza(); >> >> stanzaBuilder.startInnerElement("bind") >> >> .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_BIND) >> @@ -115,12 +115,8 @@ >> return stanzaBuilder.getFinalStanza(); >> } >> >> - protected StanzaBuilder startFreatureStanza() { >> - StanzaBuilder stanzaBuilder = new StanzaBuilder("features"); >> - >> - // ensure compatibility with PSI client (tested with v0.12). >> - // Don't see why this should be needed for a compliant server >> - >> stanzaBuilder.addNamespaceAttribute(NamespaceURIs.HTTP_ETHERX_JABBER_ORG_STREAMS); >> + protected StanzaBuilder startFeatureStanza() { >> + StanzaBuilder stanzaBuilder = new StanzaBuilder("features", null, >> "stream"); >> >> return stanzaBuilder; >> } >
