我在swing应用程序中使用JWebBrowser.本课程属于DJ Project.它需要swt jar来执行.现在我已将swt jar for windows包含在应用程序的jar包装中.我想知道如何在同一包装中包含用于linux/mac的swt jar?我正在使用ant来构建应用程序jar.我应该为不同的平台构建不同的swt jar吗?
目前我正在研究TMDb API的实现.有一种称为用户身份验证的方法.我已成功实施了第1步
第1步:生成请求令牌
首先对新的令牌方法进行API调用.这将返回一个有效60分钟的新请求令牌.在此阶段,用户未授权请求令牌.请求令牌是特定于API帐户的,并且是您在步骤2中与应用程序和用户之间的关系.
对于第1步,我有以下代码:
URL url = new URL("http://api.themoviedb.org/3/authentication/token/new?api_key=the_key");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringWriter writer = new StringWriter();
String line;
while ((line = reader.readLine()) != null) {
writer.write(line);
}
reader.close();
Map<String, List<String>> headerFields = connection.getHeaderFields();
String callBackUrl = null;
for(Map.Entry<String, List<String>> entry : headerFields.entrySet()) {
if(entry.getKey() != null && entry.getKey().equals("Authentication-Callback")) {
callBackUrl = entry.getValue().get(0);
}
}
Run Code Online (Sandbox Code Playgroud)
它在控制台中打印回调URL以及请求令牌(如果我将其转换writer.toString()为Json对象).
但第二部分是用户名和密码的用户身份验证.回调URL将用户重定向到TMDb的登录页面.我已经通过将回调网址从控制台复制粘贴到浏览器来测试它.
第2步说明:
第2步:从用户请求授权
获得有效的请求令牌后,您的应用程序需要打开Web浏览器并将其发送到TMDb.生成新令牌时的HTTP响应将包含可以轻松用于重定向的Authentication-Callback标头.
如果用户未登录到TMDb,则会在被要求授予您的应用程序使用其帐户的权限之前将其重定向到登录页面.一旦用户授予您的应用程序使用其帐户的权限,此过程的基于浏览器的部分就结束了,您可以将它们返回到您的应用程序.
就像对新令牌的请求一样,批准的响应将包括Authentication-Callback标头,这也是将应用程序重定向回API并生成真实会话ID的便捷方式.
现在我的问题是:如果我有用户名和密码,我可以通过HttpURLConnection或任何其他方式验证该用户吗?
我试过这个:
url …Run Code Online (Sandbox Code Playgroud) 我试图WebMethod从JavaScript 调用一个.到目前为止,我有:
EMSWebService.asmx:
namespace EMSApplication.Web.WebServices
{
/// <summary>
/// Holds the Webservice methods of EMSApplication
</summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class EMSWebService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
Run Code Online (Sandbox Code Playgroud)
在aspx页面中,我添加了以下内容:
<asp:ScriptManager ID="ScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/WebServices/EMSWebService.asmx" />
</Services>
</asp:ScriptManager>
<input onclick="callWebMethod();" id="btn" type="button" value="Click Me" />
Run Code Online (Sandbox Code Playgroud)
JavaScript是:
<script type="text/javascript">
function callWebMethod() {
EMSApplication.Web.WebServices.EMSWebService.HelloWorld(OnComplete, OnError);
}
function OnComplete(result) {
alert(result);
}
function OnError(result) {
alert(result.get_message());
}
</script> …Run Code Online (Sandbox Code Playgroud) 这是我第一次编写Annotation Processor,我想以编程方式调用它.可能吗?
我为处理器编写了小代码:
@SupportedAnnotationTypes({"app.dev.ems.support.annotation.HBMModel"})
public class HBMModelProcessor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(HBMModel.class);
System.out.println(elements);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
现在如果我想调用流程方法,那我该怎么做呢?我可以通过以下方式完成:
HBMModelProcessor modelProcessor = new HBMModelProcessor();
modelProcessor.process(annotations, roundEnv)
Run Code Online (Sandbox Code Playgroud)
任何信息对我都非常有帮助.
谢谢.
问题说明了一切.当我打印属性时,它是:
cn: WF-008-DAM-PS
Run Code Online (Sandbox Code Playgroud)
代码段是:
private void searchGroup() throws NamingException {
NamingEnumeration<SearchResult> searchResults = getLdapDirContext().search(groupDN, "(objectclass=groupOfUniqueNames)", getSearchControls());
String searchGroupCn = getCNForBrand(m_binder.getLocal("brandId"), m_binder.getLocal("brandName"));
Log.info(searchGroupCn);
while (searchResults.hasMore()) {
SearchResult searchResult = searchResults.next();
Attributes attributes = searchResult.getAttributes();
Attribute groupCn = attributes.get("cn");
if(groupCn != null) {
Log.info(groupCn.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到的值是:WF-008-DAM-PS没有关键部分?问候.
在我的应用程序中,我有三个下拉菜单(p:selectOneMenu),例如A,B,C.其中两个是依赖的,比如B和C.通过更改BI的值,我动态地将值加载到C.还有一个文本框.当on-change事件从这三个下拉列表触发时,文本框的值由ajax生成.
这是xhtml:
<p:selectOneMenu id="customerMenu" value="#{adminController.activityDTO.customerId}" required="true" label="Customer Name" style="width: 200px">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{adminController.customers}" var="customer" itemLabel="#{customer.customerName}" itemValue="#{customer.customerId}" />
<p:ajax listener="#{adminController.generateActivityName}" update="activityId" />
</p:selectOneMenu>
<p:selectOneMenu id="activityTypeMenu" value="#{adminController.activityDTO.activityParentType}" required="true" label="Activity Type"
style="width: 200px">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{adminController.activityTypes}" var="activityType" itemLabel="#{activityType.parent}" itemValue="#{activityType.parent}" />
<p:ajax listener="#{adminController.updateDependentActivity}" update="activitySubType" />
</p:selectOneMenu>
<p:selectOneMenu id="activitySubTypeMenu" value="#{adminController.activityDTO.activitySubType}" required="true" label="Activity Sub Type"
style="width: 200px">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{adminController.activitySubTypes}" var="activityType" itemLabel="#{activityType.name}" itemValue="#{activityType.id}" />
<p:ajax listener="#{adminController.generateActivityId}" update="activityId" />
</p:selectOneMenu>
<p:inputText id="activityId" autocomplete="off" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用katalon studio上传文件进行自动化测试(web测试.点击'浏览'按钮后,Windows弹出窗口打开,但我无法选择照片或转到特定路径.我找到了一个命令WebUI.UploadFile( )但我认为我没有正确使用它.
如果有人有这样的事情,请分享您的经验.我怎么能在katalon做到这一点?
testing automation automated-tests browser-automation katalon-studio
是否通过连续鼠标点击生成任何事件,即不释放鼠标按钮1?如果不是,请告诉我.
感谢致敬.
我正在使用swingx,spring和使用ant构建它们来开发桌面应用程序.这是我在蚂蚁的第一个项目.如何将类路径jar添加到ant构建的可执行jar中?我有swingx,spring jar进入我的classpath.这是我的jar目标:
<target name="jar">
<mkdir dir="build/jar" />
<jar destfile="build/jar/MainClass.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="MainClass" />
</manifest>
</jar>
</target>
Run Code Online (Sandbox Code Playgroud)
编辑:
<project name="Number">
<description>
description
</description>
<property name="lib" value="lib" />
<property name="src" value="src" />
<property name="build" value="build" />
<property name="classes" value="classes" />
<property name="jar" value="jar"/>
<target name="clean">
<delete dir="${build}" />
</target>
<path id="classpath">
<fileset dir="${lib}" includes="**/*.jar" />
</path>
<target name="compile">
<mkdir dir="${build}/${classes}" />
<javac srcdir="${src}" destdir="${build}/${classes}" classpathref="classpath" />
</target>
<target name="jar" depends="clean, compile">
<mkdir dir="${build}/${jar}" />
<jar destfile="build/jar/Number.jar" basedir="${build}/${classes}">
<manifest>
<attribute name="Main-Class" …Run Code Online (Sandbox Code Playgroud) 我想在Eclipse CDT 64位工作,我已经在我的机器上安装了它.但在那之后我才知道它需要MinGW才能工作.但我没有找到任何网站,我可以知道如何设置MinGW64位.任何指针都对我很有帮助.
java ×5
ant ×2
javascript ×2
annotations ×1
asmx ×1
automation ×1
c ×1
c# ×1
c++ ×1
eclipse-cdt ×1
html ×1
http ×1
jndi ×1
jsf ×1
jsf-2 ×1
ldap ×1
mingw-w64 ×1
primefaces ×1
swing ×1
swt ×1
testing ×1
windows-7 ×1