当您安装Bonjour for Windows时,您可以从系统中的任何位置解析任何".local"mDNS名称.
例如,您可以"ping some_computer.local"并且mDNSResponder.exe(Bonjour/mDNS守护程序)将响应.
但是,mDNS在端口5353上运行,那么Windows如何知道如何解决这些DNS查询呢?
mDNSResponder.exe以某种方式挂钩到Windows DNS解析器吗?
我知道如何为路由创建多个解析类,但我不知道如何将一个解析的结果传递给另一个解析.
// Example Route
{
path: 'book/:id',
component: BookComponent,
resolve: {
document: BookResolve,
title: BookTitleResolve
}
}
Run Code Online (Sandbox Code Playgroud)
如果BookResolve返回一个book对象,那么如何将该book对象传递给BookTitleResolve?
我有一个标题服务,在数据中查找关键标题.我需要能够从书籍对象生成书名.这需要是动态的.
我可以MultipartResolver使用maxUploadSize10K(10000字节)来定义这样的:
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10000"/>
</bean
Run Code Online (Sandbox Code Playgroud)
但是,如果管理员需要通过超过此限制的管理界面上传一些大文件,则需要临时重新配置应用程序以允许此操作 - 然后再次重新配置以确保常规用户不超过此限制.
当然,当发生这种情况时,普通用户可能会在没有收到警告的情况下潜入大文件.
有没有办法配置解析器maxUploadSize在这两种情况下使用不同的?
所以我的应用程序基于角度2(角度cli)和一些CMS.页面的某些片段从CMS下载并显示在角度2页面上.主要问题是页眉和页脚来自CMS.所以我想知道如何添加全局解析器(全局非常重要,我不想为应用程序中的每个路径路径添加解析器),这将强制角度等待CMS返回页眉和页脚.我已经成功使用解析器通过实现路由接口等待某些路由上的某些数据
export class InboxResolver implements Resolve<MessageListItem[]>
Run Code Online (Sandbox Code Playgroud)
我在一些自定义路线中使用它:
const MessagesRoutes: Routes = [
{
path: 'inbox',
component: InboxComponent,
resolve: { messages: InboxResolver }
}
];
Run Code Online (Sandbox Code Playgroud)
但是如何在一个地方定义一个全局HeaderAndFooterResolver?
我正在尝试做一个返回用户的简单Resolve.但是,在我的应用程序中,我需要使用自己的类包装http组件,该类将Subject作为observable返回. 我的解析器在第一个用户链接上按预期工作,但在Resolve之后单击UserProfileComponent中的任何用户链接时,Resolve永远不会再次完成. 我可以看到浏览器URL使用新ID更改,并且UserResolve中的console.log打印,但没有任何反应.
我的路由器:
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component';
import { UserProfileComponent } from './user-profile/user-profile.component';
import { LoginComponent } from './login/login.component';
import { AuthGuard } from './_resolve/guard.auth';
import { UserResolve } from './_resolve/user.resolve';
const appRoutes: Routes = [
{ path: '', component: DashboardComponent, canActivate: [AuthGuard] },
{ path: 'user/:id', component: UserProfileComponent, canActivate: [AuthGuard], resolve: { user: UserResolve } },
{ path: 'login', component: LoginComponent },
// otherwise redirect to home
{ path: …Run Code Online (Sandbox Code Playgroud) 我已经尝试了 Google Results、Stackoverflow 和 AutoMapper 中的大部分示例。但无法使 IValueResolverdependancy 注入工作。
我有以下服务
public class StorageService : IStorageService
{
private readonly BlobServiceSettings _blobServiceSettings;
public StorageService(IOptions<BlobServiceSettings> blobServiceSettings)
{
_blobServiceSettings = blobServiceSettings.Value;
}
// some methods I need
}
Run Code Online (Sandbox Code Playgroud)
这是我的个人资料
public class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<Building, BuildingEnvelope>(MemberList.None)
.ForMember(dest => dest.ImageUrl, opt => opt.ResolveUsing<BuildingImageUrlResolver>());
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 IValueResolver
public class BuildingImageUrlResolver : IValueResolver<Building, BuildingEnvelope, string>
{
private readonly IStorageService _storageService;
public BuildingImageUrlResolver(IStorageService storageService)
{
_storageService = storageService;
}
public string Resolve(Building entity, BuildingEnvelope …Run Code Online (Sandbox Code Playgroud) 请原谅一个非常初学者的问题。
我在理解nginx'resolver'参数及其工作方式时遇到麻烦。我已经阅读了文档,搜索了教程和帖子(使用诸如resolver,nginx和dns之类的关键字),但仍不确定如何应用resolver。
http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
“配置用于将上游服务器的名称解析为地址的名称服务器...。”
resolver ns1.myhost.com ns2.myhost.com;但是示例指向内部/专用IP地址。“可以指定一个地址作为域名或IP地址,以及一个可选端口。
resolver example.com
www.example.com;(或resolver 12.34.56.78;),但是再次,我在文档中没有看到这样的例子。作为一个实际的例子,让我们说-纯粹是假设性的:)-我正在构建一个简单的Web服务器,上面带有几个服务器块。
是否将“解析器”设置为服务器本身的IP?还是服务器局域网中的内部IP?该文档似乎建议使用内部IP(127.xxx或10.xxx),但是如何设置/确定该IP是什么?
在 nginx 容器的 proxy_pass 配置中使用变量重写和代理内部 Openshift 服务时,由于需要解析器,NGINX 无法解析服务的 DNS。例如:
location /api/ {
set $pass_url http://service.namespace.svc:8080$request_uri;
proxy_pass $pass_url;
}
Run Code Online (Sandbox Code Playgroud)
使用标准 Kubernetes 时,我可以kube-dns.kube-system.svc.cluster.local用作解析器:
resolver kube-dns.kube-system.svc.cluster.local;
Run Code Online (Sandbox Code Playgroud)
但是 Openshift 不提供这个。我尝试使用容器中的 IP /etc/resolv.conf,它只是运行 DNS 服务器的集群中的节点之一,但它仍然无法解析。
最奇怪的部分是nslookup service.namespace.svc从容器终端内部使用名称服务器/etc/resolv.conf,它工作正常。
我可以使用 Openshift 中的 Kubernetes DNS 主机名,或者其他解决方案来解决这个问题?
我编写了一个 GraphQL 查询,如下所示:
{
posts {
author {
comments
}
comments
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道如何获取有关posts解析器中请求的子字段的详细信息。
我想这样做是为了避免解析器的嵌套调用。我正在使用 ApolloServer 的DataSourceAPI。
我可以更改 API 服务器以一次获取所有数据。
我正在使用 ApolloServer 2.0,也欢迎任何其他避免嵌套调用的方法。
第一:是的,我事先用谷歌搜索过,而且出现的解决方案对我不起作用.
上下文
我有一个调用服务的Angular 2组件,并且在收到响应后需要执行一些数据操作:
ngOnInit () {
myService.getData()
.then((data) => {
this.myData = /* manipulate data */ ;
})
.catch(console.error);
}
Run Code Online (Sandbox Code Playgroud)
在其模板中,该数据将传递给子组件:
<child-component [myData]="myData"></child-component>
Run Code Online (Sandbox Code Playgroud)
这导致了孩子myData未定义的错误.上面发布的谷歌搜索结果谈到了使用,Resolver但这对我不起作用.
当我创建一个新的解析器时:
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs/Rx';
import { MyService } from './my.service';
@Injectable()
export class MyResolver implements Resolve<any> {
constructor(private myService: MyService) {}
resolve (route: ActivatedRouteSnapshot): Observable<any> {
return Observable.from(this.myService.getData());
}
}
Run Code Online (Sandbox Code Playgroud)
app.routing.ts
const appRoutes: …Run Code Online (Sandbox Code Playgroud) resolver ×10
angular ×4
dns ×3
nginx ×2
angular-cli ×1
apollo ×1
automapper ×1
bonjour ×1
graphql ×1
java ×1
mdns ×1
multipart ×1
observable ×1
openshift ×1
resolve ×1
routing ×1
rxjs ×1
spring ×1
spring-mvc ×1
windows ×1